Skip to main content

The operational database for AI agents

Project description

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

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

agentdb_sdk-0.1.0.tar.gz (7.9 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.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentdb_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 22c16c6eadf40e3f1eaf41c52b7ab826c66f2faf1d8ea5117ac7cd439d2261dd
MD5 201a8e7e3ef9dc8fddc6d0fd8f50a495
BLAKE2b-256 a3788d0d3ff0f00f8d5d1dd810f684747f0e15ff80255f9272f4f0e26f1cc1f6

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for agentdb_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6ec03eda0c52225590c3cdebc474163f6c9a1e768320cc51cb54ef0631c2f440
MD5 3638af4f4eaa148d3475d2d336d019ed
BLAKE2b-256 edf8368a483870b41c161135814b534a3dae30d76f917ae9cc7540483e5d4ea1

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