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.1.0.tar.gz (4.5 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.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: agentmetrics_autogen-0.1.0.tar.gz
  • Upload date:
  • Size: 4.5 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.1.0.tar.gz
Algorithm Hash digest
SHA256 7df7103040ab87732615bf2d728e3713652e99090414382f2b6b06d0be564531
MD5 4e86e9f0a6cdb378884d0cadc868fc77
BLAKE2b-256 e651df17cfb09a73ef9271b7f60594be4efb29ba7dbc1bd622801c3325bfbc1d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentmetrics_autogen-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e659ffe0fb4ed37e15bd108bc054b7276f7c974e67cb1d89d844674e4f5f2c4
MD5 9d2c20a49686cadb7d14fdc73ce5e027
BLAKE2b-256 b28903c441642d390540930bcfda5d8f2cfdca0b2ff57758601fa0adf13985d0

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