Getting Started
Quickstart
Get AgentTrust running in under 30 seconds with the embedded gateway.
Quickstart
Overview
Get AgentTrust running in under 30 seconds with the embedded gateway and @harness decorator. No external services, API keys, or configuration files required.
Why It Matters
The fastest way to understand AgentTrust is to run a governed agent locally. This quickstart proves the integration works before you wire up production infrastructure.
Prerequisites
- Python ≥ 3.10
pipavailable
Step-by-Step Guide
1. Install
pip install "agentrust-sdk[embedded,retry]"2. Create agent.py
from agentrust_sdk import harness, embed_gateway
embed_gateway() # starts in-process SQLite gateway on :8765
@harness
def my_agent(user: str, input: str) -> dict:
return {"answer": "Hello from a governed agent"}
if __name__ == "__main__":
result = my_agent(user="alice", input="What is AI governance?")
print(result)3. Run
python agent.py4. Verify governance ran
agentrust init --local
agentrust audit tail5. Instant rollback (kill-switch)
export AGENTRUST_ENABLED=false
python agent.py # runs unchanged, no governance overheadExamples
CLI onboarding:
agentrust init # cloud auth or --local for offline
agentrust status # tier + gateway reachability
agentrust whoami # current identityBest Practices
- Use embedded mode for first integration; promote to remote gateway via env vars only
- Run
agentrust statusafter changingAGENTRUST_GATEWAY_URL - Keep
AGENTRUST_ENABLED=truein dev; test kill-switch before production deploy
Common Mistakes
- Forgetting
embed_gateway()when no remote gateway is configured - Installing
agentrust-sdkwithout[embedded]extra when usingembed_gateway()
Troubleshooting
| Issue | Fix |
|---|---|
| Port 8765 in use | export AGENTRUST_EMBED_PORT=8766 |
ModuleNotFoundError: uvicorn | pip install "agentrust-sdk[embedded]" |
| No audit records | Confirm AGENTRUST_ENABLED=true and gateway started |