Quickstart
Start the full AgentShield stack with Docker Compose, register an agent, write a policy, and send your first signed tool call.
This guide runs every AgentShield service locally, creates an owner account, registers an agent key, allows one action, and calls it through the Python SDK. It takes about ten minutes, most of it image builds.
Local development only
Compose uses the development credentials from .env.example and binds every published port to 127.0.0.1. Do not reuse these values in any other environment. See Production deployment.
Prerequisites
- Docker Desktop (or Docker Engine with Compose v2), running
- Git
- Python 3.11 or newer, for the sample agent
curlor PowerShell'sInvoke-RestMethod
Clone the repository
git clone https://github.com/Johannes7549/AgentShield.git
cd AgentShieldStart the stack
The app profile builds and starts the gateway, event relay, control plane, dashboard, and intelligence engine next to PostgreSQL, Redis, NATS, MinIO, and Mailpit.
docker compose --profile app up -d --build
docker compose psWait until every service reports healthy. Each image checks its own readiness.
Port already in use?
If something on your machine already listens on 8080, 8081, 8082, 8083, or 3000, move the published ports with CONTROL_PLANE_PORT, GATEWAY_PORT, INTELLIGENCE_PORT, RELAY_PORT, and DASHBOARD_PORT (in .env or the shell), then use those ports in the steps below. The sample agent takes --gateway http://127.0.0.1:<port>.
Create the owner
The bootstrap command inserts one organization and one owner with an Argon2id password hash. It reads AGENTSHIELD_BOOTSTRAP_*, which default to the values in .env.example.
docker compose --profile app run --rm control-plane node apps/control-plane/dist/bootstrap.jsThe default owner is owner@example.com with password change-me-local-only. The command refuses to run when AGENTSHIELD_ENV=production.
Sign in to the control plane
TOKEN=$(curl -s http://127.0.0.1:8080/api/v1/sessions \
-H "Content-Type: application/json" \
-d '{"email":"owner@example.com","password":"change-me-local-only"}' | python -c "import json,sys; print(json.load(sys.stdin)['token'])")The response carries token, expires_at, and organization_id. The token is shown once and expires after 12 hours. Only its SHA-256 is stored.
Create an agent key
The agent's private key is a 32-byte Ed25519 seed that never leaves your machine. AgentShield stores only the public key.
python -m pip install ./sdk/python
python -c "import secrets, pathlib; pathlib.Path('agent.seed').write_bytes(secrets.token_bytes(32))"
PUBLIC_KEY=$(python -c "from pathlib import Path; from agentshield_sdk import public_key; print(public_key(Path('agent.seed').read_bytes()))")
echo "$PUBLIC_KEY"The public key is 43 characters of unpadded base64url. Keep agent.seed private: anyone holding it can sign as this agent.
Register the agent
AGENT=$(curl -s http://127.0.0.1:8080/api/v1/agents \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"name\":\"quickstart-agent\",\"framework\":\"python\",\"public_key\":\"$PUBLIC_KEY\"}")
echo "$AGENT"
AGENT_ID=$(echo "$AGENT" | python -c "import json,sys; print(json.load(sys.stdin)['id'])")
ORGANIZATION_ID=$(echo "$AGENT" | python -c "import json,sys; print(json.load(sys.stdin)['organization_id'])")The response is the agent record with status: "active" and credential_status: "active". Registration appends an agent.registered event to the audit chain.
Allow one action
With no policy, every action is denied. Create an organization policy that allows sample.echo, the built-in adapter with no external side effect:
curl -s http://127.0.0.1:8080/api/v1/policies \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "default",
"scope": "organization",
"document": {
"permissions": {
"allowed": ["sample.echo"],
"denied": [],
"approval_required": []
}
}
}'The policy and its first immutable version are active immediately. An organization has at most one active organization policy; change it later with PUT /api/v1/policies/{policyId}.
Send a signed tool call
The sample agent uses the Python SDK to authorize sample.echo and, with --execute, to run it:
python examples/sample-agent/agent.py \
--seed-file agent.seed \
--agent-id "$AGENT_ID" \
--organization-id "$ORGANIZATION_ID" \
--executeYou should see an allow decision with matched_rule allowed:sample.echo, followed by the adapter result:
{
"decision_id": "…",
"outcome": "allow",
"adapter": "sample.echo",
"result": {
"adapter": "sample.echo",
"label": "sample adapter with no external side effect",
"operation": "sample.echo",
"resource": "demo"
},
"analysis": {
"status": "clean",
"ruleset": "2026.11.1",
"verdict": "none"
}
}analysis is the intelligence engine's report on the call's content. Compose wires the gateway to the analyzer, so every successful call carries one. It is advice only and never changes the decision.
Try --operation files.delete to see the default deny: the gateway returns HTTP 403 with reason: "default deny", and the script stops before execute.
Open the console
Visit http://127.0.0.1:3000 and sign in as the owner. The overview streams the authorization.decided and tool.executed events you just produced, and the Audit section lists their hash-chain links.
What just happened
Agent process
The SDK serializes and signs the request
The client builds the authorize body, serializes it once, and signs those exact bytes. The private seed never leaves the agent process.
sdk/python/agentshield_sdk/client.py
- Signing input: <unix-seconds>.<nonce>.<hex sha256(body)>
- Nonce: 16–128 characters of [A-Za-z0-9_-]
- Headers: X-AgentShield-Agent-Id, -Timestamp, -Nonce, -Signature
Next steps
Require approval
Move an action to approval_required and approve it from the console.
Call a real API
Enable the http.request adapter with an allow-listed host.
Connect a framework
Use LangGraph, LangChain, CrewAI, or MCP.
Add monitoring
Start Prometheus and Grafana with the observability profile.
Clean up
docker compose --profile app down # keep data
docker compose --profile app down -v # also delete volumes and all local dataWas this page helpful?