Skip to main content

AgentMetrics observability integration for AutoGen agents

Project description

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

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

agentmetrics_autogen-0.2.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

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

agentmetrics_autogen-0.2.0-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file agentmetrics_autogen-0.2.0.tar.gz.

File metadata

  • Download URL: agentmetrics_autogen-0.2.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for agentmetrics_autogen-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d7b22919e21c528f8f2c64e8604f9039a80df213aadffdd025ebed5c16011643
MD5 a895f6cf09bcfecb6ecf2420c0445887
BLAKE2b-256 77a716ab0390c65174138ec73135ed08dcacbb18d6458e0ce758309ee75f6b15

See more details on using hashes here.

File details

Details for the file agentmetrics_autogen-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agentmetrics_autogen-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 34b96e816bc82b212126a6ba22de912c09b0b4c0140759cb85143a673072b57a
MD5 28160308b37121c93b22df7a1d5b6087
BLAKE2b-256 45461a6217726596247cdefd71ee4a749795e93f38a62655cc197abaff64ee58

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