Skip to main content

bench-sdk (Python)

Python SDK for Bench — the home for your AI agents.

pip install bench-observe

Usage

import asyncio
from bench import observe

agent = observe(api_key="bk_xxx", agent="my-agent")

async def search(t):
    result = await do_search()
    t.log("found", len(result))
    t.cost(0.004)
    return result

async def main():
    result = await agent.task("search", {"query": "python"}, search)

asyncio.run(main())

Context manager

async with agent.task_ctx("summarize", {"doc": url}) as t:
    summary = await llm.generate(prompt)
    t.log("tokens", 1200)
    t.cost(0.012)

Subtasks

async def pipeline(t):
    await t.subtask("fetch", {"url": url}, fetch_fn)
    await t.subtask("parse", {"html": html}, parse_fn)
    await t.subtask("embed", {"text": text}, embed_fn)

await agent.task("full-pipeline", input, pipeline)

Custom events

agent.event("tool.use", {"tool": "search", "query": q})

LangChain adapter

pip install bench-langchain
from bench import observe
from bench_langchain import BenchCallbackHandler

agent = observe(api_key="bk_xxx", agent="my-langchain-agent")
handler = BenchCallbackHandler(agent)

# Every chain/LLM/tool call is now a traced Bench task
chain.invoke({"input": "..."}, config={"callbacks": [handler]})

After one run you get a live dashboard, public profile, and README badge — no other setup.

Metadata

Release files for bench-observe 0.1.0

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

Source distribution (sdist)

Source distribution for bench-observe 0.1.0
File Size Uploaded Provenance Actions
bench_observe-0.1.0.tar.gz 4.1 kB Without provenance Details for bench_observe-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bench-observe 0.1.0
File Interpreter ABI Platform Actions
bench_observe-0.1.0-py3-none-any.whl Python 3 none any Details for bench_observe-0.1.0-py3-none-any.whl

Total release size: 8.8 kB

Release files / bench_observe-0.1.0.tar.gz

Download URL bench_observe-0.1.0.tar.gz
Size 4.1 kB
Tags Source
SHA-256 checksum
How to use checksums
6d62a74c5ddc15e655b019b5181e5716ec57243ac522da36f023fc8c3b97647e
BLAKE2b-256 checksum
How to use checksums
712545ac9edc8f328755d78a2e10cf1f168b0fcfb4236c8e9af871b8825687a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.1

Release files / bench_observe-0.1.0-py3-none-any.whl

Download URL bench_observe-0.1.0-py3-none-any.whl
Size 4.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6c4806077a5ab40b939899ae6f1e0ad57427ee4cbb625db3cb15dbdf71d4f242
BLAKE2b-256 checksum
How to use checksums
e466d66bcfa90f0ad48246a2653ca537344dd7fdfacb356d9d897fd5dc7cdfdb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.1

Security for bench-observe 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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