Skip to main content

ZappyBee Python SDK - Observability for AI agents

Project description

zappybee

ZappyBee observability SDK for AI agents (Python). Track traces, steps, token usage, and costs.

Install

pip install zappybee

Quick Start

import os
from zappybee import ZappyBee

ZappyBee.init(
    api_key=os.getenv("ZAPPYBEE_API_KEY", "tc_live_..."),
    # Optional. Defaults to http://localhost:3001
    base_url=os.getenv("ZAPPYBEE_BASE_URL"),
)

Manual Tracing

from zappybee import ZappyBee

trace = await ZappyBee.start_trace(
    "my-agent",
    user_id="user-123",
    session_id="session-abc",
    input={"prompt": "Hello"},
)

step = await trace.start_step(
    "LLM Call",
    "llm_call",
    model="gpt-4o",
    input={"messages": [{"role": "user", "content": "Hello!"}]},
)

# ... your LLM call here ...

await step.end(
    status="success",
    model="gpt-4o",
    output={"role": "assistant", "content": "Hello!"},
    prompt_tokens=10,
    completion_tokens=20,
)

await trace.end(status="success")

Auto-Instrumentation (OpenAI / Anthropic)

from zappybee import ZappyBee

client = ZappyBee.wrap(openai_client)      # wraps chat.completions.create()
client = ZappyBee.wrap(anthropic_client)   # wraps messages.create()

The wrapper supports both non-stream and stream calls (when the client exposes an async iterator).

Backwards Compatibility

If you previously used tokencat, it is still available:

from tokencat import TokenCat

TokenCat.init(api_key="tc_live_...")

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

zappybee-0.1.0.tar.gz (8.7 kB view details)

Uploaded Source

Built Distribution

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

zappybee-0.1.0-py3-none-any.whl (12.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for zappybee-0.1.0.tar.gz
Algorithm Hash digest
SHA256 d5d1483dbfe46c4f06fe24d1cbf48cdad820ab603e729da4aef5ab1b33bdf4a6
MD5 c323ba8e78457585749d05cc78574e2a
BLAKE2b-256 6020fa1a22453c1fa1c1f33a052ab6f9dfb1b51a54e175faeadd813293c86141

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for zappybee-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 db47b9eca20e4410f02db7237d62e3d01b29ca2be6833149a3971e105858674d
MD5 b81462cc9ef73b292ab09b4bc6a18570
BLAKE2b-256 0a6d07af7074256ff454cb415fcc3a9113ee6ed3d67993600935281520e8d68b

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