Skip to main content
After creating a new custom agent, you can call and use it via the Custom Agent API, which can stream responses. This allows you to process data incrementally as it becomes available, rather than waiting for the full payload. The following example shows how to manage a stream call of the Express Agent API with cURL:
curl -N \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Accept: text/event-stream" \
  -H "Content-Type: application/json" \
  -X POST https://api.you.com/v1/agents/runs \
  -d '{
    "agent": "your_custom_agent_ID",
    "input": "Summarize today\'s top AI research headlines and cite sources.",
    "stream": true
  }'
Below is the summary excerpt of the streaming events:
id: 0
event: response.output_item.added
data: {"seq_id":0,"type":"response.output_item.added","response":{"type":"chat_node.answer","output_index":0,"delta":"The capital of France is Pa"}}

id: 1
event: response.output_item.delta
data: {"seq_id":1,"type":"response.output_item.delta","response":{"output_index":0,"delta":"ris."}}