v1

latestOpenAPI 3.0.02026-07-174565114.3 KB
v1

Create run on existing thread (SSE)

Starts a streaming run on an existing thread. Returns an SSE stream of AG-UI events.

post/v1/threads/{threadId}/runs

Path parameters

threadIdstring required
Example:thr_abc123xyz

Thread ID

Request body

userKeystring

Identifier for a user in your system. Required if no bearer token is provided.

previousRunIdstring

ID of the previous run. Required when continuing a thread that already has messages.

modelstring

Override the default model

maxTokensnumber

Maximum tokens to generate

temperaturenumber

Temperature for generation (0-2)

runMetadataobject

Metadata for the run

Example request

{
  "message": {
    "role": "user",
    "content": [
      {
        "type": "text",
        "text": "Hello, world!"
      }
    ]
  },
  "availableComponents": [
    {
      "name": "WeatherCard",
      "description": "Displays weather information for a location",
      "propsSchema": {
        "type": "object",
        "properties": {
          "temperature": {
            "type": "number"
          },
          "location": {
            "type": "string"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "temperature",
          "location"
        ]
      }
    }
  ],
  "tools": [
    {
      "name": "get_weather",
      "description": "Get the current weather for a location",
      "inputSchema": {
        "type": "object",
        "properties": {
          "location": {
            "type": "string",
            "description": "City name"
          },
          "unit": {
            "type": "string",
            "enum": [
              "celsius",
              "fahrenheit"
            ]
          }
        },
        "required": [
          "location"
        ]
      },
      "maxCalls": 1
    }
  ],
  "model": "gpt-4o"
}

Response

SSE stream of AG-UI events. Each event is sent as 'data: <json>\n\n' where <json> is a BaseEvent object.