Forensic recorder for agentic software
AgentRail
The flight recorder for AI agents. Trace decisions, tool calls, evidence, and spend before an agent becomes impossible to explain.

How evidence moves
AgentRail keeps cost and action proof out of the SDK hot path, then rebuilds the run for investigation.
Instrument
Add the TypeScript SDK around a trace and let spans inherit actor context unless a tool overrides it.
Accept
The ingestion endpoint returns 202 only after a fast enqueue, while worker jobs handle durable processing.
Price
Workers compute cost_usd from the shared catalog. Unknown model pricing stays null and explicit.
Investigate
The dashboard reconstructs Trace Rail, Action Ledger, and payload evidence through backend routes.
Built for AWS-native deployment
The local M1 stack maps directly to AWS services without changing AgentRail's core contract.
- Ingest
- API Gateway and Lambda accept spans with HMAC API keys.
- Buffer
- SQS keeps ingestion fast while workers process traces.
- Store
- RDS/PostgreSQL stores metadata and S3 stores redacted evidence.
- Observe
- CloudWatch tracks queue health, worker failures, and latency.
- Extend
- Amazon Bedrock cost and audit integrations fit the same model catalog path.
Planned AWS path: API Gateway, Lambda, SQS, RDS/PostgreSQL, S3, CloudWatch, and Amazon Bedrock cost metadata.
Published on npm
Install AgentRail with npm
Copy the scoped package names from here. AgentRail is published on npm under @agentrail-sdk; the unscoped agentrail package is not this project.
- Available today
- SDK, Context CLI, MCP reader
- Published packages
- @agentrail-sdk/contracts@0.1.1, @agentrail-sdk/db@0.1.0, @agentrail-sdk/sdk@0.1.0, @agentrail-sdk/context@0.1.1, @agentrail-sdk/cli@0.1.1, @agentrail-sdk/mcp@0.1.2
- SDK path
- npm install @agentrail-sdk/sdk for TypeScript AI applications
- Context CLI
- npm install -D @agentrail-sdk/cli for local Context Packs
- MCP path
- npx -y @agentrail-sdk/mcp for read-only trace inspection
- MCP Context profile
- npx -y @agentrail-sdk/mcp --profile context for local Context Relay tools
Current boundary: SDK recording, local Context CLI packs, and read-only MCP forensic inspection. MCP Context profile 0.1.2 is published on npm for MCP-capable local agent clients.
Live npm commands
Use these exact package namesnpm install @agentrail-sdk/sdkAdd AgentRail tracing to a TypeScript AI application.
npm install -D @agentrail-sdk/cliInstall the local Context Relay command in a project.
npx -y @agentrail-sdk/cli context --root . --task "Audit this change" --token-budget 4000 --jsonFetch a bounded local context pack before an AI coding run.
npx -y @agentrail-sdk/mcpOpen read-only trace lookup from Codex-style tools.
npx -y @agentrail-sdk/mcp --profile contextExpose Context Relay tools to MCP-capable local agents.
import { AgentRail, BufferedDelivery, HttpSpanTransport } from "@agentrail-sdk/sdk";
const delivery = new BufferedDelivery({
transport: new HttpSpanTransport({
endpoint: "http://localhost:3001/v1/spans",
apiKey: process.env.AGENTRAIL_API_KEY!,
}),
});
const rail = new AgentRail({
actor: { agentId: "research-agent", onBehalfOf: "user_42" },
sink: delivery,
});
await rail.trace({ name: "research.answer" }, async (trace) => {
await trace.span(
{
kind: "llm",
name: "draft",
model: "test.known",
inputTokens: 1_000,
outputTokens: 500,
},
async () => undefined,
);
await trace.action({ name: "filesystem.read" }, async () => undefined);
});
await rail.shutdown({ timeoutMs: 5_000 });Founding tester program
AgentRail needs three developer teams to test real agent workflows: one SDK integration, one local dashboard review, and one MCP reader workflow.
- AI agent application developer
- internal automation team
- open-source maintainer using Codex or Claude-style tools
Open-source first, self-hosted by default
Run AgentRail locally, inspect recorded agent behavior, and keep sensitive evidence under your control.