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

# Coding Agent Interactive

> The coding agent executes Python code in a sandboxed environment, fixes errors, and returns results. This interactive endpoint supports multi-turn conversations for iterative code development.

Step 1: Submit code with prompt, get thread_id and execution result.
Step 2: Continue with thread_id and resume=true to iterate on code.




## OpenAPI

````yaml https://raw.githubusercontent.com/sambanova/agents/refs/heads/main/chat-sambanova-agent-api-spec.yaml post /agent/coding/interactive
openapi: 3.1.0
info:
  title: Sambanova Agents Service
  description: Service for Sambanova agents
  version: 0.0.1
  termsOfService: https://sambanova.ai/cloud-end-user-license-agreement
  contact:
    email: info@sambanova.ai
    name: SambaNova information
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://chat.sambanova.ai/api
security:
  - api_key: []
externalDocs:
  description: Find out more in the official SambaNova docs
  url: https://docs.sambanova.ai/cloud/api-reference/overview
paths:
  /agent/coding/interactive:
    post:
      tags:
        - Subagents Interactive
      summary: Coding Agent Interactive
      description: >
        The coding agent executes Python code in a sandboxed environment, fixes
        errors, and returns results. This interactive endpoint supports
        multi-turn conversations for iterative code development.


        Step 1: Submit code with prompt, get thread_id and execution result.

        Step 2: Continue with thread_id and resume=true to iterate on code.
      operationId: coding_agent_interactive_agent_coding_interactive_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CodingAgentInteractiveRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BaseAgentResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - api_key: []
components:
  schemas:
    CodingAgentInteractiveRequest:
      title: CodingAgentInteractiveRequest
      type: object
      description: Request for coding interactive agent json object
      additionalProperties: false
      properties:
        code:
          title: Code
          description: Code to run
          type: string
        prompt:
          title: Prompt
          description: The main prompt for the coding interactive agent
          type: string
        resume:
          default: false
          title: Resume
          description: Whether to describe the results or not
          type: boolean
        thread_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Thread Id
          description: thread id for persistent context
      required:
        - prompt
        - code
      examples:
        - prompt: Create a function to calculate fibonacci
          code: |
            def fib(n):
              return fib(n-1) + fib(n-2)
          resume: false
        - prompt: Fix the base case issue
          code: |
            def fib(n):
              if n <= 1:
                  return n
              return fib(n-1) + fib(n-2)
          thread_id: thread-abc123
          resume: true
    BaseAgentResponse:
      type: object
      title: Base agent response object
      description: Base agent response object
      additionalProperties: false
      properties:
        status:
          title: status
          description: status of agent gereneration
          type: string
        result:
          title: result
          description: results description
          type: string
        artifacts:
          title: artifacts
          description: generated artifacts
          type: array
          items:
            type: string
            description: id of generated artifact
        thread_id:
          title: thread_id
          description: thread id for persistent context
          type: string
      required:
        - status
        - result
        - artifacts
        - thread_id
      example:
        status: success
        result: I've created the bar chart...
        artifacts:
          - file-id-123
        thread_id: thread-abc
    HTTPValidationError:
      title: HTTPValidationError
      type: object
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    api_key:
      type: http
      description: SambaNova API Key
      scheme: bearer
      bearerFormat: apiKey

````