Skip to main content

agentmetrics-autogen

PyPI License: MIT

AgentMetrics integration for AutoGen. Wrap team.run_stream() with one async context manager and every run reports back to your dashboard showing latency, tool calls, and errors. Token counts are not available from AutoGen's streaming events and are not tracked.


Install

pip install agentmetrics-autogen

Quickstart

from agentmetrics_autogen import AgentMetricsRunStream

tracker = AgentMetricsRunStream(
    agent_id="my-autogen-team",
    base_url="http://localhost:8099",
)

async with tracker.run(team, task="Analyze this dataset") as stream:
    async for event in stream:
        pass  # handle events as normal

tracker.flush()

API

AgentMetricsRunStream(agent_id, base_url)

Parameter Default Description
agent_id "autogen-agent" Label shown in the dashboard
base_url "http://localhost:8099" AgentMetrics server address

.run(team, **kwargs)

Returns an async context manager. Calls team.run_stream(**kwargs) internally. Yields a tracking iterator that intercepts ToolCallRequestEvent, ToolCallExecutionEvent, and TaskResult events to collect run metrics.

Emits a run summary to /v1/events on context exit (success or exception).

.flush(timeout=10.0)

Blocks until all in-flight HTTP requests complete.


What gets tracked

Each .run() call emits one event to /v1/events on completion or exception:

Field Description
status success or failed
duration_ms Wall-clock run duration
tool_calls Number of ToolCallRequestEvent events
tool_errors Number of tool results with is_error=True
tool_names Set of tool names from request events
error Error message if TaskResult.stop_reason contains "error"

License

MIT

Metadata

Release files for agentmetrics-autogen 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for agentmetrics-autogen 0.2.0
File Size Uploaded
agentmetrics_autogen-0.2.0.tar.gz 4.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for agentmetrics-autogen 0.2.0
File Interpreter ABI Platform
agentmetrics_autogen-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 9.1 kB

Release files / agentmetrics_autogen-0.2.0.tar.gz

Download URL agentmetrics_autogen-0.2.0.tar.gz
Size 4.3 kB
Tags Source
SHA-256 checksum
How to use checksums
d7b22919e21c528f8f2c64e8604f9039a80df213aadffdd025ebed5c16011643
BLAKE2b-256 checksum
How to use checksums
77a716ab0390c65174138ec73135ed08dcacbb18d6458e0ce758309ee75f6b15
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / agentmetrics_autogen-0.2.0-py3-none-any.whl

Download URL agentmetrics_autogen-0.2.0-py3-none-any.whl
Size 4.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
34b96e816bc82b212126a6ba22de912c09b0b4c0140759cb85143a673072b57a
BLAKE2b-256 checksum
How to use checksums
45461a6217726596247cdefd71ee4a749795e93f38a62655cc197abaff64ee58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page