{
  "markdown": "# AgentLedger — Per-Agent Spend Management\n\n> Track AI agent spend across x402/MPP/API-key rails, set budget caps, catch\n> spending anomalies, keep audit trails. The \"Datadog for agent spending\" —\n> the #1 verified community ask from agent builders.\n\n[![Live API](https://img.shields.io/badge/API-live-success)](https://agent-ledger-production-0ff8.up.railway.app/health)\n[![Landing](https://img.shields.io/badge/status-page-blue)](https://agent-ledger-production-0ff8.up.railway.app/status)\n[![MCP Registry](https://img.shields.io/badge/MCP-io.github.entradox%2Fagent--ledger-purple)](https://registry.modelcontextprotocol.io)\n\n## Try it in 30 seconds — no signup\n\n```bash\n# Track a spend — the FIRST call for a new agent_id returns an agent_secret.\n# Save it: every later write (track/budget) to this agent_id must include it.\ncurl -X POST https://agent-ledger-production-0ff8.up.railway.app/v1/track \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"agent_id\":\"my-agent\",\"rail\":\"x402\",\"amount_cents\":100,\"service\":\"search_query\"}'\n\n# Set a monthly budget cap — pass the agent_secret from above\ncurl -X POST https://agent-ledger-production-0ff8.up.railway.app/v1/budget \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\"agent_id\":\"my-agent\",\"monthly_cents\":5000,\"agent_secret\":\"YOUR_SAVED_SECRET\"}'\n\n# Spend report + anomalies — open read, no secret needed\ncurl https://agent-ledger-production-0ff8.up.railway.app/v1/report/my-agent\n```\n\nReads (`/v1/report`, `/v1/tokens`, `/v1/alerts`) never require a secret — only\nwrites to an `agent_id` do, and only after that `agent_id` has been claimed by\na first write. This is what stops a stranger from overwriting or corrupting\nsomeone else's `agent_id`.\n\n## Install (MCP clients)\n\n```json\n{\n  \"mcpServers\": {\n    \"agent-ledger\": {\n      \"url\": \"https://agent-ledger-production-0ff8.up.railway.app/mcp/\"\n    }\n  }\n}\n```\n\nTools: `ledger_track`, `ledger_set_budget`, `ledger_report`, `ledger_alerts`,\n`ledger_list_agents`.\n\nAgent-facing API reference: [`llms.txt`](https://agent-ledger-production-0ff8.up.railway.app/llms.txt)\n\n## Features\n\n- **Multi-rail neutral** — x402, MPP, API keys, manual entries; not locked to one payment rail\n- **Budget enforcement** — warns at 80% of cap, blocks spend when exceeded\n- **Anomaly detection** — spending-spike alerts per agent\n- **Audit trails** — every entry persisted with rail, service, and timestamp\n- **Free during beta**\n\n## Architecture\n\n- Core engine (`ledger_engine.py`): per-agent JSONL ledgers, budget state, alert log,\n  per-agent secret (`ensure_agent_secret` — claim-on-first-write, no signup)\n- REST API (`api_server.py`, FastAPI): `/health`, `/v1/track`, `/v1/budget`,\n  `/v1/report/{agent_id}`, `/v1/alerts/{agent_id}`, `/stats`,\n  hosted streamable-http MCP at `/mcp/`\n  - `/v1/agents` (full cross-tenant listing) is owner-only, requires `X-Al-Admin` header\n- Input validation: agent_id restricted to `[A-Za-z0-9._-]{1,64}` (path-traversal safe),\n  rail whitelisted to mpp/x402/api_key/manual, amount + budget caps bounded [0, $100k]\n- Stripe webhook is fail-closed: events are rejected unless the HMAC signature\n  verifies against `STRIPE_WEBHOOK_SECRET_AL`; a verified `pro` checkout sets\n  `pro.flag` on the data volume, which lifts the free-tier agent cap for that\n  instance (Pro $19/mo ⇒ unlimited agents).\n\n## Contact\n\nentradox@icloud.com",
  "bytes": 3349,
  "sha": "380e2cad98005ce6720d5d86d124c28dd1ce467b1a7f61aa8d09d3e8196220df",
  "repo_slug": "entradox/agent-ledger",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_entradox_agent_ledger_c5567e87/readme"
}