Skip to content

cursors

Class info

Classes

Name Children Inherits
AgentMessageCursorAnchor
aclientp.schema.v2.cursors
**UNSTABLE**: The cursor is next to an agent message.
    AgentThoughtCursorAnchor
    aclientp.schema.v2.cursors
    **UNSTABLE**: The cursor is next to an agent thought.
      CursorCapabilities
      aclientp.schema.v2.cursors
      **UNSTABLE**: The methods that currently accept a cursor.
        CursorCompactionAnchor
        aclientp.schema.v2.cursors
        **UNSTABLE**: The cursor is next to a context compaction.
          CursorForkCapabilities
          aclientp.schema.v2.cursors
          **UNSTABLE**: The cursor can be passed to ``session/fork`` as ``cursorId``.
            CursorMessageAnchor
            aclientp.schema.v2.cursors
            **UNSTABLE**: A cursor anchored to a message; ``type`` names the kind of message.
            CursorToolCallAnchor
            aclientp.schema.v2.cursors
            **UNSTABLE**: The cursor is next to a tool call.
              CursorUpdate
              aclientp.schema.v2.cursors
              **UNSTABLE**: A session cursor upsert, keyed by ``cursor_id``.
                SessionMessageCursorAnchor
                aclientp.schema.v2.cursors
                **UNSTABLE**: The cursor is next to a session-directed message.
                  UnknownCursorAnchor
                  aclientp.schema.v2.cursors
                  **UNSTABLE**: A custom or future anchor kind; the client cannot place such a cursor.
                    UserMessageCursorAnchor
                    aclientp.schema.v2.cursors
                    **UNSTABLE**: The cursor is next to a user message.

                      🛈 DocStrings

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

                      A cursor is anchored next to an entity the client holds (a message, tool call or compaction); its capabilities say which methods accept it, e.g. session/fork with cursorId.

                      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[CursorToolCallAnchor, Tag("tool_call")]
                          | Annotated[CursorCompactionAnchor, Tag("compaction")]
                          | Annotated[UnknownCursorAnchor, Tag(OTHER_TAG)],
                          Discriminator(
                              open_discriminator(
                                  "type",
                                  frozenset({
                                      "user_message",
                                      "agent_message",
                                      "agent_thought",
                                      "session_message",
                                      "tool_call",
                                      "compaction",
                                  }),
                              )
                          ),
                      ]
                      

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

                      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 it and nothing that follows. A client that does not know the value cannot place the cursor.

                      AgentMessageCursorAnchor

                      Bases: CursorMessageAnchor

                      UNSTABLE: The cursor is next to an agent message.

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

                      CursorCapabilities

                      Bases: AnnotatedObject

                      UNSTABLE: The methods that currently accept a cursor.

                      A malformed value counts as no capabilities.

                      Source code in src/aclientp/schema/v2/cursors.py
                      class CursorCapabilities(AnnotatedObject):
                          """**UNSTABLE**: The methods that currently accept a cursor.
                      
                          A malformed value counts as no capabilities.
                          """
                      
                          fork: CursorForkCapabilities | MISSING | None = MISSING
                          """``session/fork`` accepts this cursor."""
                      

                      fork class-attribute instance-attribute

                      fork: CursorForkCapabilities | MISSING | None = MISSING
                      

                      session/fork accepts this cursor.

                      CursorCompactionAnchor

                      Bases: AnnotatedObject

                      UNSTABLE: The cursor is next to a context compaction.

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

                      compaction_id instance-attribute

                      compaction_id: CompactionId
                      

                      The anchored compaction.

                      position instance-attribute

                      On which side of the compaction the cursor is.

                      CursorForkCapabilities

                      Bases: AnnotatedObject

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

                      Source code in src/aclientp/schema/v2/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/v2/cursors.py
                      class CursorMessageAnchor(AnnotatedObject):
                          """**UNSTABLE**: A cursor anchored to a message; ``type`` names the kind of message."""
                      
                          message_id: MessageId
                          """The anchored message."""
                      
                          position: CursorAnchorPosition
                          """On which side of the message the cursor is."""
                      

                      message_id instance-attribute

                      message_id: MessageId
                      

                      The anchored message.

                      position instance-attribute

                      On which side of the message the cursor is.

                      CursorToolCallAnchor

                      Bases: AnnotatedObject

                      UNSTABLE: The cursor is next to a tool call.

                      Source code in src/aclientp/schema/v2/cursors.py
                      class CursorToolCallAnchor(AnnotatedObject):
                          """**UNSTABLE**: The cursor is next to a tool call."""
                      
                          type: Literal["tool_call"] = Field(default="tool_call", init=False)
                      
                          tool_call_id: ToolCallId
                          """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: ToolCallId
                      

                      The anchored tool call.

                      CursorUpdate

                      Bases: AnnotatedObject

                      UNSTABLE: A session cursor upsert, keyed by cursor_id.

                      The first update for a cursor MUST include anchor, which is fixed afterwards. capabilities and _meta are patches: omitted leaves them unchanged, None clears them.

                      Source code in src/aclientp/schema/v2/cursors.py
                      class CursorUpdate(AnnotatedObject):
                          """**UNSTABLE**: A session cursor upsert, keyed by ``cursor_id``.
                      
                          The first update for a cursor MUST include ``anchor``, which is fixed afterwards.
                          ``capabilities`` and ``_meta`` are patches: omitted leaves them unchanged, ``None``
                          clears them.
                          """
                      
                          session_update: Literal["cursor_update"] = Field(default="cursor_update", init=False)
                      
                          cursor_id: CursorId
                          """The agent-owned ID of the cursor, unique within the session."""
                      
                          capabilities: CursorCapabilities | MISSING | None = MISSING
                          """The methods that currently accept the cursor; a new cursor starts with none."""
                      
                          anchor: CursorAnchor | MISSING | None = MISSING
                          """Where the cursor is; required on the first update for a cursor."""
                      

                      anchor class-attribute instance-attribute

                      anchor: CursorAnchor | MISSING | None = MISSING
                      

                      Where the cursor is; required on the first update for a cursor.

                      capabilities class-attribute instance-attribute

                      capabilities: CursorCapabilities | MISSING | None = MISSING
                      

                      The methods that currently accept the cursor; a new cursor starts with none.

                      cursor_id instance-attribute

                      cursor_id: CursorId
                      

                      The agent-owned ID of the cursor, unique within the session.

                      SessionMessageCursorAnchor

                      Bases: CursorMessageAnchor

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

                      Source code in src/aclientp/schema/v2/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)
                      

                      UnknownCursorAnchor

                      Bases: Unknown

                      UNSTABLE: A custom or future anchor kind; the client cannot place such a cursor.

                      Source code in src/aclientp/schema/v2/cursors.py
                      class UnknownCursorAnchor(Unknown):
                          """**UNSTABLE**: A custom or future anchor kind; the client cannot place such a 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/v2/cursors.py
                      class UserMessageCursorAnchor(CursorMessageAnchor):
                          """**UNSTABLE**: The cursor is next to a user message."""
                      
                          type: Literal["user_message"] = Field(default="user_message", init=False)