> ## 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 an agent

> Stops a running session immediately. Its open positions stay open; the user can close them on Circuit or by asking Ask. Calling it again on a stopped session returns the session unchanged.



## OpenAPI

````yaml /partner-openapi.gen.json post /partner/v0.1/sessions/{session_id}/stop
openapi: 3.1.0
info:
  title: Circuit partner API
  version: '0.1'
servers:
  - url: https://api.circuit.org
security: []
paths:
  /partner/v0.1/sessions/{session_id}/stop:
    post:
      summary: Stop an agent
      description: >-
        Stops a running session immediately. Its open positions stay open; the
        user can close them on Circuit or by asking Ask. Calling it again on a
        stopped session returns the session unchanged.
      operationId: stop
      parameters:
        - name: session_id
          in: path
          required: true
          example: ses_2f81c0de-5a7b-4c3d-9e1f-0a2b3c4d5e6f
          schema:
            type: string
            examples:
              - ses_2f81c0de-5a7b-4c3d-9e1f-0a2b3c4d5e6f
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                description: An agent running for the user on one wallet or on paper money.
                type: object
                properties:
                  id:
                    description: The session's id, starting with `ses_`.
                    type: string
                  agent:
                    description: The agent it runs, starting with `agt_`.
                    type: string
                  name:
                    description: The agent's name.
                    type: string
                  wallet:
                    description: >-
                      The wallet it trades, starting with `wal_`. Null when it
                      runs on paper money.
                    type:
                      - string
                      - 'null'
                  status:
                    $ref: '#/components/schemas/PartnerSessionStatus'
                  value_usd:
                    description: >-
                      The current value of what the session holds, in USD as a
                      decimal string. Null until Circuit first values a new
                      session, about a minute after it starts, or when a holding
                      can't be priced.
                    type:
                      - string
                      - 'null'
                  pnl_usd:
                    description: >-
                      Profit or loss since the session started, in USD as a
                      decimal string. Null when unknown.
                    type:
                      - string
                      - 'null'
                  error:
                    description: >-
                      What the user needs to do when `status` is `needs_user`.
                      Null otherwise.
                    type:
                      - string
                      - 'null'
                  started_at:
                    $ref: '#/components/schemas/Timestamp'
                    description: When the session started.
                required:
                  - id
                  - agent
                  - name
                  - status
                  - started_at
        default:
          description: Failed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PartnerFailure'
      security:
        - permit: []
components:
  schemas:
    PartnerSessionStatus:
      oneOf:
        - description: The agent is running on its own schedule.
          type: string
          const: running
        - description: >-
            The agent is running but the user needs to do something. `error`
            says what, for example that the permit ends soon.
          type: string
          const: needs_user
        - description: The agent was stopped. Its positions stay open.
          type: string
          const: stopped
    Timestamp:
      type: string
      format: date-time
    PartnerFailure:
      description: >-
        A failed call. Handle it by HTTP status and `code`, and show `error` to
        the user.
      type: object
      properties:
        error:
          description: A message you can show the user.
          type: string
        code:
          description: >-
            A stable code such as `BAD_REQUEST`, `NOT_FOUND`, `CONFLICT` or
            `UNAUTHORIZED`. New codes can appear.
          type: string
      required:
        - error
        - code
  securitySchemes:
    permit:
      description: The permit the user approved for your app.
      type: http
      scheme: bearer

````

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