Skip to content

session

Class info

Classes

Name Children Inherits
SDKSessionInfo
clawd_code_sdk.models.session
Session metadata returned by list_sessions.
    SessionMessage
    clawd_code_sdk.models.session
    A message from a session transcript.

      🛈 DocStrings

      Session objects for storage.

      SDKSessionInfo

      Bases: BaseModel

      Session metadata returned by list_sessions.

      Source code in src/clawd_code_sdk/models/session.py
      class SDKSessionInfo(BaseModel):
          """Session metadata returned by list_sessions."""
      
          model_config = ConfigDict(extra="forbid")
      
          session_id: str
          """Unique session identifier (UUID)."""
      
          summary: str
          """Display title for the session: custom title, auto-generated summary, or first prompt."""
      
          last_modified: int
          """Last modified time in milliseconds since epoch."""
      
          file_size: int | None = None
          """Session file size in bytes."""
      
          custom_title: str | None = None
          """User-set session title via /rename."""
      
          first_prompt: str | None = None
          """First meaningful user prompt in the session."""
      
          git_branch: str | None = None
          """Git branch at the end of the session."""
      
          cwd: str | None = None
          """Working directory for the session."""
      
          tag: str | None = None
          """User-set session tag."""
      
          created_at: int | None = None
          """Creation time in milliseconds since epoch."""
      
          archived: bool | None = None
          """Whether the session has been archived."""
      

      archived class-attribute instance-attribute

      archived: bool | None = None
      

      Whether the session has been archived.

      created_at class-attribute instance-attribute

      created_at: int | None = None
      

      Creation time in milliseconds since epoch.

      custom_title class-attribute instance-attribute

      custom_title: str | None = None
      

      User-set session title via /rename.

      cwd class-attribute instance-attribute

      cwd: str | None = None
      

      Working directory for the session.

      file_size class-attribute instance-attribute

      file_size: int | None = None
      

      Session file size in bytes.

      first_prompt class-attribute instance-attribute

      first_prompt: str | None = None
      

      First meaningful user prompt in the session.

      git_branch class-attribute instance-attribute

      git_branch: str | None = None
      

      Git branch at the end of the session.

      last_modified instance-attribute

      last_modified: int
      

      Last modified time in milliseconds since epoch.

      session_id instance-attribute

      session_id: str
      

      Unique session identifier (UUID).

      summary instance-attribute

      summary: str
      

      Display title for the session: custom title, auto-generated summary, or first prompt.

      tag class-attribute instance-attribute

      tag: str | None = None
      

      User-set session tag.

      SessionMessage

      Bases: BaseModel

      A message from a session transcript.

      Returned by get_session_messages for reading historical session data.

      Source code in src/clawd_code_sdk/models/session.py
      class SessionMessage(BaseModel):
          """A message from a session transcript.
      
          Returned by ``get_session_messages`` for reading historical session data.
          """
      
          type: Literal["user", "assistant", "system"]
          uuid: str
          session_id: str
          message: Any
          # timestamp: str
          parent_tool_use_id: str | None = None
          """For subagent messages: id of the Agent ``tool_use`` in the parent session that spawned
          the subagent (from its ``.meta.json`` sidecar). ``None`` for top-level session messages."""
          parent_agent_id: str | None = None
          """For messages of nested subagents: agent id of the subagent that spawned this one."""
      

      parent_agent_id class-attribute instance-attribute

      parent_agent_id: str | None = None
      

      For messages of nested subagents: agent id of the subagent that spawned this one.

      parent_tool_use_id class-attribute instance-attribute

      parent_tool_use_id: str | None = None
      

      For subagent messages: id of the Agent tool_use in the parent session that spawned the subagent (from its .meta.json sidecar). None for top-level session messages.