Replies: 2 comments 7 replies
|
Hi @addu390, +1 on this. Being able to reconstruct and visualize the trace of a single run is really helpful for observing and understanding agent behavior, and it's exactly the gap that neither metrics nor the event log fills today. I'd suggest splitting this into two fairly independent problems:
Once you split it this way, the overhead concern mostly lands on the first part, and I think that part is actually pretty light. We already record every event in the event log. To reconstruct the causal tree, we basically just need one extra field per event: which action emitted the event. With that, the whole run can be rebuilt from the event log. The reverse edges (which actions an event triggered) don't even need to be recorded explicitly. They can be derived from the action trigger rules plus timestamps. So the increment on the recording side is small, and I think it can be kept separate from the concern about full-fidelity tracing being too heavy at streaming QPS. The second part can be fully on-demand rather than always-on. We only run it when needed, e.g. local debugging, CI/eval, or staging. The rendering form doesn't have to be a tree either; PlantUML or something else would work too, and we can discuss that separately. As long as the recording side captures the necessary info, there's a lot of flexibility in what we do with it later. |
Event Lineage: Reconstructing a Trace Tree Based on Event Causality
Based on Discussion #710, #841, and #886, this proposal focuses only on reconstructing the runtime causal path between business GoalsThe goal of this design is to rebuild a Trace Tree from the Event Log, with an This makes it easy for users to see which Event triggered an Action and which later Events were output by that Action. EventLineageTo rebuild the Trace Tree above, the Event Log must record each relationship in the path: Consider the following causal chain: Using E2 as the reference point, the lineage can be recorded in either direction:
The forward approach requires updating E2 after A2 completes, because E3 is not yet known when E2 is first recorded. The backward approach requires no later update. When A1 emits E2, the framework already knows E1, A1, and E2. Therefore, the first Therefore, the first phase uses the second approach. Each Event emitted by an Action records:
Following these references backward is sufficient to reconstruct the complete lineage tree for the available Event records. API
These two fields are maintained automatically by the framework. Users do not need to set them when creating an Event, and they are not part of the business The Event Log continues to serialize the complete Event object. No new top-level Event Log record model is introduced in this phase. An Event returned by the Event Log could therefore look like: {
"timestamp": "2026-07-13T10:00:00.000Z",
"eventType": "tool_request",
"event": {
"eventType": "tool_request",
"id": "f9cbb921-664a-4acd-b1a0-050fa8857657",
"upstreamEventId": "b438dd06-b619-4763-bfd7-8eb7388f01ac",
"upstreamActionName": "chat_model_action",
"attributes": {}
}
}DesignLineage Design
Therefore, when processing an Event output by Both values are available from the existing Why a Run ID Is Not Required in the First PhaseEach non-root Event directly references its parent Event by ID. Each connected component in the resulting parent-child graph For a complete log, following parent references is sufficient to associate every descendant Event with its root.
These limitations are acceptable for the first-phase goal of reconstructing direct Event–Action causality. Trace Tree ReconstructionA local reader or script can rebuild and display the Event lineage tree from a saved JSONL Event Log. The reconstruction process is:
The Trace Tree is derived on the reading side. It does not add any new fields to the Event Log. For example, the script renders an The visualization provides two basic output formats: a text tree and Trace Tree JSON. The vertical order in the UI is only for easier Thanks again to @addu390, @zxs1633079383, for the initial exploration of this topic and for giving me the opportunity to continue the design. With #900 proposing a more complete execution-based model for Event relationships, lifecycle information, and failure |
Uh oh!
There was an error while loading. Please reload this page.
Context
Flink Agents today ships three observability surfaces:
event-listeners.That covers aggregates (metrics), audit records (event log), and hooks (listener). What it doesn't cover is reconstructing a single run as a causal tree:
That tree shape is what
LangSmith(and Langfuse, Phoenix, etc) render for debugging, or whereMLflowslots into for batch eval runs (one run = one trace, with metrics, prompts, and outputs tracked across versions of the agent). There is alsoOpenTelemetryGenAI semantic conventions. Makes debugging and battle-testing non-trivial agent workflows tractable.Scope
Not proposing this as a default for production streaming jobs. Full-fidelity per-event tracing at streaming QPS is too heavy, metrics + event log stay the right production defaults.
The question is whether the framework should provide first-class support for tracing where it actually pays off:
In all four, you want a single run rendered end-to-end. Today you piece it together from event-log records.
Open question
Is this worth the framework solving? Curious if others hit this in their own dev loop.
All reactions