Skip to content

SessionMessage

Base classes

Name Children Inherits
BaseModel
pydantic.main
!!! abstract "Usage Documentation"

⋔ Inheritance diagram

graph TD
  3099937087["session.SessionMessage"]
  3879467795["main.BaseModel"]
  2751680898["builtins.object"]
  3879467795 --> 3099937087
  2751680898 --> 3879467795

🛈 DocStrings

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.

:fa-brands-github: Show source on GitHub