Cooperative enforcement
Public Python SDK guards first-party tool, MCP, and LangChain paths in-process.
AI Security Engineering
Identity, independently enforced authorization, MCP tool protection, audit evidence, and observability for AI-agent execution.
Public SDK enforcement is cooperative and in-process. The separately maintained gateway demonstrates an independent authorization point for protected MCP tools when deployment topology prevents direct bypass.
Public Python SDK guards first-party tool, MCP, and LangChain paths in-process.
Separately maintained gateway verifies signed identity before protected MCP execution.
Authorization decisions and execution results correlate by request_id.
Traces, metrics, logs, and audit evidence distinguish ALLOW from DENY.
System Architecture
AgentTrust uses two complementary layers: the public SDK provides developer-facing, cooperative in-process controls, while the gateway provides an independently enforced authorization point before protected MCP execution.
SDK-level cooperative controls are complemented by an independently enforced gateway that reaches protected MCP tools only after authorization.
Independent enforcement assumes deployment topology prevents untrusted agents from directly bypassing the gateway and reaching protected upstreams.
Tool Execution Flow
A protected request is authenticated, resolved against trusted tool configuration, and exact-scope authorized before MCP execution. DENY terminates before the protected tool is invoked.
ALLOW / DENY Security Proof
The flagship demo grants deploy-agent service.status and logs.read. service_status is allowed and reaches MCP once; restart_service requires service.restart and is denied before MCP invocation.
Identity
Granted scopes: service.status, logs.read
ALLOW
requires service.status -> MCP invocation count = 1
DENY
requires service.restart -> not_executed -> MCP invocation count = 0
ALLOW
required_scope=service.status; deploy-agent has service.status.
Demo evidence: MCP invocation count = 1.
DENY
required_scope=service.restart; deploy-agent has service.status and logs.read.
Demo evidence: result_status=not_executed and MCP invocation count = 0.
Key Capabilities
A practical security layer for agent tools: cooperative SDK enforcement, independent gateway authorization, audit evidence, and observability.
Engineering Trade-Offs
Short trade-offs that keep the security claims precise and the implementation inspectable.
Authentication And Authorization
The gateway verifies short-lived Ed25519 JWT run identity using public verification material only. Trusted claims include issuer, agent ID, audience, run ID, scopes, issued-at time, expiration, and token ID.
MCP Integration
Narrow MCP 2026-07-28 stateless HTTP tools/call adapter; no discovery or generalized MCP proxying.
MCP and LangChain wrappers keep cooperative framework integration on the same authorization path.
Gateway config chooses MCP destination, tool name, required scope, timeout, and trusted headers.
Verified Behavior
The primary evidence scenario proves the gateway blocks an authenticated but unauthorized restart_service request before MCP execution while allowing service_status for the same deploy-agent identity.
Gateway demo evidence
deploy-agent is granted service.status and logs.read. service_status requires service.status and executes; restart_service requires service.restart and is denied before MCP.
Agent: deploy-agent
Scopes: service.status, logs.read
ALLOW service_status required_scope=service.status HTTP_STATUS=200
MCP counters: service_status=1
DENY restart_service required_scope=service.restart HTTP_STATUS=403 ACCESS_DENIED
Audit: decision=deny reason=scope_not_granted result_status=not_executed
MCP counters: restart_service=0An authenticated identity without service.restart cannot reach the protected restart_service MCP tool through the gateway.
This does not claim an absolute boundary if the protected MCP server is independently reachable.
Automated test evidence
Tests cover missing/invalid tokens, issuer/audience/expiry validation, exact-scope authorization, unknown tools, audit-failure behavior, and no upstream execution on deny.
go test ./...
go test -race ./...
DENY restart_service -> upstream invocation count zeroCovered invalid credential and missing-scope cases fail closed before protected tool execution.
This does not claim production key rotation, token revocation, or enterprise IAM.
Operational evidence
Audit lifecycle records distinguish authorization decisions from execution outcomes, while traces and metrics expose ALLOW, DENY, timeout, error, and not-executed paths.
authorization_decision decision=allow reason=scope_granted
execution_result result_status=ok reason=execution_ok
authorization_decision decision=deny reason=scope_not_granted result_status=not_executed
DENY trace: authorization span present, no MCP execution span
DENY metrics: authorization deny incremented, no MCP request incrementOperators can correlate request_id and trace_id across logs, traces, metrics, and audit evidence without counting lifecycle events as two tool calls.
Local JSONL audit is not immutable, tamper-evident, centralized, or SIEM-integrated.
Scope And Limitations
AgentTrust is useful as a least-privilege and audit initiative across SDK and gateway layers. Strong gateway enforcement still depends on topology preventing direct upstream bypass.
Explore The Project