Skip to main content
The Activity Ledger provides a chronological, filterable view of every action taken by your agents across all runs. This is the compliance substrate, audit evidence, and organizational memory for Agent Sentinel.

Overview

Unlike the /runs endpoints which are hierarchical (Run → Actions), the ledger provides a flat, chronological stream of all actions with advanced filtering and search capabilities.

Key Use Cases

  1. Compliance Audits: “Show me all high-risk actions in Q4 2024”
  2. Debugging: “Find all failed database_query actions”
  3. Cost Analysis: “What are my most expensive actions?”
  4. Security: “Show all actions by prod-agent-3 that were blocked”
  5. Organizational Memory: “What did our agents do last week?”

Endpoints

GET /api/v1/ledger

Query the activity ledger with filtering, sorting, and pagination.

Query Parameters

Response

Example: Find Failed Actions

Example: Search Actions

Example: Date Range Query


GET /api/v1/ledger/stats

Get aggregate statistics for the activity ledger.

Query Parameters

Response

Example: Monthly Stats


GET /api/v1/ledger/export

Export ledger data for compliance audits and offline analysis.

Query Parameters

Response

File download in requested format.

Example: Export as JSONL

Example: Export Failed Actions as CSV


Response Schema

LedgerEntry

ComplianceMetadata (Enterprise Tier)


Common Patterns

1. Debugging Failed Actions

2. Cost Analysis by Agent

3. Compliance Audit Export

4. Real-Time Monitoring


Authentication

All ledger endpoints require authentication via:
  1. JWT Bearer Token
  2. API Key (recommended for programmatic access)
See Authentication for details.

Access Control

  • Users can only see actions from their own runs
  • Superusers can see all actions across all users
  • Organization admins can see actions from their organization’s runs

Rate Limits

  • Query Endpoints: 1000 requests/hour
  • Export Endpoint: 100 requests/hour
  • Stats Endpoint: 600 requests/hour
For higher limits, contact support at hello@agentsentinel.dev.

Differences from /runs Endpoints

When to use /runs:
  • Inspecting a specific run’s execution flow
  • Debugging a single agent workflow
  • Viewing run-level metadata
When to use /ledger:
  • Compliance audits across all activity
  • Finding patterns across multiple runs
  • Cost analysis by action type
  • Security monitoring

Best Practices

1. Use Pagination for Large Results

2. Use Search for Flexible Queries

3. Filter by Date Range for Performance

4. Use Stats Endpoint for Aggregates


Troubleshooting

Empty Results

Problem: Query returns 0 results Solutions:
  1. Check filters - they may be too restrictive
  2. Verify date range includes expected data
  3. Ensure authentication is correct (not seeing another user’s data)
  4. Check that agents have actually executed actions

Slow Queries

Problem: Queries take >5 seconds Solutions:
  1. Reduce page size (100 instead of 1000)
  2. Add date range filters to limit data scanned
  3. Avoid search queries on large datasets
  4. Use stats endpoint for aggregates instead of fetching all data

Export Limits

Problem: “Export limit exceeded” error Solutions:
  1. Reduce date range or add more filters
  2. Export in batches using pagination
  3. Contact support for bulk export access


Feedback

Have suggestions for the ledger API? Open an issue on the SDK repo or reach out to support.