zespan-autogen
Observability middleware for Microsoft AutoGen via Zespan.
Install
# For AutoGen v0.4 (autogen-agentchat)
pip install 'zespan-autogen[agentchat]'
# For AutoGen v0.2 (pyautogen / ag2)
pip install 'zespan-autogen[legacy]'
AutoGen v0.4 — run_with_tracing()
Replace await team.run(task=...) with await run_with_tracing(team, task, ...):
from zespan_autogen import run_with_tracing
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.conditions import MaxMessageTermination
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.agents import AssistantAgent
model = OpenAIChatCompletionClient(model="gpt-4o")
agent = AssistantAgent("assistant", model_client=model)
team = RoundRobinGroupChat([agent], termination_condition=MaxMessageTermination(5))
trace_id = await run_with_tracing(
team=team,
task="Analyze the sales data",
api_key="zsp_your_key",
project_id="your_project_id",
)
AutoGen v0.4 — ZespanModelClient (per-LLM-call tracing)
from zespan_autogen import ZespanModelClient
from autogen_ext.models.openai import OpenAIChatCompletionClient
base = OpenAIChatCompletionClient(model="gpt-4o")
model = ZespanModelClient(base, api_key="zsp_your_key", project_id="proj_id")
agent = AssistantAgent("assistant", model_client=model)
AutoGen v0.2 — register_hooks()
from autogen import AssistantAgent, UserProxyAgent
from zespan_autogen import register_hooks
assistant = AssistantAgent("assistant", llm_config={"config_list": [...]})
user = UserProxyAgent("user", human_input_mode="NEVER")
register_hooks(assistant, user, api_key="zsp_your_key", project_id="proj_id")
user.initiate_chat(assistant, message="Research quantum computing trends")
What's captured
- All agent messages (source, content, token counts)
- Tool call requests and execution results
- Agent handoffs and delegation
- Internal reasoning/thought events (thinking models)
- Memory query events
- Raw LLM request/response (via
ZespanModelClient)
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
zespan_autogen-1.2.1.tar.gz
(5.8 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 zespan_autogen-1.2.1.tar.gz.
File metadata
- Download URL: zespan_autogen-1.2.1.tar.gz
- Upload date:
- Size: 5.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.2"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.18 30 Sep 2025","python":"3.14.2","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7492b8826d115eb12a31cf15280046447bf2728e41c44fc90f56b3c5893e375e
|
|
| MD5 |
dd2058a90bfffb51d67a842bb375e3ea
|
|
| BLAKE2b-256 |
d46a62b2352c593835ebb5babcafbf913d1db610971deec1883c0bf33a144ad7
|
File details
Details for the file zespan_autogen-1.2.1-py3-none-any.whl.
File metadata
- Download URL: zespan_autogen-1.2.1-py3-none-any.whl
- Upload date:
- Size: 6.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: Hatch/1.17.0 {"ci":null,"cpu":"AMD64","implementation":{"name":"CPython","version":"3.14.2"},"installer":{"name":"hatch","version":"1.17.0"},"openssl_version":"OpenSSL 3.0.18 30 Sep 2025","python":"3.14.2","system":{"name":"Windows","release":"11"}} HTTPX2/2.4.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
83f1fd99c18f11bdffa2b38dd6e1191974595283c407f54be782599fee637205
|
|
| MD5 |
552aeb5427ebdd21af7f0650866106e1
|
|
| BLAKE2b-256 |
a1bd08355160d83293431baf57c975ae37c8fe66355e1529b63243a3b7e88d67
|