Dottle SDK — Instrument your AI agents in 3 lines of code. See every LLM call, tool, cost, and failure in real time.
Project description
Dottle SDK
Monitor your AI agents in minutes. See every LLM call, tool use, cost, latency, and failure — in real time.
dottle.dev · Dashboard · Docs
Install
pip install dottle-sdk
Quickstart
import dottle
# 1. Configure once at startup
dottle.configure(api_key="dtl_live_...")
# 2. Wrap your agent run in a session
with dottle.session("my-agent", user_id="user_123") as sid:
# 3. Track each LLM call as a span
with dottle.span("llm", "gpt-4o reply") as s:
response = openai_client.chat.completions.create(...)
s.record_tokens(
prompt_tokens=response.usage.prompt_tokens,
completion_tokens=response.usage.completion_tokens,
model="gpt-4o",
)
That's it. Open app.dottle.dev to see your agent's sessions, costs, and errors live.
Get your API key
- Sign up at app.dottle.dev
- Create an organization → create a project
- Copy the
dtl_live_...key from Project Settings
What gets tracked
| Signal | How |
|---|---|
| LLM calls | dottle.span("llm", ...) + s.record_tokens(...) |
| Tool calls | dottle.span("tool", ...) |
| Errors | s.record_error(exc) or automatic on exception |
| Cost | Calculated from token counts + model |
| Latency | Automatic (start/end of each span) |
| User | Pass user_id / user_email to dottle.session() |
Full example with Anthropic
import anthropic
import dottle
dottle.configure(api_key="dtl_live_...")
client = anthropic.Anthropic()
def run_agent(user_message: str, user_email: str):
with dottle.session("support-agent", user_email=user_email) as sid:
with dottle.span("llm", "claude-3-5-sonnet") as s:
response = client.messages.create(
model="claude-3-5-sonnet-20241022",
max_tokens=1024,
messages=[{"role": "user", "content": user_message}],
)
s.record_tokens(
prompt_tokens=response.usage.input_tokens,
completion_tokens=response.usage.output_tokens,
model="claude-3-5-sonnet-20241022",
)
return response.content[0].text
Zero performance impact
All calls are fire-and-forget (background thread). Your agent never waits for Dottle. If Dottle is unreachable, your agent keeps running — monitoring failures are silently swallowed.
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
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 dottle_sdk-0.1.2.tar.gz.
File metadata
- Download URL: dottle_sdk-0.1.2.tar.gz
- Upload date:
- Size: 13.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29761d32bde1686c313c7c688c45ddf3c4ca29b0325fba70d5b81a722b43511a
|
|
| MD5 |
fe9a4c447d8be7a354435e050827bfb9
|
|
| BLAKE2b-256 |
5850caf22061f826685420b02a05877b197dd38d18bda045d17dea85d2bd2489
|
File details
Details for the file dottle_sdk-0.1.2-py3-none-any.whl.
File metadata
- Download URL: dottle_sdk-0.1.2-py3-none-any.whl
- Upload date:
- Size: 17.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1c6f8bd15e9b7041c947a97a3c8a0e1bc868b7fa27d21f9d8ada1b8c0383b310
|
|
| MD5 |
f5c695fe5668b2c16eec9a6243b20a3b
|
|
| BLAKE2b-256 |
f6e1e0a7dc9bfc3e5ce91b30ff431484688889945ab5e60c1782292f7e77c5c9
|