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

# Run an agent

> Start a new run for an agent.

Runs always execute the agent's live published version, so the agent must be
published first with `POST /v1/agents/{agent_id}/publish`. Unpublished drafts
cannot be run.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/profound/openapi.documented.yml post /v1/agents/{agent_id}/runs
openapi: 3.1.0
info:
  title: External API
  version: 60df76cc2b9752c279276872b19310c02da38378
servers:
  - url: https://api.tryprofound.com
    description: Production Server
security: []
paths:
  /v1/agents/{agent_id}/runs:
    post:
      tags:
        - Agents
      summary: Run an agent
      description: >-
        Start a new run for an agent.


        Runs always execute the agent's live published version, so the agent
        must be

        published first with `POST /v1/agents/{agent_id}/publish`. Unpublished
        drafts

        cannot be run.
      operationId: run_agent_v1_agents__agent_id__runs_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            description: The ID of the agent to run.
            title: Agent Id
          description: The ID of the agent to run.
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/RunAgentRequest'
                - type: 'null'
              description: Inputs to send to the agent run.
              title: Request
      responses:
        '202':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AcceptedAgentRun'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
        - BearerAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Profound from '@profoundai/client';


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


            const run = await
            client.agents.runs.create('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e');


            console.log(run.id);
        - lang: Python
          source: |-
            import os
            from profound import Profound

            client = Profound(
                api_key=os.environ.get("PROFOUND_API_KEY"),  # This is the default and can be omitted
            )
            run = client.agents.runs.create(
                agent_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
            )
            print(run.id)
components:
  schemas:
    RunAgentRequest:
      properties:
        inputs:
          additionalProperties: true
          type: object
          title: Inputs
          description: >-
            Input values for the run. Keys should match the property names
            defined in `schema.input`. Omit the request body when the agent does
            not require inputs.
      additionalProperties: false
      type: object
      title: RunAgentRequest
      description: Request body for starting an agent run.
    AcceptedAgentRun:
      properties:
        id:
          type: string
          format: uuid
          title: Id
          description: Unique ID for the accepted run.
        agent_id:
          type: string
          format: uuid
          title: Agent Id
          description: Unique ID of the agent for this run.
        status:
          $ref: '#/components/schemas/AgentRunStatus'
          description: Initial status of the accepted run.
        started_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Started At
          description: When the run started, if execution began immediately.
      additionalProperties: false
      type: object
      required:
        - id
        - agent_id
        - status
      title: AcceptedAgentRun
      description: Run details returned after a run request is accepted.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AgentRunStatus:
      type: string
      enum:
        - queued
        - running
        - succeeded
        - failed
        - cancelled
        - skipped
        - unknown
      title: AgentRunStatus
      description: Current execution status for an agent run.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: X-API-Key
    BearerAuth:
      type: http
      scheme: bearer

````