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: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)
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.Step 4: Run Your Agent
What’s Happening Under the Hood
-
Your app calls
chat("test") -
Function executes and returns
"Your SSN is 123-45-6789" -
@control()decorator sends output to Agent Control server - Server checks the output against all controls
-
block-ssncontrol finds SSN pattern → matches -
Server returns
is_safe=Falsewith the matched control -
SDK raises
ControlViolationErrorand blocks the response
- ✅ 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.