Guides
Runtime gateway
The authorization API, the SDK, decisions, idempotency and fail-closed behaviour.
Authorize a call
POST /v1/runtime/authorize with Authorization: Bearer tmag_….
| Field | Required | Notes |
|---|---|---|
tool, action | yes | registered tool and action |
params | no | validated against the tool's input schema |
call_id | yes | 8–80 chars, unique per call; repeating it returns the original decision (replayed: true) |
session_id | no | groups requests for sequence detection |
justification | no | shown to approvers |
tool_fingerprint | no | 64-hex fingerprint of the tool surface the agent sees |
input_provenance | no | e.g. ["external"] when triggered by untrusted content |
The response always has HTTP 200 when a decision was made: decision is allow, deny, require_approval or quarantine, with reason_codes, explanation, risk_score and, for approvals, approval. Treat any non-200 or timeout as deny.
Reason codes
POLICY_ALLOW, POLICY_DENY, POLICY_REQUIRE_APPROVAL, POLICY_QUARANTINE, DEFAULT_DENY, RISK_ESCALATION, AGENT_UNKNOWN, AGENT_UNVERIFIED, AGENT_DISABLED, AGENT_QUARANTINED, TOOL_UNKNOWN, ACTION_UNKNOWN, TOOL_DISABLED, TOOL_QUARANTINED, TOOL_SCHEMA_CHANGED, TOOL_NOT_PERMITTED, ACTION_NOT_PERMITTED, INPUT_SCHEMA_INVALID, RATE_LIMITED, POLICY_UNAVAILABLE; after approval: APPROVED, APPROVAL_REJECTED, APPROVAL_SUPERSEDED_BY_POLICY.
Waiting for approval
GET /v1/runtime/requests/{request_id} returns status and may_execute. Execute exactly once when may_execute is true. Report the outcome with POST /v1/runtime/requests/{id}/result (succeeded/failed, duration_ms).
Python SDK
from trustmesh_sdk import TrustMesh, ApprovalRequired, Denied
tm = TrustMesh(base_url="http://localhost:8800/api", agent_credential=CRED)
@tm.protected(tool="refunds", action="process")
def refund(order_id: str, amount_usd: float, reason: str = ""):
...
try:
refund("ORD-48213", 1850)
except ApprovalRequired as e:
tm.wait_for_approval(e.request_id) # then call the underlying API onceThe SDK lives in sdk/python/trustmesh_sdk.py (beta, not published). It raises Unavailable and never runs the function if TrustMesh cannot be reached.
Simulation
Signed-in users with runtime:simulate can run the same pipeline from Runtime Security → Simulate request (POST /v1/gateway/simulate). Simulations are recorded and audited; nothing is executed.