Bench — the home for your AI agents. One line of code → live dashboard, public profile, README badge.
Project description
bench-observe
Python SDK for Bench — observability for AI agents. Zero dependencies.
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.
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
bench_observe-0.1.1.tar.gz
(4.1 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bench_observe-0.1.1.tar.gz.
File metadata
- Download URL: bench_observe-0.1.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
33ef455f11c75120c6f7c254650412c6c8c99723e3085cfb7ad6958408debbc3
|
|
| MD5 |
dbd195faa697f9d280bbb25baf7bf32d
|
|
| BLAKE2b-256 |
a1e7118199e80ac123306ed5d7a5aadba1592e801c56bebeb740552b6a12a7ce
|
File details
Details for the file bench_observe-0.1.1-py3-none-any.whl.
File metadata
- Download URL: bench_observe-0.1.1-py3-none-any.whl
- Upload date:
- Size: 4.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0473856e274979cb6f8ed9f1b6bc93225ce678f62021ac5c502e22eba2f97cc3
|
|
| MD5 |
90ff499ba3ea51f5f1c37661b50235b2
|
|
| BLAKE2b-256 |
10d0753f7c3a33f7a744e83df51a46901bc3e797232df54803809c634094e0e1
|