> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobilerun.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Run Streamed Task

> Create and dispatch a new agent task, returning an SSE stream of task events. Cancels the task if the client disconnects.



## OpenAPI

````yaml /api-reference/tasks.yaml post /tasks/stream
openapi: 3.1.0
info:
  title: Tasks
  version: v1
servers:
  - description: Droidrun Cloud API
    url: https://api.mobilerun.ai/v1
security:
  - bearerAuth: []
paths:
  /tasks/stream:
    post:
      tags:
        - Tasks
      summary: Run Streamed Task
      description: >-
        Create and dispatch a new agent task, returning an SSE stream of task
        events. Cancels the task if the client disconnects.
      operationId: run_streamed_task_tasks_stream_post
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskCreate'
        required: true
      responses:
        '201':
          content:
            application/json:
              schema: {}
            text/event-stream: {}
          description: Successful Response
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
          description: Unauthorized
        '402':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Payment Required
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Forbidden
        '412':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Precondition Failed
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Unprocessable Content
        '500':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Internal Server Error
      x-codeSamples:
        - lang: JavaScript
          source: |-
            import Mobilerun from '@mobilerun/sdk';

            const client = new Mobilerun({
              apiKey: process.env['MOBILERUN_CLOUD_API_KEY'], // This is the default and can be omitted
            });

            const response = await client.tasks.runStreamed({
              deviceId: '182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e',
              task: 'x',
            });

            console.log(response);
        - lang: Python
          source: |-
            import os
            from mobilerun_sdk import Mobilerun

            client = Mobilerun(
                api_key=os.environ.get("MOBILERUN_CLOUD_API_KEY"),  # This is the default and can be omitted
            )
            response = client.tasks.run_streamed(
                device_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
                task="x",
            )
            print(response)
components:
  schemas:
    TaskCreate:
      properties:
        accessibility:
          default: true
          title: Accessibility
          type: boolean
        apps:
          items:
            type: string
          title: Apps
          type: array
        continueOnFailure:
          default: false
          title: Continueonfailure
          type: boolean
        credentials:
          items:
            $ref: '#/components/schemas/PackageCredentials'
          title: Credentials
          type: array
        deviceId:
          description: The ID of the device to run the task on.
          format: uuid
          title: Deviceid
          type: string
        displayId:
          default: 0
          description: The display ID of the device to run the task on.
          title: Displayid
          type: integer
        executionTimeout:
          default: 1000
          description: Maximum agent execution time in seconds (1–2700).
          maximum: 2700
          minimum: 1
          title: Executiontimeout
          type: integer
        files:
          items:
            type: string
          title: Files
          type: array
        llmModel:
          default: openai/gpt-5.6-luna
          description: >-
            The LLM model identifier to use for the task (e.g.
            'openai/gpt-5.6-luna')
          title: Llmmodel
          type: string
        maxSteps:
          default: 100
          title: Maxsteps
          type: integer
        outputSchema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Outputschema
        reasoning:
          default: true
          title: Reasoning
          type: boolean
        recordingEnabled:
          default: false
          description: >-
            Record device video for the whole task and persist a retrievable
            reference
          title: Recordingenabled
          type: boolean
        stealth:
          default: false
          title: Stealth
          type: boolean
        subagentModel:
          default: openai/gpt-5.6-luna
          description: >-
            LLM model used by sub-agent roles: executor, app_opener,
            structured_output
          title: Subagentmodel
          type: string
        systemPrompt:
          anyOf:
            - maxLength: 32000
              type: string
            - type: 'null'
          description: >-
            Optional custom behavioral overlay applied on top of the agent's
            default system prompts. Never echoed back in responses or errors.
          title: Systemprompt
        task:
          minLength: 1
          title: Task
          type: string
        temperature:
          default: 0.5
          deprecated: true
          description: >-
            Deprecated and ignored. Sampling behavior is controlled by the model
            provider.
          title: Temperature
          type: number
        vision:
          default: false
          title: Vision
          type: boolean
        vpnCountry:
          anyOf:
            - $ref: '#/components/schemas/VPNCountry'
            - type: 'null'
      required:
        - task
        - deviceId
      title: TaskCreate
      type: object
    ErrorResponse:
      properties:
        detail:
          description: The detail of the error
          title: Detail
          type: string
        errors:
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          description: The status code of the error
          title: Status
          type: integer
        title:
          description: The title of the error
          title: Title
          type: string
      required:
        - title
        - status
        - detail
        - errors
      title: ErrorResponse
      type: object
    UnauthorizedResponse:
      properties:
        detail:
          default: You are not authorized to access this resource
          description: The detail of the error
          title: Detail
          type: string
        errors:
          default: []
          description: The errors
          items: {}
          title: Errors
          type: array
        status:
          default: 401
          description: The status code of the error
          title: Status
          type: integer
        title:
          default: Unauthorized
          description: The title of the error
          title: Title
          type: string
      title: UnauthorizedResponse
      type: object
    PackageCredentials:
      properties:
        credentialNames:
          items:
            type: string
          title: Credentialnames
          type: array
        packageName:
          title: Packagename
          type: string
      required:
        - packageName
        - credentialNames
      title: PackageCredentials
      type: object
    VPNCountry:
      enum:
        - US
        - BR
        - FR
        - DE
        - IN
        - JP
        - KR
        - ZA
      title: VPNCountry
      type: string
  securitySchemes:
    bearerAuth:
      bearerFormat: Opaque
      description: Bearer token via Authorization header
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.