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.2.tar.gz (11.2 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.2-py3-none-any.whl (9.9 kB view details)

Uploaded Python 3

File details

Details for the file aal_sdk-0.1.2.tar.gz.

File metadata

  • Download URL: aal_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 11.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aal_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fe1b23d2e119994adc9fc4b855f529caf21222fa0c3bda329c72c893bb9d2422
MD5 911f1d96996e1fb16768fcb91887026e
BLAKE2b-256 a33bd9e34f3d8f05475fe846ca0d62f978f561adde20e7b0055cf70ea9d695d5

See more details on using hashes here.

Provenance

The following attestation bundles were made for aal_sdk-0.1.2.tar.gz:

Publisher: publish-python.yml on diegobkc/agent-action-ledger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file aal_sdk-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: aal_sdk-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 9.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for aal_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1ff41141b19279544590f40c371bac12718e0acc2fb43e1c0fd51a17584c7f8b
MD5 d9a58308d53bb96eeff258ede4e5b32b
BLAKE2b-256 19f406548121305138e7bbaf31f4b0827f84a2867f5efe5f05e04aee75b7f303

See more details on using hashes here.

Provenance

The following attestation bundles were made for aal_sdk-0.1.2-py3-none-any.whl:

Publisher: publish-python.yml on diegobkc/agent-action-ledger

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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