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)

Link events causally

# 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]

Semantic search

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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agentdb_sdk-0.2.1.tar.gz (9.5 kB view details)

Uploaded Source

Built Distribution

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

agentdb_sdk-0.2.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file agentdb_sdk-0.2.1.tar.gz.

File metadata

  • Download URL: agentdb_sdk-0.2.1.tar.gz
  • Upload date:
  • Size: 9.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentdb_sdk-0.2.1.tar.gz
Algorithm Hash digest
SHA256 1bdbdab0808f1e23c40fff8b1eeacf3c10e798cf6cca3040d21d329f950809d9
MD5 450672820f58334f4f9e66977352ae47
BLAKE2b-256 e6985730dbcc13df997a56626b5b62a328d8a120d224b62cb5b7863c618c40c2

See more details on using hashes here.

File details

Details for the file agentdb_sdk-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: agentdb_sdk-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for agentdb_sdk-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31eb638bef27164428954a46fb436d90e14cdbc780e190d213b595c5eb1241d0
MD5 7125f6b29d7191d17b8f8a879501f02a
BLAKE2b-256 3c436b184fadc6726fe25c4d3b97f49a9ba5d6fdeb65667f85e1572273d79970

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 files

0.1.0

2 files

Supported by

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