API Design Shape
Request structures and Server-Sent Events (SSE) lifecycle.
The Agent Platform API endpoint is located at https://api.agent-platform.waqitech.com/. It accepts a POST request with a JSON body and returns a text/event-stream response.
Request Payload
To start a stream, you provide the model, the message history, and a list of tools. Tools are referenced by their tool_id assigned by the platform.
{
"model": "<your-model-id>",
"messages": [
{
"type": "message",
"role": "user",
"content": "What is on oslojs.dev?"
}
],
"tools": {
"web_fetch": {
"tool_id": "<your-tool-id>"
}
}
}Stream Lifecycle
The API returns Server-Sent Events (SSE). The stream is structured so that only one item is active at a time.
Every item in the stream (whether it is a standard message, reasoning output, or a tool call) follows a strict three-step lifecycle:
- New (
*.new): Signals that a new item has started. - Delta (
*.delta): Contains incremental updates. For messages, this is text content. For tool calls, this is the partial JSON arguments. - Done (
*.done): Signals that the item has completed.
Event Types
The stream emits specific event types corresponding to the active item:
- Messages:
message_item.new,message_item.delta,message_item.done - Reasoning:
reasoning_item.new,reasoning_item.delta,reasoning_item.done - Tool Calls:
tool_item.new,tool_item.delta,tool_item.done
When the entire generation is complete, the stream emits a stream.finish event containing the final finish_reason and token usage statistics.