AgentMetrics observability integration for CrewAI agents
Project description
agentmetrics-crewai
AgentMetrics integration for CrewAI. Instantiate the listener once at startup and every crew.kickoff() reports back to your dashboard automatically showing latency, cost, token counts, tool calls, and errors, with zero changes to your crew code.
Install
pip install agentmetrics-crewai
Quickstart
from agentmetrics_crewai import AgentMetricsListener
# register once at startup, covers all crews in the process
AgentMetricsListener(
agent_id="my-crew",
base_url="http://localhost:8099",
)
# Run your crew as normal
result = MyCrew().kickoff()
API
AgentMetricsListener(agent_id, base_url)
| Parameter | Default | Description |
|---|---|---|
agent_id |
"crewai-agent" |
Fallback label if the crew has no crew_name |
base_url |
"http://localhost:8099" |
AgentMetrics server address |
Instantiating the class auto-registers event handlers on the global crewai_event_bus with no further setup needed, and the listener handles concurrent kickoffs correctly via source_fingerprint tracking.
.flush(timeout=10.0)
Blocks until all in-flight HTTP requests complete. Call before process exit in scripts.
What gets tracked
Each kickoff() call emits one event to /v1/events on completion or failure:
| Field | Description |
|---|---|
status |
success or failed |
duration_ms |
Wall-clock kickoff duration |
input_tokens / output_tokens |
Aggregated across all LLM calls |
cache_read_tokens / cache_write_tokens |
Cache token counts |
llm_calls |
Number of LLM requests in the kickoff |
tool_calls / tool_errors |
Tool usage counts |
tool_names |
Set of tools invoked |
model |
Model name from the first LLM call |
estimated_cost_usd |
Computed from token counts and model pricing |
error |
First 500 chars of the error message on failure |
License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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 agentmetrics_crewai-0.2.0.tar.gz.
File metadata
- Download URL: agentmetrics_crewai-0.2.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a73122745cd66778fceb0e6c6a2ebf9cd68b053d724931865cd9693be09efc5f
|
|
| MD5 |
b255aae91c64bf77f3931658475d5471
|
|
| BLAKE2b-256 |
2c449a67eff16c22046737789b1c2ccd59c2f548259f096cd853ef9ff90ea833
|
File details
Details for the file agentmetrics_crewai-0.2.0-py3-none-any.whl.
File metadata
- Download URL: agentmetrics_crewai-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9dea8b4f02ac4fe8d3b381cb56ee55d6cb4b131aee0a1408db5458cae0a7f651
|
|
| MD5 |
604fb6d5e143a0d732ae519a15fcd8ca
|
|
| BLAKE2b-256 |
521a76a084d4b640cef7414dec342ee634155640fb7fa44e77b428559b3d4062
|