v1

latestOpenAPI 3.0.02026-07-174565114.3 KB
v1

Create thread with run (SSE)

Creates a new thread and immediately starts a streaming run. Returns an SSE stream of AG-UI events.

post/v1/threads/runs

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

threadMetadataobject

Metadata for the thread

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",
  "thread": {
    "initialMessages": [
      {
        "role": "user",
        "content": [
          {
            "type": "text",
            "text": "Hello, world!"
          }
        ]
      }
    ]
  }
}

Response

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