> ## Documentation Index
> Fetch the complete documentation index at: https://langchain-5e9cc07a-preview-opensw-1778865734-3544a9b.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a thread

> Create a thread bound to a Managed Deep Agent. Use the returned thread ID to start runs.



## OpenAPI

````yaml /langsmith/managed-deep-agents-openapi.json post /threads
openapi: 3.1.0
info:
  title: Managed Deep Agents API
  version: 0.1.0
  description: Create, configure, and run Managed Deep Agents.
servers:
  - url: https://api.smith.langchain.com/v1/deepagents
security:
  - apiKeyAuth: []
tags:
  - name: Agents
    description: Create and manage Managed Deep Agent resources.
  - name: Threads
    description: Create and inspect durable thread state.
  - name: Runs
    description: Start runs on Managed Deep Agent threads.
paths:
  /threads:
    post:
      tags:
        - Threads
      summary: Create a thread
      description: >-
        Create a thread bound to a Managed Deep Agent. Use the returned thread
        ID to start runs.
      operationId: createManagedDeepAgentThread
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateThreadRequest'
            examples:
              basic:
                summary: Create a thread for an agent
                value:
                  agent_id: 11111111-1111-1111-1111-111111111111
                  options:
                    test_run: false
                    skip_memory_write_protection: false
      responses:
        '201':
          description: Thread created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Thread'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '409':
          $ref: '#/components/responses/Conflict'
        '502':
          $ref: '#/components/responses/BadGateway'
components:
  schemas:
    CreateThreadRequest:
      type: object
      required:
        - agent_id
      properties:
        agent_id:
          type: string
          format: uuid
          description: Managed Deep Agent ID.
        options:
          $ref: '#/components/schemas/CreateThreadOptions'
    Thread:
      type: object
      properties:
        id:
          type: string
          format: uuid
        agent_id:
          type: string
          format: uuid
        status:
          type: string
          enum:
            - idle
            - busy
            - interrupted
            - error
        metadata:
          type: object
          additionalProperties: true
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    CreateThreadOptions:
      type: object
      properties:
        test_run:
          type: boolean
          description: Marks the thread as a test run, filtered out of usage and analytics.
        skip_memory_write_protection:
          type: boolean
          description: >-
            Lets runs on this thread bypass the default long-term-memory write
            protection.
    ErrorResponse:
      type: object
      properties:
        type:
          type: string
        code:
          type: string
        detail:
          type: string
        status:
          type: integer
  responses:
    BadRequest:
      description: Bad request.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Authentication required or invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: >-
        The authenticated workspace does not have access to the resource or
        feature.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Conflict:
      description: Request conflicts with current resource state.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    BadGateway:
      description: Upstream agent runtime error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: X-Api-Key
      x-default: LANGSMITH_API_KEY

````