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
  • pip available

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.py

4. Verify governance ran

agentrust init --local
agentrust audit tail

5. Instant rollback (kill-switch)

export AGENTRUST_ENABLED=false
python agent.py  # runs unchanged, no governance overhead

Examples

CLI onboarding:

agentrust init              # cloud auth or --local for offline
agentrust status            # tier + gateway reachability
agentrust whoami            # current identity

Best Practices

  • Use embedded mode for first integration; promote to remote gateway via env vars only
  • Run agentrust status after changing AGENTRUST_GATEWAY_URL
  • Keep AGENTRUST_ENABLED=true in dev; test kill-switch before production deploy

Common Mistakes

  • Forgetting embed_gateway() when no remote gateway is configured
  • Installing agentrust-sdk without [embedded] extra when using embed_gateway()

Troubleshooting

IssueFix
Port 8765 in useexport AGENTRUST_EMBED_PORT=8766
ModuleNotFoundError: uvicornpip install "agentrust-sdk[embedded]"
No audit recordsConfirm AGENTRUST_ENABLED=true and gateway started