> ## 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:
  - url: https://api.mobilerun.ai
    description: Droidrun Cloud API
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:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/TaskCreate'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema: {}
            text/event-stream: {}
        '400':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
          description: Bad Request
        '401':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthorizedResponse'
          description: Unauthorized
        '402':
          description: Payment Required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '412':
          description: Precondition Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '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)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/droidrun-cloud-go\"\n\t\"github.com/stainless-sdks/droidrun-cloud-go/option\"\n)\n\nfunc main() {\n\tclient := mobileruncloud.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tresponse, err := client.Tasks.RunStreamed(context.TODO(), mobileruncloud.TaskRunStreamedParams{\n\t\tDeviceID: \"182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e\",\n\t\tTask:     \"x\",\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", response)\n}\n"
        - lang: CLI
          source: |-
            mobilerun-cloud tasks run-streamed \
              --api-key 'My API Key' \
              --device-id 182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e \
              --task x
components:
  schemas:
    TaskCreate:
      properties:
        agentId:
          type: integer
          title: Agentid
          default: 0
        llmModel:
          type: string
          title: Llmmodel
          description: >-
            The LLM model identifier to use for the task (e.g.
            'google/gemini-3.1-flash-lite')
          default: google/gemini-3.1-flash-lite
        task:
          type: string
          minLength: 1
          title: Task
        maxSteps:
          type: integer
          title: Maxsteps
          default: 100
        temperature:
          type: number
          title: Temperature
          default: 0.5
        reasoning:
          type: boolean
          title: Reasoning
          default: true
        accessibility:
          type: boolean
          title: Accessibility
          default: true
        vision:
          type: boolean
          title: Vision
          default: false
        executionTimeout:
          type: integer
          title: Executiontimeout
          default: 1000
        credentials:
          items:
            $ref: '#/components/schemas/PackageCredentials'
          type: array
          title: Credentials
        apps:
          items:
            type: string
          type: array
          title: Apps
        files:
          items:
            type: string
          type: array
          title: Files
        outputSchema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Outputschema
        vpnCountry:
          anyOf:
            - $ref: '#/components/schemas/VPNCountry'
            - type: 'null'
        subagentModel:
          type: string
          title: Subagentmodel
          description: >-
            LLM model used by sub-agent roles: executor, app_opener,
            structured_output
          default: google/gemini-3.1-flash-lite
        stealth:
          type: boolean
          title: Stealth
          default: false
        continueOnFailure:
          type: boolean
          title: Continueonfailure
          default: false
        memoryNamespace:
          type: string
          title: Memorynamespace
          description: Memory namespace for cross-task personalization
          default: default
        deviceId:
          type: string
          format: uuid
          title: Deviceid
          description: The ID of the device to run the task on.
        displayId:
          type: integer
          title: Displayid
          description: The display ID of the device to run the task on.
          default: 0
      type: object
      required:
        - task
        - deviceId
      title: TaskCreate
    ErrorResponse:
      properties:
        title:
          type: string
          title: Title
          description: The title of the error
        status:
          type: integer
          title: Status
          description: The status code of the error
        detail:
          type: string
          title: Detail
          description: The detail of the error
        errors:
          items: {}
          type: array
          title: Errors
          description: The errors
      type: object
      required:
        - title
        - status
        - detail
        - errors
      title: ErrorResponse
    UnauthorizedResponse:
      properties:
        title:
          type: string
          title: Title
          description: The title of the error
          default: Unauthorized
        status:
          type: integer
          title: Status
          description: The status code of the error
          default: 401
        detail:
          type: string
          title: Detail
          description: The detail of the error
          default: You are not authorized to access this resource
        errors:
          items: {}
          type: array
          title: Errors
          description: The errors
          default: []
      type: object
      title: UnauthorizedResponse
    PackageCredentials:
      properties:
        packageName:
          type: string
          title: Packagename
        credentialNames:
          items:
            type: string
          type: array
          title: Credentialnames
      type: object
      required:
        - packageName
        - credentialNames
      title: PackageCredentials
    VPNCountry:
      type: string
      enum:
        - US
        - BR
        - FR
        - DE
        - IN
        - JP
        - KR
        - ZA
      title: VPNCountry
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: Opaque
      description: Bearer token via Authorization header

````