Gateway API
Complete reference for the AgentShield runtime gateway. Health probes, authorize, and execute.
The gateway API is called by agents through an SDK. Runtime routes require the four X-AgentShield-* signature headers; a human Authorization header is refused. Base URL in local development: http://127.0.0.1:8081.
Signing is required
curl examples show the shape of each request. Runtime requests must be signed over the exact body bytes, so produce them with the Python or TypeScript SDK, or an implementation of the signing input.
Health
/health/liveProcess liveness
authorization is ok when the route is wired and not_configured when database settings are absent.
Responses
200HealthLiveProcess is running
curl -X GET "http://127.0.0.1:8081/health/live"Examples are generated from the schema. Values are placeholders.
/health/readyReadiness
Returns 200 when PostgreSQL and Redis answer, otherwise 503.
Responses
200HealthReadyDependencies answered
503HealthReadyNot ready to authorize tool calls
curl -X GET "http://127.0.0.1:8081/health/ready"Examples are generated from the schema. Values are placeholders.
Authorize
Authenticates the agent, applies budgets, evaluates policy, and records exactly one decision. allow does not execute anything. A deny is returned with HTTP 403 and the recorded decision as the body.
Execute
Runs an allowed decision, or an approved require_approval decision, through its registered adapter at most once.
/api/v1/runtime/executeExecute a previously allowed tool call
Replays the idempotency key and the prior decision. A deny stays a deny. require_approval runs only when the body carries the id of an approved, unexpired approval for that decision. Consumption is single-use. The approver cannot be the agent. sample.echo is always registered and has no external side effect. http.request is registered when GATEWAY_TOOLS_CONFIG enables it. Any other tool or operation returns 501 and does not trip the circuit. An adapter that uses arguments requires the same arguments that were authorized. Their canonical hash must equal the decision's, or the call is 409 and nothing runs. The execution is claimed before the adapter runs, so it runs at most once. A failed or interrupted execution is 409 on retry. The default deadline is two seconds. An adapter may set its own. Five adapter failures open the tool circuit, and an open circuit returns 503 without calling the adapter. A completed execution returns the stored, redacted result.
Parameters
X-AgentShield-Agent-Idheader · string (uuid)requiredX-AgentShield-Timestampheader · stringrequiredUnix seconds. Skew limit is 60 seconds.
X-AgentShield-Nonceheader · stringrequiredpattern
^[A-Za-z0-9_-]{16,128}$X-AgentShield-Signatureheader · stringrequiredUnpadded base64url Ed25519 signature.
Request body · required
decision_idstring (uuid)requiredidempotency_keystringrequiredmin length 16 · max length 200
approval_idstring (uuid)argumentsobjectThe arguments sent to authorize. Required by adapters that use arguments, such as http.request. Omitted means the empty object.
Responses
200ExecuteResponseAdapter result
400ErrorBodyThe adapter rejected the call before running it
409ErrorBodyThe decision is not an unconsumed allow, the arguments do not match the decision, or a previous attempt failed or was interrupted
501ErrorBodyNo adapter is registered for the tool
503ErrorBodyThe tool circuit is open. The adapter is not called.
curl -X POST "http://127.0.0.1:8081/api/v1/runtime/execute" \
-H "X-AgentShield-Agent-Id: $AGENT_ID" \
-H "X-AgentShield-Timestamp: $TIMESTAMP" \
-H "X-AgentShield-Nonce: $NONCE" \
-H "X-AgentShield-Signature: $SIGNATURE" \
-H "Content-Type: application/json" \
--data-binary @body.jsonExamples are generated from the schema. Values are placeholders. Signed requests must be produced by an SDK or an implementation of the signing input; curl alone cannot sign.
Related
Was this page helpful?
API Reference
The AgentShield HTTP APIs. Two services, two authentication schemes, one error envelope. Rendered from the OpenAPI contracts in the repository.
Control Plane API
Complete reference for the AgentShield control plane. Sessions, members, agents, policies, approvals, audit, alerts, evidence, metrics, and chaos.