Description
Search before asking
- I searched in the issues and found nothing similar.
Description
There are two documentation/API-contract follow-ups around the Workflow Agent page.
-
The
Send Eventsnippet shows one action sending both aChatRequestEventand anOutputEvent.This is valid API usage, but it can be misleading as a workflow example. In the runtime, an
OutputEventis emitted downstream immediately, while theChatRequestEventcontinues through the chat-model path. If aChatResponseEventhandler also emits an output, one input may produce both an immediate output and a later model-based output.Source / evidence:
- The snippet is in
docs/content/docs/development/workflow_agent.md, in theSend Eventsection. It showsctx.send_event(ChatRequestEvent(...))followed byctx.send_event(OutputEvent(...))in the same action. The Java tab shows the same pattern withctx.sendEvent(...). - Runtime behavior is in
runtime/src/main/java/org/apache/flink/agents/runtime/operator/ActionExecutionOperator.java:OutputEventis collected downstream immediately, while non-output events are routed to triggered actions.
Suggested fix: split the snippet into separate examples for "trigger another action" and "emit downstream output", or explicitly state that sending an
OutputEventin the same action is only for immediate downstream output and is not the normal chat request/response workflow pattern. - The snippet is in
-
The typed event reconstruction contract should be explicit about base
Eventmetadata such asidandsourceTimestamp.fromEvent/from_eventhelpers reconstruct typed events from a baseEvent. If metadata such asidorsourceTimestampis dropped in any typed reconstruction path, event logs, listeners, correlation, deduplication, and downstream timestamp propagation become harder to reason about.Source / evidence:
- The custom event subclass guidance is in
docs/content/docs/development/workflow_agent.md, in theCustom Event Subclassessection. The examples require users to implementfrom_event/fromEvent, but do not state whether base metadata should be copied. - Built-in Java event reconstruction paths such as
InputEvent.fromEvent(...)andChatRequestEvent.fromEvent(...)preserve the base eventid, and Java paths also preservesourceTimestampwhere applicable. This should either become part of the documented contract or be explicitly described as implementation-specific behavior. - Python built-in event reconstruction paths preserve the base
id, for exampleInputEvent.from_event(...), but the workflow page does not tell users writing custom events what metadata they are responsible for preserving.
Suggested fix: audit typed event reconstruction implementations and either preserve base metadata consistently or document the intended contract and limitations.
- The custom event subclass guidance is in
Are you willing to submit a PR?
- I'm willing to submit a PR!
Activity
[docs] Clarify Workflow Agent event emission and metadata contract
[docs] Clarify Workflow Agent event emission and metadata contract (#813