Skip to main content

Zespan observability middleware for Microsoft AutoGen

Project description

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)

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

zespan_autogen-1.2.0.tar.gz (5.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zespan_autogen-1.2.0-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file zespan_autogen-1.2.0.tar.gz.

File metadata

  • Download URL: zespan_autogen-1.2.0.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

Hashes for zespan_autogen-1.2.0.tar.gz
Algorithm Hash digest
SHA256 9019923d1b8d9278422c7dfa71c3663e192be1f21c08d04bfd9e4f1d86e4ac65
MD5 e0f92d7ac794cd49c03933fa93dfc520
BLAKE2b-256 2bf649f93e5a5ffc6bb1412230a57be6dade42aa24deff22cdd2b38f8131e33f

See more details on using hashes here.

File details

Details for the file zespan_autogen-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: zespan_autogen-1.2.0-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

Hashes for zespan_autogen-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d8e62c89afa4d984a08faa3916ce91ae76a368450ff3a928605d623f7aa45612
MD5 53d65be299a20a1d857087cb9d757938
BLAKE2b-256 9c709b4ba69cfa91878f15e9a5fc21e5ced223168f78ae91e459768142b58310

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page