View a markdown version of this page

Streamed events - AWS Context

Streamed events

AgenticRetrieveStream sends zero or more traceEvent and responseEvent events, then exactly one result or one error event.

  • A traceEvent reports a planning or retrieval step, its status, and a short description for people to read. Use it to show progress. The description is written for people, so display it as is and don’t write code that depends on its wording.

  • A responseEvent carries answer text. Concatenate the chunks in order to rebuild answer. The answer arrives in one chunk after the agent finishes composing it. Concatenate every responseEvent anyway, so your code keeps working if the answer arrives in several chunks.

Errors before the stream starts are ordinary HTTP errors; after it starts, a failure arrives as an error event. If the stream fails, retry the whole request.