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

# Stop or run an agent



## OpenAPI

````yaml /partner-openapi.gen.json post /partner/agents/{agentId}
openapi: 3.1.0
info:
  title: Circuit partner API
  version: '0.1'
servers:
  - url: https://api.circuit.org
security: []
paths:
  /partner/agents/{agentId}:
    post:
      summary: Stop or run an agent
      operationId: controlAgent
      parameters:
        - name: circuit-partner-version
          in: header
          required: true
          example: '0.1'
          schema:
            type: string
            const: '0.1'
        - name: agentId
          in: path
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                control:
                  $ref: '#/components/schemas/AgentControl'
              additionalProperties: false
              required:
                - control
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    description: Starts with `agt_`.
                    type: string
                  name:
                    type: string
                  walletId:
                    description: The picked wallet the agent trades; null on paper money.
                    type:
                      - string
                      - 'null'
                  state:
                    description: '`running`, `actionNeeded` (see `message`) or `stopped`.'
                    type: string
                  message:
                    type:
                      - string
                      - 'null'
                  valueUsd:
                    type:
                      - string
                      - 'null'
                  pnlUsd:
                    type:
                      - string
                      - 'null'
                  startedAt:
                    $ref: '#/components/schemas/Timestamp'
                  controls:
                    description: 'What your app may send now: `stop`, `runNow`.'
                    type: array
                    items:
                      type: string
                required:
                  - id
                  - name
                  - state
                  - startedAt
                  - controls
        default:
          description: Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerFailure'
      security:
        - permit: []
components:
  schemas:
    AgentControl:
      type: string
      enum:
        - stop
        - runNow
    Timestamp:
      type: string
      format: date-time
    PartnerFailure:
      description: 'A failed call: act on its HTTP status and show `error` to the user.'
      type: object
      properties:
        error:
          type: string
      required:
        - error
  securitySchemes:
    permit:
      type: http
      scheme: bearer
      description: The permit the user approved for your app.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.