INTEGRATE / REFERENCE

Choose an interface.

Use HTTP across languages, the CLI from scripts, the TypeScript SDK in Node.js, or the engine in Rust.

AuthZEN HTTP

POST /access/v1/evaluation accepts the following starter-schema request. Context includes args and session; required arguments vary by action.

Single evaluation request
{
  "subject": {
    "type": "Agent",
    "id": "research"
  },
  "action": {
    "type": "Action",
    "id": "ToolCall::repo_read"
  },
  "resource": {
    "type": "Repository",
    "id": "demo"
  },
  "context": {
    "args": {
      "repo": "demo"
    },
    "session": {
      "mfa": true
    }
  }
}
Successful allow response
{"decision": true}

The response contains a boolean decision and optional reason/context. Proceed only on a successful response with decision exactly true. A false decision is a normal authorization result. Authentication errors, malformed responses, timeouts, and HTTP failures must stop the tool.

Batch evaluation

POST /access/v1/evaluations accepts an evaluations array, capped at 100. Optional evaluation_semantics supports execute_all, deny_on_first_deny, and permit_on_first_permit. Each nested evaluation may include its own entities array; entity sets are evaluated independently and malformed entities fail the batch. The response contains an evaluations array; early-exit modes can return fewer results than requests.

Integration examples

authorize.ts
import { Client, Principal, Action } from "agentguard";

const guard = new Client({ store: ".agentguard" });
guard.check(
  Principal.agent("research"),
  Action.tool("repo_read"),
  { entity_type: "Repository", uid: "demo", attrs: { org: "example" } },
  { args: { repo: "demo" }, session: { mfa: true } },
);
// Permission granted. Your application may now run the tool.
// On denial, check() throws AuthorizationDenied.

Node.js SDK. Spawns the installed CLI synchronously. Call your tool only after check() returns.

TypeScript SDK behavior

Build with pnpm install and pnpm --filter agentguard build at the repository root. The package exports Client, Principal, Action, AuthorizationDenied, StepUpRequired, and CLIUnavailable. It wraps a local Node.js CLI process; it is not a browser SDK or remote HTTP client.

Existing synchronous methods remain available for scripts but block the Node.js event loop. In web servers and other concurrent Node.js applications, use Client.authorizeAsync / Client.checkAsync for authorization, Client.logTailAsync for audit reads, and Client.delegateAsync for delegation. Async CLI operations default to a 30-second timeout, allow at most 8 concurrent children per Client, and cap combined output at 8 MiB. Configure these limits with ClientOptions.timeoutMs and ClientOptions.maxConcurrentCliProcesses.

Client.check and Client.checkAsync throw on deny. authorize and authorizeAsync return a Decision unless check is requested. For a step-up denial, onStepUp: "return" returns the decision; the default raises StepUpRequired. The current core/server path does not emit step-up decisions. BearerToken is passed as AGENTGUARD_BEARER; the local CLI does not validate or forward it to a remote PDP. No SDK option currently produces DPoP proofs.

gRPC

Enable the loopback listener with --grpc-listen 127.0.0.1:9443. The repository-defined service is agentguard.v1.AccessEvaluation/Evaluation. It mirrors the HTTP single evaluation with context_json and entities_json strings. Use the checked-in protobuf to generate clients. The listener is plaintext and does not constitute a standardized AuthZEN gRPC protocol.

CLI commands

agentguard initCreate a schema and broad development starter policies.
agentguard validate / schemaValidate policies or inspect the schema.
agentguard authorize / simEvaluate a CLI request; sim uses the authorization path and writes audit by default.
agentguard delegate / verifyMint and verify delegation tokens; these do not enforce scopes on a tool.
agentguard log tail / log dumpRead decision records.
agentguard audit verify / exportVerify chained records or export JSONL, CEF, LEEF, ECS.
agentguard audit sar / erase / rotateSubject lookup, pseudonymization, and file rotation. Erasure changes records and invalidates the original chain.
agentguard genGenerate a policy through a configured LLM provider and validate it. Review output before installing.
agentguard doctorCheck the local store and audit setup.

Global flags: --store, --audit, --output, --secret-file. Use each command’s --help for arguments. The server is agentguard-server, not agentguard serve. Policy diff/version/blast-radius APIs live in the Rust library, not an agentguard policy command.

Framework compatibility

The Strands directory is a supported repository example using HTTP and a guard/intervention hook. The Rust example mounts build_router. Other frameworks can implement the same tool-boundary contract. There are no official LangChain, MCP, or Kubernetes adapters in these examples.

Source references: TypeScript API, CLI parser, HTTP request and response types.