Skip to Content
AgentShield
API Reference

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

GET/health/live

Process liveness

No authenticationoperationId: getGatewayLive

authorization is ok when the route is wired and not_configured when database settings are absent.

Responses

  • 200HealthLive

    Process is running

curl -X GET "http://127.0.0.1:8081/health/live"

Examples are generated from the schema. Values are placeholders.

GET/health/ready

Readiness

No authenticationoperationId: getGatewayReady

Returns 200 when PostgreSQL and Redis answer, otherwise 503.

Responses

  • 200HealthReady

    Dependencies answered

  • 503HealthReady

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

POST/api/v1/runtime/authorize

Authorize one tool call

Agent signatureoperationId: authorizeToolCall

Validates the signed body, authenticates the agent, loads policy, decides allow, deny, or require_approval, and persists the decision and audit link. Errors fail closed. allow does not execute the tool.

Parameters

  • X-AgentShield-Agent-Idheader · string (uuid)required
  • X-AgentShield-Timestampheader · stringrequired

    Unix seconds. Skew limit is 60 seconds.

  • X-AgentShield-Nonceheader · stringrequired

    pattern ^[A-Za-z0-9_-]{16,128}$

  • X-AgentShield-Signatureheader · stringrequired

    Unpadded base64url Ed25519 signature.

Request body · required

  • agent_idstring (uuid)required
  • organization_idstring (uuid)required

    Claim only. The gateway compares it with the authenticated agent record.

  • execution_idstring (uuid)required
  • tool_namestringrequired

    min length 1 · max length 128

  • operationstringrequired

    min length 1 · max length 128

  • resourcestringrequired

    min length 1 · max length 512

  • argumentsobjectrequired
  • requested_atstring (date-time)required
  • idempotency_keystringrequired

    min length 16 · max length 200

Responses

  • 200AuthorizeResponse

    Decision recorded. allow does not by itself execute the tool.

  • 400ErrorBody

    Error

  • 401ErrorBody

    Error

  • 403AuthorizeResponse

    Denied. The recorded decision is the body.

  • 429ErrorBody

    The authenticated agent exceeded a request, tool-call, or token budget. No decision is recorded.

curl -X POST "http://127.0.0.1:8081/api/v1/runtime/authorize" \
  -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.json

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

Execute

Runs an allowed decision, or an approved require_approval decision, through its registered adapter at most once.

POST/api/v1/runtime/execute

Execute a previously allowed tool call

Agent signatureoperationId: executeToolCall

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)required
  • X-AgentShield-Timestampheader · stringrequired

    Unix seconds. Skew limit is 60 seconds.

  • X-AgentShield-Nonceheader · stringrequired

    pattern ^[A-Za-z0-9_-]{16,128}$

  • X-AgentShield-Signatureheader · stringrequired

    Unpadded base64url Ed25519 signature.

Request body · required

  • decision_idstring (uuid)required
  • idempotency_keystringrequired

    min length 16 · max length 200

  • approval_idstring (uuid)
  • argumentsobject

    The arguments sent to authorize. Required by adapters that use arguments, such as http.request. Omitted means the empty object.

Responses

  • 200ExecuteResponse

    Adapter result

  • 400ErrorBody

    The adapter rejected the call before running it

  • 409ErrorBody

    The decision is not an unconsumed allow, the arguments do not match the decision, or a previous attempt failed or was interrupted

  • 501ErrorBody

    No adapter is registered for the tool

  • 503ErrorBody

    The 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.json

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

Was this page helpful?

On this page