Skip to main content

agentdb-sdk

Python SDK for AgentDB — the operational database for AI agents.

Install

pip install agentdb-sdk

Note: There is an unrelated package called agentdb on PyPI. Make sure to install agentdb-sdk (this package). The import is still from agentdb import AgentDB.

Quickstart

from agentdb import AgentDB

# Cloud (agentdb.zizka.ai)
db = AgentDB("agdb_live_xxxx")

# Self-hosted
db = AgentDB(host="http://localhost:8000")

Log an event

result = await db.log(
    agent="my-bot",
    event="tool_call",
    data={"tool": "search_web", "query": "competitor pricing"},
)
print(result.event_id)
# Log the user message
msg = await db.log(agent="my-bot", event="user_message",
                   data={"text": "why is my bill $200?"})

# Log the tool call that happened BECAUSE of the message
tool = await db.log(agent="my-bot", event="tool_call",
                    data={"tool": "get_billing"},
                    parent_id=msg.event_id)  # <-- causal link

# Log the response that happened BECAUSE of the tool call
await db.log(agent="my-bot", event="agent_response",
             data={"text": "I found an anomaly in your account"},
             parent_id=tool.event_id)

Why did something happen?

chain = await db.why(tool.event_id)
chain.print()
# user_message: {'text': 'why is my bill $200?'}  [14:32:01]
#     └── tool_call: {'tool': 'get_billing'}       [14:32:02]
#         └── agent_response: {'text': '...'}      [14:32:03]
results = await db.search("customer angry about billing")
for event in results:
    print(event.event, event.data)

Time travel

from datetime import datetime

state = await db.at("my-bot", datetime(2026, 5, 1, 15, 0))
print(state.state)

Query events

events = await db.query("my-bot", limit=100, event_type="tool_call")

Self-host

git clone https://github.com/Zizka-ai/agentdb
cd agentdb && cp .env.example .env
docker-compose -f infra/docker-compose.yml up

License

AGPL-3.0

Metadata

Release files for agentdb-sdk 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentdb-sdk 0.2.1
File Size Uploaded
agentdb_sdk-0.2.1.tar.gz 9.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentdb-sdk 0.2.1
File Interpreter ABI Platform
agentdb_sdk-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 19.2 kB

Release files / agentdb_sdk-0.2.1.tar.gz

Download URL agentdb_sdk-0.2.1.tar.gz
Size 9.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1bdbdab0808f1e23c40fff8b1eeacf3c10e798cf6cca3040d21d329f950809d9
BLAKE2b-256 checksum
How to use checksums
e6985730dbcc13df997a56626b5b62a328d8a120d224b62cb5b7863c618c40c2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release files / agentdb_sdk-0.2.1-py3-none-any.whl

Download URL agentdb_sdk-0.2.1-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
31eb638bef27164428954a46fb436d90e14cdbc780e190d213b595c5eb1241d0
BLAKE2b-256 checksum
How to use checksums
3c436b184fadc6726fe25c4d3b97f49a9ba5d6fdeb65667f85e1572273d79970
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.6

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page