Skip to main content

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 with api_url, api_key, optional flush_interval and batch_size
  • start_session(config) -- Create a new session (returns AALSession)
  • session(session_id, agent_id) -- Get a handle to an existing session
  • get_events(params) -- Query events with optional filters
  • get_session(session_id) -- Get session details
  • shutdown() -- 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 blocks
  • wrap_mcp_server(server, session) -- Auto-log MCP tool calls

Documentation

Full documentation at agentink.dev/docs.

License

MIT

Project details


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)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

aal_sdk-0.1.0-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

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

Hashes for aal_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 577dd1c413f4e0d3131499a3a7efb85742c1776d72c537407a093443148e1f7f
MD5 7282fd6ea89e463477d144db32f803d1
BLAKE2b-256 c3856b4fea83fc0cf45a56a24e8334aa49ff42928b9437dbf8c3ce508c628ff1

See more details on using hashes here.

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

Hashes for aal_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4334095f5dfd59fb0ce524814e12423d9e12ba7b559ef1e9550329324d3121d4
MD5 6e3a7f9bd909b20becb2cc53ae88be93
BLAKE2b-256 ba156312c6375b3335b3df01398be95ad37e737e67bd0836ee107e670d8cab2d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page