Metadata-Version: 2.4
Name: bench-observe
Version: 0.1.3
Summary: Bench — the home for your AI agents. One line of code → live dashboard, public profile, README badge.
Project-URL: Homepage, https://bench.virajmishratakehome.workers.dev
Project-URL: Repository, https://github.com/VirajMishra1/bench
Project-URL: Documentation, https://github.com/VirajMishra1/bench#readme
Author-email: Viraj Mishra <viraj.mishra.81@gmail.com>
License: MIT
Keywords: agents,ai,llm,observability,tracing
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.9
Provides-Extra: httpx
Requires-Dist: httpx>=0.24.0; extra == 'httpx'
Provides-Extra: langchain
Requires-Dist: langchain-core>=0.2.0; extra == 'langchain'
Description-Content-Type: text/markdown

# bench-observe

Python SDK for [Bench](https://bench.virajmishratakehome.workers.dev) — observability for AI agents. Zero dependencies.

```bash
pip install bench-observe
```

## Usage

```python
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

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

### Subtasks

```python
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

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

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