Skip to main content

agentmetrics-crewai

PyPI License: MIT

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

MIT

Metadata

Release files for agentmetrics-crewai 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-crewai 0.2.0
File Size Uploaded
agentmetrics_crewai-0.2.0.tar.gz 3.9 kB Details

Built distribution (wheel)

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

Total release size: 8.3 kB

Release files / agentmetrics_crewai-0.2.0.tar.gz

Download URL agentmetrics_crewai-0.2.0.tar.gz
Size 3.9 kB
Tags Source
SHA-256 checksum
How to use checksums
a73122745cd66778fceb0e6c6a2ebf9cd68b053d724931865cd9693be09efc5f
BLAKE2b-256 checksum
How to use checksums
2c449a67eff16c22046737789b1c2ccd59c2f548259f096cd853ef9ff90ea833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

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

Download URL agentmetrics_crewai-0.2.0-py3-none-any.whl
Size 4.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9dea8b4f02ac4fe8d3b381cb56ee55d6cb4b131aee0a1408db5458cae0a7f651
BLAKE2b-256 checksum
How to use checksums
521a76a084d4b640cef7414dec342ee634155640fb7fa44e77b428559b3d4062
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