> ## Documentation Index
> Fetch the complete documentation index at: https://arizeai-433a7140-roger-ci-skip-release-prs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Patch Session

> Update a persisted session's mutable fields.



## OpenAPI

````yaml patch /v1/agent_sessions/{session_id}
openapi: 3.1.0
info:
  title: Arize-Phoenix REST API
  description: Schema for Arize-Phoenix REST API
  version: '1.0'
servers: []
security: []
paths:
  /v1/agent_sessions/{session_id}:
    patch:
      tags:
        - chat
      summary: Patch Session
      description: Update a persisted session's mutable fields.
      operationId: patchAgentSession
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            title: Session Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PatchAgentSessionRequestBody'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatchAgentSessionResponseBody'
        '400':
          content:
            text/plain:
              schema:
                type: string
          description: Bad Request
        '401':
          content:
            text/plain:
              schema:
                type: string
          description: Unauthorized
        '403':
          content:
            text/plain:
              schema:
                type: string
          description: Forbidden
        '404':
          content:
            text/plain:
              schema:
                type: string
          description: Not Found
        '409':
          description: >-
            The request conflicts with the session's current state; the body's
            ``code`` field says how.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentSessionConflictError'
        '422':
          content:
            text/plain:
              schema:
                type: string
          description: Unprocessable Entity
        '507':
          content:
            text/plain:
              schema:
                type: string
          description: Insufficient Storage
components:
  schemas:
    PatchAgentSessionRequestBody:
      properties:
        title:
          type: string
          maxLength: 100
          title: Title
          description: New title for the session
        model:
          $ref: '#/components/schemas/AgentModelSelection'
          description: New model selection for the session
      type: object
      title: PatchAgentSessionRequestBody
      description: >-
        Fields to update on a persisted session. Omit a field to leave it
        unchanged.
    PatchAgentSessionResponseBody:
      properties:
        data:
          $ref: '#/components/schemas/AgentSessionData'
      type: object
      required:
        - data
      title: PatchAgentSessionResponseBody
    AgentSessionConflictError:
      properties:
        code:
          type: string
          enum:
            - agent_session_busy
            - agent_session_model_stale
            - agent_session_messages_stale
            - agent_session_tool_outputs_conflict
            - agent_session_already_compact
            - agent_session_compaction_conflict
          title: Code
          description: Machine-readable reason the request conflicted.
        message:
          anyOf:
            - type: string
            - type: 'null'
          title: Message
          description: Optional human-readable elaboration on the conflict.
      type: object
      required:
        - code
      title: AgentSessionConflictError
      description: >-
        Body of every HTTP 409 returned by the agent session routes.


        - ``agent_session_busy``: another turn holds the session's turn lock.

        - ``agent_session_model_stale``: the request asserted a model the
        session
          is no longer set to; refetch the session before retrying.
        - ``agent_session_messages_stale``: the send's ``lastMessageId`` no
        longer
          matches the persisted transcript — another client appended; refetch the
          transcript and retry.
        - ``agent_session_tool_outputs_conflict``: the submitted ``toolOutputs``
        do
          not match the transcript's trailing assistant message (no trailing
          assistant message to continue, an unknown ``toolCallId``, or a tool-name
          mismatch). Unlike ``agent_session_messages_stale`` this is not a
          concurrent-writer race but an inconsistent request; fix the client
          rather than retrying.
        - ``agent_session_already_compact``: there are no complete turns to
          compact — either nothing new has finished since the transcript's latest
          checkpoint, or a concurrent request's checkpoint already covers them.
          Not retryable; the conversation is as compact as it can get.
        - ``agent_session_compaction_conflict``: the conversation changed while
        it
          was being compacted; retry.
    AgentModelSelection:
      oneOf:
        - $ref: '#/components/schemas/CustomProviderModelSelection'
        - $ref: '#/components/schemas/BuiltInProviderModelSelection'
      discriminator:
        propertyName: providerType
        mapping:
          builtin:
            $ref: '#/components/schemas/BuiltInProviderModelSelection'
          custom:
            $ref: '#/components/schemas/CustomProviderModelSelection'
    AgentSessionData:
      properties:
        id:
          type: string
          title: Id
        title:
          type: string
          title: Title
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        is_ephemeral:
          type: boolean
          title: Is Ephemeral
        model:
          $ref: '#/components/schemas/AgentModelSelection'
        is_active:
          type: boolean
          title: Is Active
          description: >-
            Whether a response is currently streaming on this session, i.e. its
            lock has a live (non-stale) heartbeat.
        last_message_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Last Message Id
          description: >-
            The message ID of the most recently persisted transcript message, or
            null for an empty transcript.
      type: object
      required:
        - id
        - title
        - created_at
        - updated_at
        - is_ephemeral
        - model
        - is_active
      title: AgentSessionData
    CustomProviderModelSelection:
      properties:
        providerType:
          type: string
          const: custom
          title: Providertype
        providerId:
          type: string
          title: Providerid
        modelName:
          type: string
          title: Modelname
      type: object
      required:
        - providerType
        - providerId
        - modelName
      title: CustomProviderModelSelection
      description: Chat against a stored custom provider record.
    BuiltInProviderModelSelection:
      properties:
        providerType:
          type: string
          const: builtin
          title: Providertype
        provider:
          $ref: '#/components/schemas/ModelProvider'
        modelName:
          type: string
          title: Modelname
      type: object
      required:
        - providerType
        - provider
        - modelName
      title: BuiltInProviderModelSelection
      description: |-
        Chat against a Phoenix built-in provider.

        Credentials and connection details (base URL, Azure endpoint, AWS
        region) are resolved from the secret store first and the process
        environment second.
    ModelProvider:
      type: string
      enum:
        - OPENAI
        - AZURE_OPENAI
        - ANTHROPIC
        - GOOGLE
        - DEEPSEEK
        - XAI
        - OLLAMA
        - AWS
        - CEREBRAS
        - FIREWORKS
        - GROQ
        - MOONSHOT
        - PERPLEXITY
        - TOGETHER
      title: ModelProvider

````