Skip to main content
ChatATP uses Server-Sent Events (SSE) to stream real-time updates as agents process messages, execute tools, and generate responses.

SDK Developer Scenarios: Event Streams

The ChatATP SDK handles parsing the underlying HTTP stream. Here are the core scenarios you should handle when reading events from the chat_stream method.

Scenario 1: Basic Text Response

When a user asks a simple question and the agent responds without needing tools.

Scenario 2: Autonomous Tool Execution

When the agent decides to invoke an internal tool during its response cycle.

Scenario 3: Error Encountered

When something goes wrong in the backend or tool execution fails.

SDK Integration Tips:

  1. State Management: Keep a dictionary in memory keyed by tool_call_id. When tool.execution.started arrives, push the placeholder. When tool.execution.completed arrives, update the matching placeholder with the result string.
  2. Text Accumulation: Simply concatenate the strings from agent.response.delta sequentially to render typewriter effects.