Skip to main content

Python SDK for the Agent Action Ledger API

Project description

aal-sdk (Python)

Python SDK for Agent Ink — the audit trail and logging API for AI agents. Full parity with the TypeScript SDK.

Getting Started

  1. Sign up at agentink.dev (free during beta)
  2. Go to Dashboard > API Keys and create a new key
  3. Install the SDK and use your key in the examples below

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.3.tar.gz (12.3 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.3-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: aal_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 12.3 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.3.tar.gz
Algorithm Hash digest
SHA256 925dc27833573e9906e48efdc707ac91b123acbdf908516f230c29bfb18ed934
MD5 709937d1f3d47b4a6fc99a75d3ded355
BLAKE2b-256 7330466bd111d52fa984a21825c88fab8f08e6382382afe11e545b21825f2660

See more details on using hashes here.

Provenance

The following attestation bundles were made for aal_sdk-0.1.3.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.3-py3-none-any.whl.

File metadata

  • Download URL: aal_sdk-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 10.4 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 4e08eb6adf7196ac26eb0cdd4778fb2aabdff37905f7247d152b4a9e4d559a7a
MD5 616147c923ace30b0b788c5bad5fb444
BLAKE2b-256 b2b7774d4c0842919ecf5fa5a2c97707cc28d9e820194b3904eebb98eca7ee92

See more details on using hashes here.

Provenance

The following attestation bundles were made for aal_sdk-0.1.3-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