Interface StreamingEventKind
- All Superinterfaces:
Event
- All Known Implementing Classes:
Message,Task,TaskArtifactUpdateEvent,TaskStatusUpdateEvent
StreamingEventKind represents events suitable for asynchronous, progressive updates during agent task execution. Streaming allows agents to provide incremental feedback as work progresses, rather than waiting until task completion.
Streaming events use polymorphic JSON serialization where the JSON member name itself acts as the type discriminator (e.g., "task", "message", "statusUpdate", "artifactUpdate"). This aligns with Protocol Buffers' oneof semantics and modern API design practices.
Permitted implementations:
Task- Complete task state (typically the final event in a stream)Message- Full message (complete message in the stream)TaskStatusUpdateEvent- Incremental status updates (e.g., SUBMITTED → WORKING → COMPLETED)TaskArtifactUpdateEvent- Incremental artifact updates (partial results, chunks)
Streaming events enable patterns like:
- Progressive text generation (chunks of response as generated)
- Status notifications (task state transitions)
- Partial results (early artifacts before task completion)
- See Also:
-
Method Summary
-
Method Details
-
kind
String kind()Returns the type identifier for this streaming event.This method provides programmatic type discrimination for routing, logging, and debugging. NOTE: This value is NOT serialized to JSON in protocol v1.0+. For JSON serialization, the wrapper field name serves as the discriminator.
Use
instanceofpattern matching to determine the concrete event type:if (event instanceof Task task) { // Handle task } else if (event instanceof TaskStatusUpdateEvent statusUpdate) { // Handle status update }- Returns:
- the event type identifier (e.g., "task", "message", "statusUpdate", "artifactUpdate")
-