DS DevShelfHub Projects · AI tools
Tutorials/ CrewAI/ Observability · API Reference →
Observability Page 22 of 29

CrewAI Observability: Tracing, Redaction, and Token Accounting

By DevShelfHub

Built-in tracing plus first-class integrations with every major LLMOps platform. Fingerprints and PII redaction keep traces compliance-safe.

Series progress22 / 29
CrewAI observability tutorial — CrewAI Observability: Tracing, Redaction, and Token Accounting

Built-in Tracing

Enable with crewai traces enable. The runtime captures prompts, completions, tool calls, and metadata. View with Accessing Traces in the dashboard. PII fields are redacted by default — see Redaction below.

Integrations

Langfuse
OTel. LANGFUSE_PUBLIC_KEY
Langtrace
Init before importing crewai.
Datadog LLM Obs
ddtrace + OTel exporter
Arize Phoenix
openinference-instrumentation-crewai
MLflow
mlflow.crewai.autolog()
Opik (Comet)
track_crewai()
Weave (W&B)
Auto-capture
OpenLIT
Vendor-neutral OTel
Braintrust
BraintrustSpanProcessor
Maxim
Auto-capture
LangDB
pylangdb.crewai.init()
Portkey
Gateway + fallbacks + guardrails
Galileo
GALILEO_PROJECT
AgentOps
Removed in v0.40+

SecurityConfig & Fingerprints

Every Agent and Crew gets an auto-assigned Fingerprint — a hashable, immutable ID for telemetry. Attach SecurityConfig to a Crew to configure redaction patterns and telemetry safety.

PII Redaction

Why it matters: traces capture prompts and outputs — both can contain PII subject to GDPR, HIPAA, and PCI-DSS. CrewAI redacts known PII entity types before storage. Wire custom patterns for org-specific identifiers (employee IDs, internal account numbers).

Hook-level sanitization: sanitize_response, sanitize_llm_response, sanitize_tool_result are designed to plug into the @after_llm_call_crew and @after_tool_call_crew hooks.

Token & Cost Tracking

Every CrewOutput exposes .token_usage.tokens.{prompt, completion, cached_prompt}. Reasoning tokens are tracked separately. Log to your metrics backend in @after_kickoff.

Notes

Sampling beats full capture at scale

Tracing every LLM call can explode cardinality and cost. Default to sampled traces for healthy tenants, and temporarily raise fidelity when error budgets burn.

Redact before export

Third-party observability vendors are not your data vault. Strip secrets, tokens, and regulated fields in hooks before events leave your network boundary.

Token metrics should tie to business outcomes

Logging raw token counts per request is useful, but dashboards get actionable when you join them to success rates, latency, and customer-visible errors.

SecurityConfig is not a substitute for network policy

Use framework controls together with mTLS, private egress, and least-privilege IAM so a misconfigured agent cannot phone home to unexpected endpoints even if tracing is wide open.

CrewAI observability FAQ

What should I trace in CrewAI production?

Trace each kickoff id with spans for LLM calls, tool calls, guardrails, and retries so latency and error budgets are visible per step.

How do I redact PII from CrewAI logs?

Use structured redaction helpers or SecurityConfig patterns from the docs, centralize serializers, and test with synthetic payloads that mimic customer data.

Which integrations pair well with CrewAI?

OpenTelemetry-friendly sinks, Langfuse, and vendor APMs all work if you forward events consistently from hooks or tracing adapters.

How do I monitor token usage?

Aggregate tokens per agent, task, and tenant, then alert on anomalies. Tokens are the main cost driver for most crews.

What is the difference between observability and debugging?

Debugging is interactive and short-lived, while observability is continuous telemetry that supports on-call response and trend analysis.

See also: DevShelfHub's CrewAI tool review for a product-level comparison, pricing notes, and links back into this tutorial series.

Quick jump: API Reference