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 emitinvoke_agentandexecute_toolspans itself. - Use LiteLLM's v2 OTel logger (
OpenTelemetryV2). It setsgen_ai.conversation.id(Maple's session key) fromlitellm_session_id. - The default v1 logger (
litellm.callbacks=["otel"]without v2) is wrong for Maple: opacompletion, no conversation id ever, and under an open parent span it writes onto the (ended) parent and the data is dropped.