Skip to content

[Bug]: Langfuse traces missing LLM input/output and tool output #22342

@btorresgil

Description

@btorresgil

Bug Description

Langfuse receives traces from Hermes, but with two critical issues:

  1. LLM generation inputs missing and outputs don't include the LLM response
  2. Tool arguments are visible, but tool outputs are undefined

This causes langfuse plugin to have very little value since the main points of interest for observability are missing.

Steps to Reproduce

  1. set up langfuse side
  2. enable langfuse plugin
  3. chat with hermes and ask for a tool call
  4. observe in langfuse LLM generation that input and output are missing
  5. observe in langfuse Tool that tool output is missing

Expected Behavior

Langfuse should show LLM input and output and tool output

Actual Behavior

langfuse LLM generation that input and output are missing and tool output is undefined

Affected Component

Other: Langfuse plugin and potentially other hooks

Messaging Platform (if gateway-related)

N/A (CLI only)

Debug Report

  Report       https://paste.rs/b2MNF
  agent.log    https://dpaste.com/CPWQ2JA8W
  gateway.log  https://dpaste.com/45KYY968F

Operating System

Debian 13

Python Version

3.11.15

Hermes Version

v0.13.0 (2026.5.7)

Root Cause Analysis (optional)

  1. LLM generation inputs were empty and outputs don't include the LLM response. on_pre_llm_request read only the messages kwarg, but depending on Hermes version and
    call path the actual request payload arrives as request_messages, conversation_history, or user_message. Generations showed
    an empty input instead of the real outbound message list.

  2. Tool observations had no output. The Tool: child span in Langfuse showed input (arguments) but Output: undefined.
    Root cause: when Hermes fires pre_tool_call and post_tool_call without a tool_call_id (the common case for most built-in and
    registry tools), the plugin stored the observation under a unique time.time_ns()-based key in on_pre_tool_call that
    on_post_tool_call could never reconstruct. The post hook fell back to popitem() which is unreliable under concurrent tool
    calls. Every tool span ended up closed by the _finish_trace sweep with no output set.

Proposed Fix (optional)

Opened PR with fix: #22345

Are you willing to submit a PR for this?

  • I'd like to fix this myself and submit a PR

Metadata

Metadata

Assignees

No one assigned

    Labels

    P3Low — cosmetic, nice to havecomp/pluginsPlugin system and bundled pluginsduplicateThis issue or pull request already existstype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions