Python SDK for the Agent Action Ledger API
Project description
aal-sdk (Python)
Python SDK for the Agent Action Ledger API. Full parity with the TypeScript SDK.
Installation
pip install aal-sdk
With optional integrations:
pip install aal-sdk[anthropic] # Anthropic client wrapper
pip install aal-sdk[mcp] # MCP server wrapper
Quick Start
import asyncio
from aal_sdk import AALClient
async def main():
client = AALClient({
"api_url": "https://api.agentink.dev",
"api_key": "your-api-key",
})
session = client.start_session({"agent_id": "my-agent"})
session.log_action({
"action_type": "TOOL_CALL",
"tool_name": "get_weather",
"parameters": {"city": "London"},
"response": {"temp": 15},
"status": "SUCCESS",
"latency_ms": 42,
})
await client.shutdown()
asyncio.run(main())
Auto-Instrumentation
Anthropic Client
from aal_sdk import AALClient
from aal_sdk.anthropic import wrap_anthropic_client
from anthropic import AsyncAnthropic
client = AALClient({"api_url": "...", "api_key": "..."})
session = client.start_session({"agent_id": "claude-agent"})
anthropic = wrap_anthropic_client(AsyncAnthropic(), session)
# All tool_use blocks are now automatically logged
MCP Server
from aal_sdk import AALClient
from aal_sdk.mcp import wrap_mcp_server
from mcp import Server
client = AALClient({"api_url": "...", "api_key": "..."})
session = client.start_session({"agent_id": "mcp-agent"})
server = Server("my-server")
wrap_mcp_server(server, session)
# All tool calls are now automatically logged
API Reference
AALClient
AALClient(config)-- Create a client withapi_url,api_key, optionalflush_intervalandbatch_sizestart_session(config)-- Create a new session (returnsAALSession)session(session_id, agent_id)-- Get a handle to an existing sessionget_events(params)-- Query events with optional filtersget_session(session_id)-- Get session detailsshutdown()-- Drain buffer and close connections
AALSession
log_action(input)-- Log an action event (buffered, auto-flushed)
Wrappers
wrap_anthropic_client(client, session)-- Auto-log Anthropic tool_use blockswrap_mcp_server(server, session)-- Auto-log MCP tool calls
Documentation
Full documentation at agentink.dev/docs.
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
aal_sdk-0.1.0.tar.gz
(11.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file aal_sdk-0.1.0.tar.gz.
File metadata
- Download URL: aal_sdk-0.1.0.tar.gz
- Upload date:
- Size: 11.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
577dd1c413f4e0d3131499a3a7efb85742c1776d72c537407a093443148e1f7f
|
|
| MD5 |
7282fd6ea89e463477d144db32f803d1
|
|
| BLAKE2b-256 |
c3856b4fea83fc0cf45a56a24e8334aa49ff42928b9437dbf8c3ce508c628ff1
|
File details
Details for the file aal_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: aal_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4334095f5dfd59fb0ce524814e12423d9e12ba7b559ef1e9550329324d3121d4
|
|
| MD5 |
6e3a7f9bd909b20becb2cc53ae88be93
|
|
| BLAKE2b-256 |
ba156312c6375b3335b3df01398be95ad37e737e67bd0836ee107e670d8cab2d
|