Skip to main content
Protect your AI agent in 4 simple steps.
Prefer a full demo walkthrough? See the complete Agent Control Demo for an end-to-end, runnable alternative.

Prerequisites

  • Python 3.12+
  • Docker — For running PostgreSQL

Step 1: Start the Agent Control Server

Choose one of the following setups.

Option A — SDK-only (fastest)

Install the SDK in your project:
Run the Agent Control server and PostgreSQL database via Docker Compose:
Server runs at http://localhost:8000

Option B — Local development

Prerequisites:
  • uv — Fast Python package manager (curl -LsSf https://astral.sh/uv/install.sh | sh)
  • Node.js 18+ — For the web dashboard (optional)
Server runs at http://localhost:8000 UI runs at http://localhost:4000
💡 Verify the server: Open http://localhost:8000/health — you should see {"status": "healthy", "version": "..."}.

Step 2: Register Your Agent

Agent must be registered with the server. You should also add the @control() decorator around tools and LLM call functions.

Step 3: Add Controls

The easiest way to add controls is to use the UI. You can also use the SDK or directly call the API.
In your Agent application directory (not inside the agent-control repo):

Step 4: Run Your Agent

🎉 Done! Your agent now blocks SSN patterns automatically.

What’s Happening Under the Hood

  1. Your app calls chat("test")
  2. Function executes and returns "Your SSN is 123-45-6789"
  3. @control() decorator sends output to Agent Control server
  4. Server checks the output against all controls
  5. block-ssn control finds SSN pattern → matches
  6. Server returns is_safe=False with the matched control
  7. SDK raises ControlViolationError and blocks the response
Key Benefits:
  • ✅ Controls are managed separately from your code
  • ✅ Update controls without redeploying your agent
  • ✅ Same controls can protect multiple agents
  • ✅ View analytics and control execution in the dashboard

Next Steps

  • Add more controls: See Controls for examples and guidance
  • Explore evaluators: Try AI-powered evaluators like Luna-2 or create custom evaluators. See DeepEval example for custom evaluator examples
  • Production setup: Enable authentication — see the Reference
  • Check examples: See Examples for real-world patterns
💡 Pro Tip: Start with simple regex controls, then graduate to AI-powered evaluators for complex safety checks.

What’s Next

Concepts

Learn about controls, selectors, evaluators, and actions.

Examples

See working integration examples with LangChain, CrewAI, and more.