---
title: "Run an agent task with streaming response"
method: POST
path: "/v1/tasks/{id}/run/stream"
tags: ["Tasks"]
---

# Run an agent task with streaming response

`POST /v1/tasks/{id}/run/stream`

Execute an agent task by ID to generate AI output with Server-Sent Events (SSE) streaming. Provides real-time content as it is generated.

## Path parameters

- `id` string, required

## Request body

- TaskRunDto
  - `contextItems` union[], required — Array of context items - can include both predefined context items (with id and value) and custom context items (with name, question, and answer)
    - union
      - PredefinedContextItemDto
        - `id` string, required — Context item ID
        - `value` union, required — Context item value - format depends on the context item type: • INPUT, TEXTAREA, SELECT, IMAGE_ID, TOOL, CUSTOM: string • MULTISELECT, TAGS_INPUT: string[] (array of selected values) • KNOWLEDGE: KnowledgeItemDto[] (array of knowledge objects with knowledgeId and optional knowledgeExtractionPrompt) • CHECKBOX: string ("true" or "false")
          - string
          - string[]
          - object[]
            - `knowledgeId` string
            - `knowledgeExtractionPrompt` string
      - CustomContextItemDto
        - `name` string, required — The name/label of the custom context item
        - `question` string, required — The question/prompt for this context item (how it will be presented to the model)
        - `answer` string, required — The value/answer for this custom context item
        - `priority` number — The priority of this context item (higher priority = more important)
  - `version` number — Agent task version (optional, defaults to latest)
  - `toLanguage` string — Target output language for the completion (optional, defaults to EN-US)
  - `knowledgeIds` string[] — Array of knowledge IDs to use as context to power the agent
  - `attachmentIds` string[] — Array of temporary attachment IDs (prefixed `tmp_`) to use as ad-hoc context for this run. Create attachments up front via `POST /v1/attachments` and pass the returned IDs here. Temporary attachments are intended for short-lived context (the same attachment can be referenced across retries of the same run) and are not durable — use `knowledgeIds` for content that should persist in your workspace.
  - `toneId` string — Tone ID for the brand voice of the agent's output
  - `audienceId` string — The primary audience ID used to customize the agent's output for a target audience.
  - `additionalAudienceIds` string[] — Additional audience IDs to customize the agent's output for multiple target audiences in a single run, included alongside the primary `audienceId`.
  - `styleGuideId` string — Style Guide ID to apply writing rules to the agent's output
  - `tools` string[] — Array of tools to enable for agent task execution. Can include WEB_SEARCH and/or KNOWLEDGE_SEARCH

## Response `200`

Stream of events containing step updates and content chunks

- union — SSE stream with multiple event types
  - object
    - `step` object
      - `id` string, uuid
      - `status` 'loading' | 'completed'
      - `label` string
  - object
    - `id` string, uuid
    - `content` string
    - `role` string
    - `usage` object, nullable
    - `skillId` string, uuid
    - `contentId` string, uuid
  - object — Error event sent during stream (HTTP 200 with error payload)
    - `statusCode` number
    - `message` string
    - `error` string

---

[API](https://skmtc.net/jasper/apis/jasper-api.md) · [All operations](https://skmtc.net/jasper/apis/jasper-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/jasper/jasper-api/revisions/438914d9525e/schema)
