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

# Run script

> Starts a fresh conversation against the agent, sends up to 10 messages in sequence, and condenses every turn into a short digest instead of full traces. Compile the environment first after an edit, because the script runs against the last compiled version.



## OpenAPI

````yaml /specs-prettified/realtime/openapi.stable.json post /v1/stable/conversation/script
openapi: 3.0.0
info:
  title: Realtime
  description: Realtime gateway API service
  version: 1.0.0
  contact: {}
servers:
  - url: https://realtime-api.voiceflow.com
security: []
tags: []
paths:
  /v1/stable/conversation/script:
    post:
      tags:
        - Conversation
      summary: Run script
      description: Starts a fresh conversation against the agent, sends up to 10
        messages in sequence, and condenses every turn into a short digest
        instead of full traces. Compile the environment first after an edit,
        because the script runs against the last compiled version.
      operationId: StableConversationController_runScript
      parameters:
        - name: projectID
          required: true
          in: query
          schema:
            type: string
            description: The ID of the project to operate on.
        - name: environmentAlias
          required: true
          in: query
          schema:
            type: string
            description: The alias of the environment to operate on (e.g. `main`).
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/StableConversationScriptRequest"
      responses:
        "200":
          description: "Returns one digest per turn: the agent's replies, the tools it
            called, the variables that changed, and any errors. Messages that
            were not sent because the script stopped early come back in
            `notSent`, and `needsRecompile` says whether the turns ran against
            an outdated compile."
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/StableConversationScriptResponse"
          x-vf-doc:
            description: "Returns one digest per turn: the agent's replies, the tools it
              called, the variables that changed, and any errors. Messages that
              were not sent because the script stopped early come back in
              `notSent`, and `needsRecompile` says whether the turns ran against
              an outdated compile."
      security:
        - token: []
components:
  schemas:
    StableConversationScriptRequest:
      type: object
      properties:
        messages:
          minItems: 1
          maxItems: 10
          type: array
          items:
            type: string
            minLength: 1
            maxLength: 2000
          description: The user messages to send, in order, after the launch that starts
            the conversation.
        variables:
          description: Variable values to set before the launch, keyed by variable name,
            to start as a known caller.
          type: object
          additionalProperties: {}
        version:
          default: draft
          description: Whether to talk to the draft or the published version of the
            environment. Draft unless you pass it.
          type: string
          enum:
            - draft
            - published
          x-enumNames:
            - DRAFT
            - PUBLISHED
      required:
        - messages
      additionalProperties: false
    StableConversationScriptResponse:
      type: object
      properties:
        userID:
          type: string
          description: The conversation user ID the script ran as, for reading its state
            afterwards.
        needsRecompile:
          type: boolean
          description: When true, the script ran against a stale prototype. Compile the
            environment and run it again; do not treat these turns as proof the
            latest edits work.
        turns:
          type: array
          items:
            $ref: "#/components/schemas/StableConversationScriptTurn"
          description: The launch turn first, then one turn per message sent.
        notSent:
          type: array
          items:
            type: string
          description: Messages that were not sent because the agent ended the
            conversation, a turn failed or reported errors, or the caller
            stopped the script first.
      required:
        - userID
        - needsRecompile
        - turns
        - notSent
    StableConversationScriptTurn:
      type: object
      properties:
        user:
          nullable: true
          description: The message sent in this turn. Null for the launch turn that starts
            the conversation.
          type: string
        agent:
          type: array
          items:
            type: string
          description: "The agent's replies in this turn, in order, at most 10, each cut
            to 1,000 characters. Buttons, cards and carousels come summarised,
            such as \"[buttons: Yes | No]\" or \"[card: <title>]\"."
        toolCalls:
          type: array
          items:
            $ref: "#/components/schemas/StableConversationScriptToolCall"
          description: The tools the agent called and the tools its workflow steps ran in
            this turn, at most 20.
        variableChanges:
          type: array
          items:
            $ref: "#/components/schemas/StableConversationScriptVariableChange"
          description: The variables this turn set, changed or cleared, at most 30. Leaves
            out the variables that change every turn (vf_now, vf_time,
            timestamp, vf_memory, last_utterance, last_response, last_event,
            intent_confidence). The launch turn lists the preset variables and
            the variables the launch set, not the system variables or the
            starting values.
        errors:
          type: array
          items:
            type: string
          description: Errors, failed tool calls, HTTP failures and credit limits the
            runtime reported in this turn, at most 10, each cut to 300
            characters.
        ended:
          type: boolean
          description: True when the agent ended the conversation in this turn.
      required:
        - user
        - agent
        - toolCalls
        - variableChanges
        - errors
        - ended
    StableConversationScriptToolCall:
      type: object
      properties:
        name:
          type: string
          description: "The tool that ran: by the name the agent called it, or its own
            name when a workflow step ran it."
        arguments:
          type: string
          description: The arguments the agent passed, as JSON, cut to 300 characters. {}
            when a workflow step ran the tool.
      required:
        - name
        - arguments
    StableConversationScriptVariableChange:
      type: object
      properties:
        name:
          type: string
        before:
          nullable: true
          description: The value before the turn, as JSON cut to 200 characters. Null when
            it was not set; a null value is the string "null".
          type: string
        after:
          nullable: true
          description: The value after the turn, as JSON cut to 200 characters. Null when
            it is not set; a null value is the string "null".
          type: string
      required:
        - name
        - before
        - after
  securitySchemes:
    token:
      scheme: bearer
      bearerFormat: JWT
      type: http
      description: Voiceflow bearer token
````
