Skip to content

ojackson08/agentledger

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AgentLedger

License: MIT AWS Security Maintained by Merkaba AI Risk

Serverless metering and audit layer for AI agents — track token usage, cost, and activity per agent in real time.


Overview

AgentLedger is a serverless API that intercepts agent activity logs and token usage metrics, calculating exact USD costs based on model pricing (e.g., Claude 3 Opus vs Haiku). It stores an immutable ledger of all agent actions in DynamoDB and publishes custom metrics to CloudWatch.

For security and compliance, AgentLedger serves as the definitive audit trail of "who did what, when, and how much it cost" across a multi-agent swarm.


Architecture

AI Agent (Completes task)
    │
    ▼
POST /ledger (AgentID, TaskID, Tokens)
    │
    ▼
API Gateway → Lambda (Cost Calculator)
    │
    ├── Write immutable record → DynamoDB
    │
    └── Publish metrics → CloudWatch (Cost per Agent)

Security Properties

Property Implementation
Immutability DynamoDB records are append-only; agents cannot delete their history
Authentication API Gateway secured via IAM or API Keys
Encryption DynamoDB tables encrypted at rest (KMS)
Cost Anomaly Detection CloudWatch alarms trigger if an agent exceeds expected spend

Case Study / Usage Notes

Deployment at Merkaba AI Risk Management:

AgentLedger is used to monitor the cost and activity of our internal Red Team agents. During an automated jailbreak campaign, AgentLedger detected an anomalous spike in token usage from the redteam-runner agent. CloudWatch triggered an alert, and the security team identified that the agent had entered an infinite loop due to a poorly formatted prompt injection target. The agent was paused, saving an estimated $400 in unnecessary token spend over the weekend.


Integration with Merkaba Security Stack


License

MIT License — see LICENSE for details.


Contact

Merkaba AI Risk Management security@merkabacreatives.org https://merkabacreatives.org/ai-risk

About

Serverless metering layer that tracks token usage and cost per AI agent in real time. API Gateway → Lambda → DynamoDB + CloudWatch. Know exactly which agent is spending what — at any scale.

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors