> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Update Session

> Update session properties such as session_name, session_state, metadata, or summary. Use this endpoint to modify the session name, update state, add metadata, or update the session summary.



## OpenAPI

````yaml patch /sessions/{session_id}
openapi: 3.1.0
info:
  title: Agno API Reference
  description: The all-in-one, private, secure agent platform that runs in your cloud.
  version: 3.0.4
servers: []
security: []
paths:
  /sessions/{session_id}:
    patch:
      tags:
        - Sessions
      summary: Update Session
      description: >-
        Update session properties such as session_name, session_state, metadata,
        or summary. Use this endpoint to modify the session name, update state,
        add metadata, or update the session summary.
      operationId: update_session
      parameters:
        - name: session_id
          in: path
          required: true
          schema:
            type: string
            description: Session ID to update
            title: Session Id
          description: Session ID to update
        - name: type
          in: query
          required: false
          schema:
            anyOf:
              - $ref: '#/components/schemas/SessionType'
              - type: 'null'
            description: >-
              Session type (agent, team, or workflow). If not provided,
              auto-detected from session data.
            title: Type
          description: >-
            Session type (agent, team, or workflow). If not provided,
            auto-detected from session data.
        - name: user_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: User ID
            title: User Id
          description: User ID
        - name: db_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Database ID to use for update operation
            title: Db Id
          description: Database ID to use for update operation
        - name: table
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Table to use for update operation
            title: Table
          description: Table to use for update operation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateSessionRequest'
              description: Session update data
            examples:
              update_summary:
                summary: Update session summary
                value:
                  summary:
                    summary: The user discussed project planning with the agent.
                    updated_at: '2025-10-21T14:30:00Z'
              update_metadata:
                summary: Update session metadata
                value:
                  metadata:
                    tags:
                      - planning
                      - project
                    priority: high
              update_session_name:
                summary: Update session name
                value:
                  session_name: Updated Session Name
              update_session_state:
                summary: Update session state
                value:
                  session_state:
                    step: completed
                    context: Project planning finished
                    progress: 100
      responses:
        '200':
          description: Session updated successfully
          content:
            application/json:
              schema:
                anyOf:
                  - $ref: '#/components/schemas/AgentSessionDetailSchema'
                  - $ref: '#/components/schemas/TeamSessionDetailSchema'
                  - $ref: '#/components/schemas/WorkflowSessionDetailSchema'
                title: Response Update Session
              examples:
                updated_agent_session:
                  summary: Updated agent session
                  value:
                    agent_session_id: session-123
                    session_id: session-123
                    session_name: Updated Session Name
                    session_summary:
                      summary: The user discussed project planning with the agent.
                      updated_at: '2025-10-21T14:30:00Z'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequestResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UnauthenticatedResponse'
        '403':
          description: 'Insufficient permissions. Required scope(s): sessions:write'
        '404':
          description: Session not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
        '422':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorResponse'
        '500':
          description: Failed to update session
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InternalServerErrorResponse'
      security:
        - {}
        - HTTPBearer: []
components:
  schemas:
    SessionType:
      type: string
      enum:
        - agent
        - team
        - workflow
      title: SessionType
    UpdateSessionRequest:
      properties:
        session_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Session Name
          description: Updated session name
        session_state:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session State
          description: Updated session state
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Updated metadata
        summary:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Summary
          description: Session summary
      type: object
      title: UpdateSessionRequest
    AgentSessionDetailSchema:
      properties:
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: User ID associated with the session
        agent_session_id:
          type: string
          title: Agent Session Id
          description: Unique agent session identifier
        session_id:
          type: string
          title: Session Id
          description: Session identifier
        session_name:
          type: string
          title: Session Name
          description: Human-readable session name
        session_summary:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session Summary
          description: Summary of session interactions
        session_state:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session State
          description: Current state of the session
        agent_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Agent Id
          description: Agent ID used in this session
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
          description: Total tokens used in this session
        agent_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Agent Data
          description: Agent-specific data
        metrics:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metrics
          description: Session metrics
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Additional metadata
        chat_history:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Chat History
          description: Complete chat history
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Session creation timestamp
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Last update timestamp
      type: object
      required:
        - agent_session_id
        - session_id
        - session_name
      title: AgentSessionDetailSchema
    TeamSessionDetailSchema:
      properties:
        session_id:
          type: string
          title: Session Id
          description: Unique session identifier
        session_name:
          type: string
          title: Session Name
          description: Human-readable session name
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: User ID associated with the session
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Id
          description: Team ID used in this session
        session_summary:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session Summary
          description: Summary of team interactions
        session_state:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session State
          description: Current state of the session
        metrics:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metrics
          description: Session metrics
        team_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Team Data
          description: Team-specific data
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Additional metadata
        chat_history:
          anyOf:
            - items:
                additionalProperties: true
                type: object
              type: array
            - type: 'null'
          title: Chat History
          description: Complete chat history
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Session creation timestamp
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Last update timestamp
        total_tokens:
          anyOf:
            - type: integer
            - type: 'null'
          title: Total Tokens
          description: Total tokens used in this session
      type: object
      required:
        - session_id
        - session_name
      title: TeamSessionDetailSchema
    WorkflowSessionDetailSchema:
      properties:
        user_id:
          anyOf:
            - type: string
            - type: 'null'
          title: User Id
          description: User ID associated with the session
        workflow_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Workflow Id
          description: Workflow ID used in this session
        workflow_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Workflow Name
          description: Name of the workflow
        session_id:
          type: string
          title: Session Id
          description: Unique session identifier
        session_name:
          type: string
          title: Session Name
          description: Human-readable session name
        session_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session Data
          description: Complete session data
        session_state:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Session State
          description: Current workflow state
        workflow_data:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Workflow Data
          description: Workflow-specific data
        metadata:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Metadata
          description: Additional metadata
        created_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Created At
          description: Session creation timestamp
        updated_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Updated At
          description: Last update timestamp
      type: object
      required:
        - session_id
        - session_name
      title: WorkflowSessionDetailSchema
    BadRequestResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: BadRequestResponse
      example:
        detail: Bad request
    UnauthenticatedResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: UnauthenticatedResponse
      example:
        detail: Unauthenticated access
    NotFoundResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: NotFoundResponse
      example:
        detail: Not found
    ValidationErrorResponse:
      properties:
        detail:
          anyOf:
            - type: string
            - items:
                $ref: '#/components/schemas/ValidationErrorDetail'
              type: array
          title: Detail
          description: >-
            A single message for an explicitly raised 422, or a list of
            field-level errors for a request-validation failure
      type: object
      required:
        - detail
      title: ValidationErrorResponse
      description: >-
        422 body. Two runtime shapes share this status code, and the same
        endpoint can

        return either, so ``detail`` is typed as their union:


        - FastAPI's request-validation handler emits a **list** of field-level
        errors (built-in
          coercion errors and custom-validator ``ValueError``s alike).
        - A route that raises ``HTTPException(status_code=422, detail="...")``
        for a semantic
          check (e.g. an invalid cron expression) emits a **string** through the HTTPException
          handler.
      example:
        detail:
          - loc:
              - body
              - endpoint
            msg: Value error, Endpoint must be a path, not a full URL
            type: value_error
    InternalServerErrorResponse:
      properties:
        detail:
          type: string
          title: Detail
          description: Human-readable error message
        error_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Id
          description: >-
            Stable identifier for the specific error, present only when the
            error carries one
        error_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Type
          description: Category of the error, present only when the error carries one
      type: object
      required:
        - detail
      title: InternalServerErrorResponse
      example:
        detail: Internal server error
    ValidationErrorDetail:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Loc
          description: Path to the offending field, e.g. ['body', 'endpoint']
        msg:
          type: string
          title: Msg
          description: Human-readable error message
        type:
          type: string
          title: Type
          description: Error type identifier, e.g. 'value_error' or 'missing'
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationErrorDetail
      description: >-
        One field-level error inside a 422 body, matching FastAPI's default
        shape.
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````

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