Skip to content

cursors

Class info

Classes

Name Children Inherits
AgentMessageCursorAnchor
aclientp.schema.cursors
**UNSTABLE**: The cursor is next to an agent message.
    AgentThoughtCursorAnchor
    aclientp.schema.cursors
    **UNSTABLE**: The cursor is next to an agent thought.
      CompactionCursorAnchor
      aclientp.schema.cursors
      **UNSTABLE**: The cursor is next to a context compaction.
        CursorCapabilities
        aclientp.schema.cursors
        **UNSTABLE**: The methods that currently accept a cursor.
          CursorForkCapabilities
          aclientp.schema.cursors
          **UNSTABLE**: The cursor can be passed to ``session/fork`` as ``cursorId``.
            CursorMessageAnchor
            aclientp.schema.cursors
            **UNSTABLE**: A cursor anchored to a message; ``type`` names the kind of message.
            SessionMessageCursorAnchor
            aclientp.schema.cursors
            **UNSTABLE**: The cursor is next to a session-directed message.
              ToolCallCursorAnchor
              aclientp.schema.cursors
              **UNSTABLE**: The cursor is next to a tool call.
                UnknownCursorAnchor
                aclientp.schema.cursors
                **UNSTABLE**: A cursor anchored to a custom or future kind of entity.
                  UserMessageCursorAnchor
                  aclientp.schema.cursors
                  **UNSTABLE**: The cursor is next to a user message.

                    🛈 DocStrings

                    UNSTABLE: Session cursors: named positions in a session's timeline.

                    An Agent announces cursors with cursor_update session updates (only to Clients that advertise session.cursors). A cursor is anchored next to an entity the Client holds (a message, tool call or compaction), and its capabilities say which methods accept it, e.g. session/fork with cursorId.

                    See the Session Cursors RFD.

                    CursorAnchor module-attribute

                    CursorAnchor = Annotated[
                        Annotated[UserMessageCursorAnchor, Tag("user_message")]
                        | Annotated[AgentMessageCursorAnchor, Tag("agent_message")]
                        | Annotated[AgentThoughtCursorAnchor, Tag("agent_thought")]
                        | Annotated[SessionMessageCursorAnchor, Tag("session_message")]
                        | Annotated[ToolCallCursorAnchor, Tag("tool_call")]
                        | Annotated[CompactionCursorAnchor, Tag("compaction")]
                        | Annotated[UnknownCursorAnchor, Tag("unknown")],
                        Discriminator(_anchor_discriminator),
                    ]
                    

                    UNSTABLE: Where a cursor is, relative to an entity the Client holds.

                    A known type with a malformed payload is an error; it does not fall back to :class:UnknownCursorAnchor.

                    CursorAnchorPosition module-attribute

                    CursorAnchorPosition = Literal['before', 'after'] | str
                    

                    UNSTABLE: On which side of the anchored entity the cursor is.

                    before: the history before the cursor excludes the entity. after: it includes the entity and nothing that follows it. Values starting with _ are extensions; a Client that does not recognize the value cannot place the cursor.

                    CursorId module-attribute

                    CursorId = str
                    

                    UNSTABLE: Agent-owned ID of a cursor, unique within its session.

                    Never reused for another position. Clients MUST NOT parse, change or construct it.

                    AgentMessageCursorAnchor

                    Bases: CursorMessageAnchor

                    UNSTABLE: The cursor is next to an agent message.

                    Source code in src/aclientp/schema/cursors.py
                    class AgentMessageCursorAnchor(CursorMessageAnchor):
                        """**UNSTABLE**: The cursor is next to an agent message."""
                    
                        type: Literal["agent_message"] = Field(default="agent_message", init=False)
                    

                    AgentThoughtCursorAnchor

                    Bases: CursorMessageAnchor

                    UNSTABLE: The cursor is next to an agent thought.

                    Source code in src/aclientp/schema/cursors.py
                    class AgentThoughtCursorAnchor(CursorMessageAnchor):
                        """**UNSTABLE**: The cursor is next to an agent thought."""
                    
                        type: Literal["agent_thought"] = Field(default="agent_thought", init=False)
                    

                    CompactionCursorAnchor

                    Bases: AnnotatedObject

                    UNSTABLE: The cursor is next to a context compaction.

                    Source code in src/aclientp/schema/cursors.py
                    class CompactionCursorAnchor(AnnotatedObject):
                        """**UNSTABLE**: The cursor is next to a context compaction."""
                    
                        type: Literal["compaction"] = Field(default="compaction", init=False)
                    
                        compaction_id: str
                        """The ID of the anchored compaction."""
                    
                        position: CursorAnchorPosition
                        """On which side of the compaction the cursor is."""
                    

                    compaction_id instance-attribute

                    compaction_id: str
                    

                    The ID of the anchored compaction.

                    position instance-attribute

                    On which side of the compaction the cursor is.

                    CursorCapabilities

                    Bases: AnnotatedObject

                    UNSTABLE: The methods that currently accept a cursor.

                    Source code in src/aclientp/schema/cursors.py
                    class CursorCapabilities(AnnotatedObject):
                        """**UNSTABLE**: The methods that currently accept a cursor."""
                    
                        fork: CursorForkCapabilities | None = None
                        """``session/fork`` accepts this cursor. ``None`` means unsupported."""
                    

                    fork class-attribute instance-attribute

                    fork: CursorForkCapabilities | None = None
                    

                    session/fork accepts this cursor. None means unsupported.

                    CursorForkCapabilities

                    Bases: AnnotatedObject

                    UNSTABLE: The cursor can be passed to session/fork as cursorId.

                    Source code in src/aclientp/schema/cursors.py
                    class CursorForkCapabilities(AnnotatedObject):
                        """**UNSTABLE**: The cursor can be passed to ``session/fork`` as ``cursorId``."""
                    

                    CursorMessageAnchor

                    Bases: AnnotatedObject

                    UNSTABLE: A cursor anchored to a message; type names the kind of message.

                    Source code in src/aclientp/schema/cursors.py
                    class CursorMessageAnchor(AnnotatedObject):
                        """**UNSTABLE**: A cursor anchored to a message; ``type`` names the kind of message."""
                    
                        message_id: str
                        """The ID of the anchored message."""
                    
                        position: CursorAnchorPosition
                        """On which side of the message the cursor is."""
                    

                    message_id instance-attribute

                    message_id: str
                    

                    The ID of the anchored message.

                    position instance-attribute

                    On which side of the message the cursor is.

                    SessionMessageCursorAnchor

                    Bases: CursorMessageAnchor

                    UNSTABLE: The cursor is next to a session-directed message.

                    Source code in src/aclientp/schema/cursors.py
                    class SessionMessageCursorAnchor(CursorMessageAnchor):
                        """**UNSTABLE**: The cursor is next to a session-directed message."""
                    
                        type: Literal["session_message"] = Field(default="session_message", init=False)
                    

                    ToolCallCursorAnchor

                    Bases: AnnotatedObject

                    UNSTABLE: The cursor is next to a tool call.

                    Source code in src/aclientp/schema/cursors.py
                    class ToolCallCursorAnchor(AnnotatedObject):
                        """**UNSTABLE**: The cursor is next to a tool call."""
                    
                        type: Literal["tool_call"] = Field(default="tool_call", init=False)
                    
                        tool_call_id: str
                        """The ID of the anchored tool call."""
                    
                        position: CursorAnchorPosition
                        """On which side of the tool call the cursor is."""
                    

                    position instance-attribute

                    On which side of the tool call the cursor is.

                    tool_call_id instance-attribute

                    tool_call_id: str
                    

                    The ID of the anchored tool call.

                    UnknownCursorAnchor

                    Bases: AnnotatedObject

                    UNSTABLE: A cursor anchored to a custom or future kind of entity.

                    The raw kind is kept in type; values starting with _ are extensions. A Client that does not recognize it cannot place the cursor.

                    Source code in src/aclientp/schema/cursors.py
                    class UnknownCursorAnchor(AnnotatedObject):
                        """**UNSTABLE**: A cursor anchored to a custom or future kind of entity.
                    
                        The raw kind is kept in ``type``; values starting with ``_`` are extensions.
                        A Client that does not recognize it cannot place the cursor.
                        """
                    
                        type: str
                        """The anchor kind."""
                    

                    type instance-attribute

                    type: str
                    

                    The anchor kind.

                    UserMessageCursorAnchor

                    Bases: CursorMessageAnchor

                    UNSTABLE: The cursor is next to a user message.

                    Source code in src/aclientp/schema/cursors.py
                    class UserMessageCursorAnchor(CursorMessageAnchor):
                        """**UNSTABLE**: The cursor is next to a user message."""
                    
                        type: Literal["user_message"] = Field(default="user_message", init=False)