Skip to content

common

Class info

Classes

Name Children Inherits
Annotations
aclientp.schema.v2.common
Hints for the client on how an object is used or displayed.
    Cost
    aclientp.schema.v2.common
    Cumulative cost of a session.
      EnvVariable
      aclientp.schema.v2.common
      An environment variable to set when launching a process.
        Error
        aclientp.schema.v2.common
        A JSON-RPC error object.
          HttpHeader
          aclientp.schema.v2.common
          An HTTP header to send with requests.
            Icon
            aclientp.schema.v2.common
            An optionally sized icon a user interface can display.
              Implementation
              aclientp.schema.v2.common
              Name and version of a client or agent implementation.
                SessionNotFoundErrorData
                aclientp.schema.v2.common
                Data of the ``-32002`` (Resource not found) error for an unknown or inactive session.
                  UnsupportedProtocolVersionErrorData
                  aclientp.schema.v2.common
                  Data of the ``-32022`` (Unsupported protocol version) error.
                    Usage
                    aclientp.schema.v2.common
                    **UNSTABLE**: Token usage of the foreground work that just completed (not cumulative).

                      🛈 DocStrings

                      Shared v2 types: identifiers, errors, implementation info, usage and annotations.

                      AbsolutePath module-attribute

                      AbsolutePath = str
                      

                      An absolute filesystem path.

                      AuthMethodId module-attribute

                      AuthMethodId = str
                      

                      Unique identifier of an authentication method.

                      CompactionId module-attribute

                      CompactionId = str
                      

                      Unique identifier of a context compaction within a session.

                      CursorId module-attribute

                      CursorId = str
                      

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

                      ERROR_CODES module-attribute

                      ERROR_CODES: dict[int, str] = {
                          PARSE_ERROR: "Parse error",
                          INVALID_REQUEST: "Invalid request",
                          METHOD_NOT_FOUND: "Method not found",
                          INVALID_PARAMS: "Invalid params",
                          INTERNAL_ERROR: "Internal error",
                          REQUEST_CANCELLED: "Request cancelled",
                          AUTH_REQUIRED: "Authentication required",
                          RESOURCE_NOT_FOUND: "Resource not found",
                          UNSUPPORTED_PROTOCOL_VERSION: "Unsupported protocol version",
                      }
                      

                      Error codes the protocol defines, with their standard messages.

                      ElicitationId module-attribute

                      ElicitationId = str
                      

                      Unique identifier of an elicitation.

                      ErrorCode module-attribute

                      ErrorCode = int
                      

                      A JSON-RPC error code: one of :data:ERROR_CODES or another integer.

                      ErrorData module-attribute

                      Data of an :class:Error: a shape ACP defines, or any other value.

                      IconTheme module-attribute

                      IconTheme = Literal['light', 'dark'] | str
                      

                      Theme an icon is designed for. Values starting with _ are extensions.

                      IdempotencyKey module-attribute

                      IdempotencyKey = str
                      

                      Client-chosen key that makes a session/prompt retry insert at most one message.

                      McpRequestId module-attribute

                      McpRequestId = str
                      

                      UNSTABLE: Identifier of an MCP request carried over ACP.

                      McpServerAcpId module-attribute

                      McpServerAcpId = str
                      

                      UNSTABLE: Identifier of an MCP server provided over ACP.

                      MediaType module-attribute

                      MediaType = str
                      

                      A MIME type, e.g. image/png.

                      MessageId module-attribute

                      MessageId = str
                      

                      Unique identifier of a message within a session.

                      PermissionOptionId module-attribute

                      PermissionOptionId = str
                      

                      Unique identifier of a permission option.

                      PlanId module-attribute

                      PlanId = str
                      

                      Unique identifier of a plan within a session.

                      ProtocolVersion module-attribute

                      ProtocolVersion = int
                      

                      An ACP protocol version number.

                      ProviderId module-attribute

                      ProviderId = str
                      

                      UNSTABLE: Unique identifier of an LLM provider.

                      RequestId module-attribute

                      RequestId = int | str
                      

                      A JSON-RPC request ID. Unlike base JSON-RPC, it MUST NOT be null.

                      Role module-attribute

                      Role = Literal['assistant', 'user'] | str
                      

                      Sender or recipient in a conversation. Values starting with _ are extensions.

                      SessionConfigGroupId module-attribute

                      SessionConfigGroupId = str
                      

                      Unique identifier of a group of select config option values.

                      SessionConfigId module-attribute

                      SessionConfigId = str
                      

                      Unique identifier of a session config option.

                      SessionConfigValueId module-attribute

                      SessionConfigValueId = str
                      

                      Unique identifier of a value of a select config option.

                      SessionId module-attribute

                      SessionId = str
                      

                      Unique identifier of a session.

                      SessionListCursor module-attribute

                      SessionListCursor = str
                      

                      Opaque pagination cursor of session/list.

                      TerminalId module-attribute

                      TerminalId = str
                      

                      Unique identifier of a display terminal within a session.

                      ToolCallId module-attribute

                      ToolCallId = str
                      

                      Unique identifier of a tool call within a session.

                      Annotations

                      Bases: AnnotatedObject

                      Hints for the client on how an object is used or displayed.

                      Source code in src/aclientp/schema/v2/common.py
                      class Annotations(AnnotatedObject):
                          """Hints for the client on how an object is used or displayed."""
                      
                          audience: Sequence[Role] | MISSING | None = MISSING
                          """Intended recipients, such as the user or the assistant."""
                      
                          last_modified: str | MISSING | None = MISSING
                          """When the underlying resource was last modified (ISO 8601)."""
                      
                          priority: float | MISSING | None = Field(default=MISSING, ge=0, le=1)
                          """Importance from 0 (least) to 1 (most important)."""
                      

                      audience class-attribute instance-attribute

                      audience: Sequence[Role] | MISSING | None = MISSING
                      

                      Intended recipients, such as the user or the assistant.

                      last_modified class-attribute instance-attribute

                      last_modified: str | MISSING | None = MISSING
                      

                      When the underlying resource was last modified (ISO 8601).

                      priority class-attribute instance-attribute

                      priority: float | MISSING | None = Field(default=MISSING, ge=0, le=1)
                      

                      Importance from 0 (least) to 1 (most important).

                      Cost

                      Bases: AnnotatedObject

                      Cumulative cost of a session.

                      Source code in src/aclientp/schema/v2/common.py
                      class Cost(AnnotatedObject):
                          """Cumulative cost of a session."""
                      
                          amount: float
                          """Total cumulative cost."""
                      
                          currency: str
                          """Unit of ``amount``: an ISO 4217 code such as ``USD``, or another unit such as ``credits``."""
                      

                      amount instance-attribute

                      amount: float
                      

                      Total cumulative cost.

                      currency instance-attribute

                      currency: str
                      

                      Unit of amount: an ISO 4217 code such as USD, or another unit such as credits.

                      EnvVariable

                      Bases: AnnotatedObject

                      An environment variable to set when launching a process.

                      Source code in src/aclientp/schema/v2/common.py
                      class EnvVariable(AnnotatedObject):
                          """An environment variable to set when launching a process."""
                      
                          name: str
                          """Name of the variable."""
                      
                          value: str
                          """Value of the variable."""
                      

                      name instance-attribute

                      name: str
                      

                      Name of the variable.

                      value instance-attribute

                      value: str
                      

                      Value of the variable.

                      Error

                      Bases: Schema

                      A JSON-RPC error object.

                      Source code in src/aclientp/schema/v2/common.py
                      class Error(Schema):
                          """A JSON-RPC error object."""
                      
                          code: ErrorCode
                          """The error type, e.g. :data:`INVALID_PARAMS`."""
                      
                          message: str
                          """A short, single-sentence description of the error."""
                      
                          data: ErrorData | MISSING | None = MISSING
                          """Additional information about the error."""
                      

                      code instance-attribute

                      code: ErrorCode
                      

                      The error type, e.g. :data:INVALID_PARAMS.

                      data class-attribute instance-attribute

                      data: ErrorData | MISSING | None = MISSING
                      

                      Additional information about the error.

                      message instance-attribute

                      message: str
                      

                      A short, single-sentence description of the error.

                      HttpHeader

                      Bases: AnnotatedObject

                      An HTTP header to send with requests.

                      Source code in src/aclientp/schema/v2/common.py
                      class HttpHeader(AnnotatedObject):
                          """An HTTP header to send with requests."""
                      
                          name: str
                          """Name of the header."""
                      
                          value: str
                          """Value of the header."""
                      

                      name instance-attribute

                      name: str
                      

                      Name of the header.

                      value instance-attribute

                      value: str
                      

                      Value of the header.

                      Icon

                      Bases: AnnotatedObject

                      An optionally sized icon a user interface can display.

                      Source code in src/aclientp/schema/v2/common.py
                      class Icon(AnnotatedObject):
                          """An optionally sized icon a user interface can display."""
                      
                          src: str
                          """URI of the icon. MUST be an ``https:`` or ``data:`` URI."""
                      
                          mime_type: MediaType | MISSING | None = MISSING
                          """MIME type override, if the source's type is missing or generic."""
                      
                          sizes: Sequence[str] | MISSING | None = MISSING
                          """Sizes the icon can be used at, each ``WxH`` (e.g. ``48x48``) or ``any``."""
                      
                          theme: IconTheme | MISSING | None = MISSING
                          """Theme the icon is designed for; omitted means not theme-specific."""
                      

                      mime_type class-attribute instance-attribute

                      mime_type: MediaType | MISSING | None = MISSING
                      

                      MIME type override, if the source's type is missing or generic.

                      sizes class-attribute instance-attribute

                      sizes: Sequence[str] | MISSING | None = MISSING
                      

                      Sizes the icon can be used at, each WxH (e.g. 48x48) or any.

                      src instance-attribute

                      src: str
                      

                      URI of the icon. MUST be an https: or data: URI.

                      theme class-attribute instance-attribute

                      theme: IconTheme | MISSING | None = MISSING
                      

                      Theme the icon is designed for; omitted means not theme-specific.

                      Implementation

                      Bases: AnnotatedObject

                      Name and version of a client or agent implementation.

                      Source code in src/aclientp/schema/v2/common.py
                      class Implementation(AnnotatedObject):
                          """Name and version of a client or agent implementation."""
                      
                          name: str
                          """Programmatic name; also the display name if ``title`` is not set."""
                      
                          title: str | MISSING | None = MISSING
                          """Human-readable name for user interfaces."""
                      
                          version: str
                          """Version of the implementation, e.g. ``1.0.0``."""
                      

                      name instance-attribute

                      name: str
                      

                      Programmatic name; also the display name if title is not set.

                      title class-attribute instance-attribute

                      title: str | MISSING | None = MISSING
                      

                      Human-readable name for user interfaces.

                      version instance-attribute

                      version: str
                      

                      Version of the implementation, e.g. 1.0.0.

                      SessionNotFoundErrorData

                      Bases: AnnotatedObject

                      Data of the -32002 (Resource not found) error for an unknown or inactive session.

                      Source code in src/aclientp/schema/v2/common.py
                      class SessionNotFoundErrorData(AnnotatedObject):
                          """Data of the ``-32002`` (Resource not found) error for an unknown or inactive session."""
                      
                          session_id: SessionId
                          """The session ID from the request."""
                      

                      session_id instance-attribute

                      session_id: SessionId
                      

                      The session ID from the request.

                      UnsupportedProtocolVersionErrorData

                      Bases: AnnotatedObject

                      Data of the -32022 (Unsupported protocol version) error.

                      Source code in src/aclientp/schema/v2/common.py
                      class UnsupportedProtocolVersionErrorData(AnnotatedObject):
                          """Data of the ``-32022`` (Unsupported protocol version) error."""
                      
                          requested: ProtocolVersion
                          """The protocol version the Client requested."""
                      
                          supported: Sequence[ProtocolVersion]
                          """The protocol versions the Agent supports."""
                      

                      requested instance-attribute

                      requested: ProtocolVersion
                      

                      The protocol version the Client requested.

                      supported instance-attribute

                      supported: Sequence[ProtocolVersion]
                      

                      The protocol versions the Agent supports.

                      Usage

                      Bases: AnnotatedObject

                      UNSTABLE: Token usage of the foreground work that just completed (not cumulative).

                      Source code in src/aclientp/schema/v2/common.py
                      class Usage(AnnotatedObject):
                          """**UNSTABLE**: Token usage of the foreground work that just completed (not cumulative)."""
                      
                          total_tokens: int = Field(ge=0)
                          """Sum of all token types."""
                      
                          input_tokens: int = Field(ge=0)
                          """Input tokens."""
                      
                          output_tokens: int = Field(ge=0)
                          """Output tokens."""
                      
                          thought_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                          """Thought/reasoning tokens, if reported."""
                      
                          cached_read_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                          """Cache read tokens, if reported."""
                      
                          cached_write_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                          """Cache write tokens, if reported."""
                      

                      cached_read_tokens class-attribute instance-attribute

                      cached_read_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                      

                      Cache read tokens, if reported.

                      cached_write_tokens class-attribute instance-attribute

                      cached_write_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                      

                      Cache write tokens, if reported.

                      input_tokens class-attribute instance-attribute

                      input_tokens: int = Field(ge=0)
                      

                      Input tokens.

                      output_tokens class-attribute instance-attribute

                      output_tokens: int = Field(ge=0)
                      

                      Output tokens.

                      thought_tokens class-attribute instance-attribute

                      thought_tokens: int | MISSING | None = Field(default=MISSING, ge=0)
                      

                      Thought/reasoning tokens, if reported.

                      total_tokens class-attribute instance-attribute

                      total_tokens: int = Field(ge=0)
                      

                      Sum of all token types.