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

# List Channel Sessions

> Sessions this channel spawned, newest first.



## OpenAPI

````yaml /versions/2.0.6dev/en/deploy/openapi.json get /channels/{channel_id}/sessions
openapi: 3.1.0
info:
  title: AgentScope
  version: 2.0.6dev
servers: []
security: []
paths:
  /channels/{channel_id}/sessions:
    get:
      tags:
        - channels
      summary: List Channel Sessions
      description: Sessions this channel spawned, newest first.
      operationId: list_channel_sessions_channels__channel_id__sessions_get
      parameters:
        - name: channel_id
          in: path
          required: true
          schema:
            type: string
            title: Channel Id
        - name: x-user-id
          in: header
          required: true
          schema:
            type: string
            description: >-
              Caller's user ID. Temporary header-based identity; will be
              replaced by JWT auth.
            title: X-User-Id
          description: >-
            Caller's user ID. Temporary header-based identity; will be replaced
            by JWT auth.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChannelSessionsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ChannelSessionsResponse:
      properties:
        sessions:
          items:
            $ref: '#/components/schemas/SessionRecord'
          type: array
          title: Sessions
        total:
          type: integer
          title: Total
      type: object
      required:
        - sessions
        - total
      title: ChannelSessionsResponse
      description: Sessions a channel has spawned.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    SessionRecord:
      properties:
        id:
          type: string
          title: Id
          description: Unique identifier for the credential.
        updated_at:
          type: string
          format: date-time
          title: Updated At
        created_at:
          type: string
          format: date-time
          title: Created At
        user_id:
          type: string
          title: User Id
        agent_id:
          type: string
          title: Agent Id
        source:
          $ref: '#/components/schemas/SessionSource'
          default: user
        source_schedule_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Schedule Id
        source_chat_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Chat Id
        source_channel_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Source Channel Id
        team_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Team Id
        config:
          $ref: '#/components/schemas/SessionConfig'
        state:
          $ref: '#/components/schemas/AgentState'
      type: object
      required:
        - user_id
        - agent_id
        - config
      title: SessionRecord
      description: The session record.
    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
    SessionSource:
      type: string
      enum:
        - user
        - schedule
        - channel
      title: SessionSource
      description: The source that created the session.
    SessionConfig:
      properties:
        workspace_id:
          type: string
          title: Workspace Id
        name:
          type: string
          title: Name
          description: Display name for the session.
        chat_model_config:
          anyOf:
            - $ref: '#/components/schemas/ChatModelConfig'
            - type: 'null'
        fallback_chat_model_config:
          anyOf:
            - $ref: '#/components/schemas/ChatModelConfig'
            - type: 'null'
        tts_model_config:
          anyOf:
            - $ref: '#/components/schemas/TTSModelConfig'
            - type: 'null'
        knowledge_config:
          anyOf:
            - $ref: '#/components/schemas/SessionKnowledgeConfig'
            - type: 'null'
      type: object
      required:
        - workspace_id
      title: SessionConfig
      description: Session configuration — set at creation, updatable via PATCH.
    AgentState:
      properties:
        session_id:
          type: string
          title: Session Id
        summary:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/TextBlock'
                  - $ref: '#/components/schemas/DataBlock'
              type: array
          title: Summary
          default: ''
        context:
          items:
            $ref: '#/components/schemas/Msg'
          type: array
          title: Context
        reply_context:
          $ref: '#/components/schemas/ReplyContext'
        permission_context:
          $ref: '#/components/schemas/PermissionContext'
        tool_context:
          $ref: '#/components/schemas/ToolContext'
        tasks_context:
          $ref: '#/components/schemas/TaskContext'
        middle_context:
          additionalProperties: true
          type: object
          title: Middle Context
      type: object
      title: AgentState
      description: The agent state that should be saved and loaded from storage.
    ChatModelConfig:
      properties:
        type:
          type: string
          title: Type
        credential_id:
          type: string
          title: Credential Id
        model:
          type: string
          title: Model
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      type: object
      required:
        - type
        - credential_id
        - model
        - parameters
      title: ChatModelConfig
      description: The model configuration class.
    TTSModelConfig:
      properties:
        type:
          type: string
          title: Type
        credential_id:
          type: string
          title: Credential Id
        model:
          type: string
          title: Model
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      type: object
      required:
        - type
        - credential_id
        - model
        - parameters
      title: TTSModelConfig
      description: The TTS model configuration class.
    SessionKnowledgeConfig:
      properties:
        knowledge_base_ids:
          items:
            type: string
          type: array
          title: Knowledge Base Ids
        parameters:
          additionalProperties: true
          type: object
          title: Parameters
      type: object
      title: SessionKnowledgeConfig
      description: |-
        Session-level knowledge base attachment.

        Persists which knowledge bases the agent should retrieve from for
        this session and how the
        :class:`~agentscope.middleware.RAGMiddleware` should be
        configured.  ``parameters`` carries the user-tunable middleware
        fields verbatim (mirrors :attr:`ChatModelConfig.parameters`); the
        accepted keys and value types are described by
        :meth:`RAGMiddleware.Config.model_json_schema`.
    TextBlock:
      properties:
        type:
          type: string
          const: text
          title: Type
          default: text
        text:
          type: string
          title: Text
        id:
          type: string
          title: Id
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - text
      title: TextBlock
      description: The text block.
    DataBlock:
      properties:
        type:
          type: string
          const: data
          title: Type
          default: data
        id:
          type: string
          title: Id
        source:
          anyOf:
            - $ref: '#/components/schemas/Base64Source'
            - $ref: '#/components/schemas/URLSource'
          title: Source
        name:
          anyOf:
            - type: string
            - type: 'null'
          title: Name
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - source
      title: DataBlock
      description: The data block for binary content (images, audio, video, etc.).
    Msg:
      properties:
        name:
          type: string
          title: Name
        content:
          items:
            anyOf:
              - $ref: '#/components/schemas/TextBlock'
              - $ref: '#/components/schemas/ThinkingBlock'
              - $ref: '#/components/schemas/HintBlock'
              - $ref: '#/components/schemas/ToolCallBlock'
              - $ref: '#/components/schemas/ToolResultBlock'
              - $ref: '#/components/schemas/DataBlock'
          type: array
          title: Content
        role:
          type: string
          enum:
            - user
            - assistant
            - system
          title: Role
        id:
          type: string
          title: Id
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          type: string
          title: Created At
        usage:
          anyOf:
            - $ref: '#/components/schemas/Usage'
            - type: 'null'
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
        finished_reason:
          anyOf:
            - $ref: '#/components/schemas/ReplyFinishedReason'
            - type: 'null'
        structured_output:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Structured Output
        error:
          anyOf:
            - $ref: '#/components/schemas/ErrorInfo'
            - type: 'null'
      type: object
      required:
        - name
        - content
        - role
      title: Msg
      description: |-
        The message class in AgentScope, responsible for information storage
        and transmission among different agents.
    ReplyContext:
      properties:
        reply_id:
          type: string
          title: Reply Id
        cur_iter:
          type: integer
          title: Cur Iter
          default: 0
        structured_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Structured Schema
        structured_output:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Structured Output
      type: object
      title: ReplyContext
      description: The context of the current agent reply.
    PermissionContext:
      properties:
        mode:
          $ref: '#/components/schemas/PermissionMode'
          default: default
        working_directories:
          additionalProperties:
            $ref: '#/components/schemas/AdditionalWorkingDirectory'
          type: object
          title: Working Directories
        allow_rules:
          additionalProperties:
            items:
              $ref: '#/components/schemas/PermissionRule'
            type: array
          type: object
          title: Allow Rules
        deny_rules:
          additionalProperties:
            items:
              $ref: '#/components/schemas/PermissionRule'
            type: array
          type: object
          title: Deny Rules
        ask_rules:
          additionalProperties:
            items:
              $ref: '#/components/schemas/PermissionRule'
            type: array
          type: object
          title: Ask Rules
      type: object
      title: PermissionContext
      description: |-
        Context for permission checking.

        Contains the permission mode, working directories, and all configured
        permission rules organized by behavior type (allow, deny, ask).
    ToolContext:
      properties:
        max_cache_files:
          type: integer
          exclusiveMinimum: 1
          title: Max Cache Files
          default: 100
        max_cache_bytes:
          type: number
          exclusiveMinimum: 10000
          title: Max Cache Bytes
          default: 25000
        read_file_cache:
          items:
            $ref: '#/components/schemas/ReadCacheEntry'
          type: array
          title: Read File Cache
        activated_groups:
          items:
            type: string
          type: array
          title: Activated Groups
      type: object
      title: ToolContext
      description: The tool context, e.g. tool cache
    TaskContext:
      properties:
        tasks:
          items:
            $ref: '#/components/schemas/Task'
          type: array
          title: Tasks
      type: object
      title: TaskContext
      description: The task context.
    Base64Source:
      properties:
        type:
          type: string
          const: base64
          title: Type
          default: base64
        data:
          type: string
          title: Data
        media_type:
          type: string
          title: Media Type
      type: object
      required:
        - data
        - media_type
      title: Base64Source
      description: The base64 source.
    URLSource:
      properties:
        type:
          type: string
          const: url
          title: Type
          default: url
        url:
          type: string
          minLength: 1
          format: uri
          title: Url
        media_type:
          type: string
          title: Media Type
      type: object
      required:
        - url
        - media_type
      title: URLSource
      description: The URL source.
    ThinkingBlock:
      properties:
        type:
          type: string
          const: thinking
          title: Type
          default: thinking
        thinking:
          type: string
          title: Thinking
        id:
          type: string
          title: Id
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      additionalProperties: true
      type: object
      required:
        - thinking
      title: ThinkingBlock
      description: |-
        The thinking block.

        Allows extra provider-specific fields (e.g. Anthropic's ``signature``,
        ``redacted_thinking_data``) via ``extra="allow"`` so that model
        implementations can pass arbitrary metadata without subclassing.

        .. note::
            Anthropic's ``redacted_thinking`` blocks are also stored as
            ``ThinkingBlock`` instances with ``thinking=""`` and the
            encrypted payload in the ``redacted_thinking_data`` extra
            field. Callers filtering by ``type=="thinking"`` (e.g.
            ``get_content_blocks``) will receive both visible and
            redacted blocks.
    HintBlock:
      properties:
        type:
          type: string
          const: hint
          title: Type
          default: hint
        hint:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/TextBlock'
                  - $ref: '#/components/schemas/DataBlock'
              type: array
          title: Hint
        id:
          type: string
          title: Id
        source:
          anyOf:
            - type: string
            - type: 'null'
          title: Source
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - hint
      title: HintBlock
      description: |-
        A block used to provide instructions or hints to the LLM during the
        reasoning-acting loop. When passed to the LLM API, the hint block is
        converted into a user message.

        The ``hint`` field can be a plain string (text-only) or a list of
        :class:`TextBlock` / :class:`DataBlock` for multimodal content
        (e.g. a background tool result containing both text and an image).
    ToolCallBlock:
      properties:
        type:
          type: string
          const: tool_call
          title: Type
          default: tool_call
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        input:
          type: string
          title: Input
        state:
          $ref: '#/components/schemas/ToolCallState'
          default: pending
        suggested_rules:
          items:
            $ref: '#/components/schemas/PermissionRule'
          type: array
          title: Suggested Rules
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - id
        - name
        - input
      title: ToolCallBlock
      description: The tool call block.
    ToolResultBlock:
      properties:
        type:
          type: string
          const: tool_result
          title: Type
          default: tool_result
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        output:
          anyOf:
            - type: string
            - items:
                anyOf:
                  - $ref: '#/components/schemas/TextBlock'
                  - $ref: '#/components/schemas/DataBlock'
              type: array
          title: Output
        state:
          $ref: '#/components/schemas/ToolResultState'
          default: running
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          type: string
          title: Created At
        finished_at:
          anyOf:
            - type: string
            - type: 'null'
          title: Finished At
      type: object
      required:
        - id
        - name
        - output
      title: ToolResultBlock
      description: The tool result block.
    Usage:
      properties:
        input_tokens:
          type: integer
          title: Input Tokens
        output_tokens:
          type: integer
          title: Output Tokens
      type: object
      required:
        - input_tokens
        - output_tokens
      title: Usage
      description: The token usage information of a message.
    ReplyFinishedReason:
      type: string
      enum:
        - completed
        - interrupted
        - exceed_max_iters
        - error
      title: ReplyFinishedReason
      description: The reason a reply finished.
    ErrorInfo:
      properties:
        type:
          $ref: '#/components/schemas/ErrorType'
          default: unknown
        message:
          type: string
          title: Message
      type: object
      required:
        - message
      title: ErrorInfo
      description: Structured, UI-facing description of a fatal reply error.
    PermissionMode:
      type: string
      enum:
        - default
        - accept_edits
        - explore
        - bypass
        - dont_ask
      title: PermissionMode
      description: >-
        The mode of permission.


        Permission modes control how the system handles tool execution requests.

        Different modes are suitable for different scenarios:


        +---------------+--------------------------------------------------+--------------------------------+

        | Mode          | Behavior                                         | Use
        Case                       |

        +===============+==================================================+================================+

        | DEFAULT       | Every operation asks for permission unless:      |
        Default mode, most secure      |

        |               | - an allow rule matches, OR                     
        |                                |

        |               | - the tool's ``check_permissions`` explicitly   
        |                                |

        |               |   returns ALLOW for the invocation (currently  
        |                                |

        |               |   only ``Bash`` auto-allows recognized         
        |                                |

        |               |   read-only commands such as ``ls``/``git      
        |                                |

        |               |   status``). Read/Glob/Grep return PASSTHROUGH 
        |                                |

        |               |   and fall through to the default ASK unless   
        |                                |

        |               |   an allow rule matches.                       
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | ACCEPT_EDITS  | - Auto-allow file writes in working directories | User
        present, rapid iteration  |

        |               | - Auto-allow file reads in working directories  |
        development                    |

        |               | - Auto-allow filesystem commands (mkdir, rm,    
        |                                |

        |               |   mv, cp, ...) **only when all target paths**  
        |                                |

        |               |   **resolve inside a working directory**        
        |                                |

        |               | - Other operations follow normal rules          
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | EXPLORE       | Read-only mode:                                  |
        Exploring codebase, planning   |

        |               | - Allow: read-only tools (``Read``/``Grep``/    |
        implementation                 |

        |               |   ``Glob``) and read-only bash commands        
        |                                |

        |               |   (e.g. ``ls``, ``git status``)                 
        |                                |

        |               | - Deny: any modification tool / command        
        |                                |

        |               | - User-configured DENY or ASK rules take        
        |                                |

        |               |   precedence over the read-only auto-allow     
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | BYPASS        | Skip all permission checks except explicit       |
        Sandboxed environments         |

        |               | user-configured deny / ask rules and tool       |
        (container, VM), unattended    |

        |               | DENY. **Safety ASKs from tools are NOT**         |
        runs where you fully trust     |

        |               | **enforced** — including ``rm -rf /``, writes   | the
        agent                      |

        |               | to ``~/.bashrc``, command-injection patterns,   
        |                                |

        |               | etc. Use deny rules to protect specific paths.  
        |                                |

        |               | For unattended runs that still need safety,     
        |                                |

        |               | prefer DONT_ASK.                                
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+

        | DONT_ASK      | Convert every ASK (including safety ASKs and     |
        Scheduled tasks, background    |

        |               | ASK-rule hits) to DENY. Safe-by-default for     |
        execution when user is away    |

        |               | unattended execution.                           
        |                                |

        +---------------+--------------------------------------------------+--------------------------------+


        Attributes:
            DEFAULT: Default mode - explicit permission per action. The
                only auto-allow path is the tool's own ``check_permissions``
                returning ALLOW (currently just ``Bash`` for recognized
                read-only commands like ``ls``/``git status``).
            ACCEPT_EDITS: Accept edits mode - automatically allows file
                edits within working directories (including filesystem
                bash commands whose every target is in a working dir).
            EXPLORE: Explore mode - read-only; modifications are denied.
            BYPASS: Bypass mode - skips safety checks; relies on user
                deny / ask rules as the only guardrail.
            DONT_ASK: Don't ask mode - converts all ASK decisions to DENY
                (for unattended execution).
    AdditionalWorkingDirectory:
      properties:
        path:
          type: string
          title: Path
        source:
          type: string
          title: Source
      type: object
      required:
        - path
        - source
      title: AdditionalWorkingDirectory
      description: |-
        An additional directory included in permission scope.

        Working directories are used to determine which file paths should be
        automatically allowed in ACCEPT_EDITS mode.
    PermissionRule:
      properties:
        tool_name:
          type: string
          title: Tool Name
        rule_content:
          anyOf:
            - type: string
            - type: 'null'
          title: Rule Content
        behavior:
          $ref: '#/components/schemas/PermissionBehavior'
        source:
          type: string
          title: Source
      type: object
      required:
        - tool_name
        - rule_content
        - behavior
        - source
      title: PermissionRule
      description: >-
        Permission rule for tool usage.


        A permission rule defines whether a specific tool or tool operation

        should be allowed, denied, or require user confirmation. The

        rule_content field has different semantics depending on the tool_name:


        - For "Bash": rule_content is a substring pattern matched against the
          command Example: rule_content="npm install" matches "npm install express"

        - For "Write"/"Read": rule_content is a glob pattern matched against
        file
          paths Example: rule_content="src/**" matches "src/main.py"

        - For other tools: rule_content is a tool-specific filter pattern
    ReadCacheEntry:
      properties:
        lines:
          items:
            type: string
          type: array
          title: Lines
        updated_at:
          type: number
          title: Updated At
        bytes:
          type: number
          title: Bytes
        file_path:
          type: string
          title: File Path
      type: object
      required:
        - lines
        - updated_at
        - bytes
        - file_path
      title: ReadCacheEntry
      description: The read file cache.
    Task:
      properties:
        subject:
          type: string
          title: Subject
        description:
          type: string
          title: Description
        metadata:
          additionalProperties: true
          type: object
          title: Metadata
        created_at:
          type: string
          title: Created At
        state:
          type: string
          enum:
            - pending
            - in_progress
            - completed
          title: State
          default: pending
        id:
          type: string
          title: Id
        owner:
          anyOf:
            - type: string
            - type: 'null'
          title: Owner
        blocks:
          items:
            type: string
          type: array
          title: Blocks
        blocked_by:
          items:
            type: string
          type: array
          title: Blocked By
      type: object
      required:
        - subject
        - description
        - metadata
      title: Task
      description: The agent task.
    ToolCallState:
      type: string
      enum:
        - pending
        - asking
        - allowed
        - submitted
        - finished
      title: ToolCallState
      description: The state of the tool call.
    ToolResultState:
      type: string
      enum:
        - success
        - error
        - interrupted
        - denied
        - running
      title: ToolResultState
      description: The tool result state.
    ErrorType:
      type: string
      enum:
        - authentication
        - permission
        - rate_limit
        - invalid_request
        - upstream
        - connection
        - internal
        - setup
        - unknown
      title: ErrorType
      description: |-
        Classification of a fatal error that terminated a reply.

        Not model-specific: the status-derived members apply to any upstream
        service reached during a reply (chat model, embedding, TTS, MCP).
    PermissionBehavior:
      type: string
      enum:
        - allow
        - deny
        - ask
        - passthrough
      title: PermissionBehavior
      description: |-
        The behavior of permission.

        Attributes:
            ALLOW: Allow the operation
            DENY: Deny the operation
            ASK: Ask the user for permission
            PASSTHROUGH: Let the permission engine continue with rule matching
                (used by tools to defer decision to the engine)

````