maple-agent-tracing-litellm

Installation
SKILL.md

Maple agent tracing: LiteLLM

Goal: every conversation = one Maple Agent Session. Each agent run = one turn (one trace) with transcript, LiteLLM chat <model> spans with tokens, execute_tool spans with args/results, failed tools marked failed, sub-agents in their own lanes.

Mechanism:

  • LiteLLM traces model calls only (scope litellm). It has no agent loop, no tool executor, no conversation concept. The app MUST emit invoke_agent and execute_tool spans itself.
  • Use LiteLLM's v2 OTel logger (OpenTelemetryV2). It sets gen_ai.conversation.id (Maple's session key) from litellm_session_id.
  • The default v1 logger (litellm.callbacks=["otel"] without v2) is wrong for Maple: op acompletion, no conversation id ever, and under an open parent span it writes onto the (ended) parent and the data is dropped.

Step 0: Detect

Installs
5
GitHub Stars
1.9K
First Seen
Oct 8, 2026