Skip to main content

AgentMetrics observability integration for CrewAI agents

Project description

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

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_crewai-0.1.0.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

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

agentmetrics_crewai-0.1.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for agentmetrics_crewai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 abb87820a5022710a6a9df1614c29bfd6dfa730ab2dba082ca02b59e7028a25c
MD5 e123ae6331bc94faa4e62926af5c91f4
BLAKE2b-256 206eec413ad80dacb82630d8b1c92b6b443367d7afa2af7d84900337bcfc1139

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for agentmetrics_crewai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a58c635b044b492689aa56a5497eb999dd851764a6ec713f9860c646f195c56f
MD5 9a4060f981d4a64359a31d9f548a7a59
BLAKE2b-256 9183abf11ba4a4408314fc69c44fff14a3ab0f179b87cdf97ba3fe0fb85e520e

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