r3fresh ALM SDK
Agent Lifecycle Management SDK – A Python SDK for tracking AI agent execution with policy enforcement, event emission, and structured event data for downstream analytics.
Overview
The SDK provides automatic instrumentation for AI agents, capturing:
- Tool calls with policy enforcement (allow/deny) and latency tracking
- Run lifecycle (
run.start/run.end) with summary statistics - Tasks (
task.start/task.end) for logical units of work - Handoffs for agent-to-agent transitions
- Structured errors (type, message, source, retryable) in tool and run events
- Version tracking (schema, SDK, agent, policy) on every event
All events are emitted automatically. They can be sent to stdout (development) or an HTTP endpoint (production). The SDK does not perform analytics itself; it produces events for your backend or analytics pipeline.
Quick Start
pip install r3freshfrom r3fresh import ALM
# Initialize the SDK
alm = ALM(
agent_id="my-agent",
env="development",
mode="stdout", # or "http" with endpoint
agent_version="1.0.0",
)
# Define tools with automatic policy enforcement
@alm.tool("search_web")
def search_web(query: str) -> str:
"""Search the web for information."""
return f"Results for: {query}"
# Run your agent with automatic tracking
with alm.run(purpose="Process user query"):
result = search_web("Python SDK documentation")
print(result)
# All events are automatically captured and emittedWhat's Next
- Installation – Install via pip or from source
- Quick Start – Get your first agent running
- Agent Identity – Configure agent_id and versions
- Permissions & Security – Policy enforcement
- API Reference – Full ALM class documentation