Skip to content

InitializeRequest

Sub classes

Name Children Inherits
InitializeProxyRequest
aclientp.schema.proxy
Request parameters for ``proxy/initialize``. Same as ``initialize``.

    Base classes

    Name Children Inherits
    Request
    aclientp.schema.base
    Base request model.

    â‹” Inheritance diagram

    graph TD
      95970860876208["client_requests.InitializeRequest"]
      95970858197488["base.Request"]
      95970862258240["base.AnnotatedObject"]
      95970862254416["base.Schema"]
      95970851503232["main.BaseModel"]
      125067848591872["builtins.object"]
      95970858197488 --> 95970860876208
      95970862258240 --> 95970858197488
      95970862254416 --> 95970862258240
      95970851503232 --> 95970862254416
      125067848591872 --> 95970851503232

    🛈 DocStrings

    Bases: Request

    Request parameters for the initialize method.

    Sent by the client to establish connection and negotiate capabilities.

    See protocol docs: Initialization

    Source code in src/aclientp/schema/client_requests.py
    class InitializeRequest(Request):
        """Request parameters for the initialize method.
    
        Sent by the client to establish connection and negotiate capabilities.
    
        See protocol docs: [Initialization](https://agentclientprotocol.com/protocol/initialization)
        """
    
        client_capabilities: ClientCapabilities | None = Field(default_factory=ClientCapabilities)
        """Capabilities supported by the client."""
    
        client_info: Implementation | None = None
        """Information about the Client name and version sent to the Agent.
    
        Note: in future versions of the protocol, this will be required.
        """
    
        protocol_version: int
        """The latest protocol version supported by the client."""
    
        @classmethod
        def create(
            cls,
            title: str,
            name: str,
            version: str,
            terminal: bool = True,
            read_text_file: bool = True,
            write_text_file: bool = True,
            protocol_version: int = 1,
            terminal_auth: bool = False,
            prompt_suggestions: bool = False,
            compaction: bool = False,
            notices: bool = False,
            metadata: dict[str, Any] | None = None,
        ) -> Self:
            """Create a new InitializeRequest instance."""
            fs = FileSystemCapabilities(read_text_file=read_text_file, write_text_file=write_text_file)
            auth = AuthCapabilities(terminal=terminal_auth) if terminal_auth else None
            session = ClientSessionCapabilities(
                prompt_suggestions=PromptSuggestionsCapabilities() if prompt_suggestions else None,
                compaction=CompactionCapabilities() if compaction else None,
                notices=NoticeCapabilities() if notices else None,
            )
            caps = ClientCapabilities(terminal=terminal, fs=fs, auth=auth, session=session)
            impl = Implementation(title=title, name=name, version=version)
            return cls(
                client_capabilities=caps,
                client_info=impl,
                protocol_version=protocol_version,
                field_meta=metadata,
            )
    
        @classmethod
        def create_for_package(
            cls,
            package_name: str,
            allow_terminal: bool = True,
            allow_file_operations: bool = True,
            terminal_auth: bool = False,
            prompt_suggestions: bool = False,
            compaction: bool = False,
            notices: bool = False,
            metadata: dict[str, Any] | None = None,
        ) -> InitializeRequest:
            """Create ACP initialize request for app with given name (based on pkg metadata)."""
            from importlib.metadata import metadata as _metadata
    
            pkg_meta = _metadata(package_name)
            return cls.create(
                title=pkg_meta["Name"],
                version=pkg_meta["Version"],
                name=package_name,
                protocol_version=1,
                terminal=allow_terminal,
                read_text_file=allow_file_operations,
                write_text_file=allow_file_operations,
                terminal_auth=terminal_auth,
                prompt_suggestions=prompt_suggestions,
                compaction=compaction,
                notices=notices,
                metadata=metadata,
            )
    

    client_capabilities class-attribute instance-attribute

    client_capabilities: ClientCapabilities | None = Field(default_factory=ClientCapabilities)
    

    Capabilities supported by the client.

    client_info class-attribute instance-attribute

    client_info: Implementation | None = None
    

    Information about the Client name and version sent to the Agent.

    Note: in future versions of the protocol, this will be required.

    protocol_version instance-attribute

    protocol_version: int
    

    The latest protocol version supported by the client.

    create classmethod

    create(
        title: str,
        name: str,
        version: str,
        terminal: bool = True,
        read_text_file: bool = True,
        write_text_file: bool = True,
        protocol_version: int = 1,
        terminal_auth: bool = False,
        prompt_suggestions: bool = False,
        compaction: bool = False,
        notices: bool = False,
        metadata: dict[str, Any] | None = None,
    ) -> Self
    

    Create a new InitializeRequest instance.

    Source code in src/aclientp/schema/client_requests.py
    @classmethod
    def create(
        cls,
        title: str,
        name: str,
        version: str,
        terminal: bool = True,
        read_text_file: bool = True,
        write_text_file: bool = True,
        protocol_version: int = 1,
        terminal_auth: bool = False,
        prompt_suggestions: bool = False,
        compaction: bool = False,
        notices: bool = False,
        metadata: dict[str, Any] | None = None,
    ) -> Self:
        """Create a new InitializeRequest instance."""
        fs = FileSystemCapabilities(read_text_file=read_text_file, write_text_file=write_text_file)
        auth = AuthCapabilities(terminal=terminal_auth) if terminal_auth else None
        session = ClientSessionCapabilities(
            prompt_suggestions=PromptSuggestionsCapabilities() if prompt_suggestions else None,
            compaction=CompactionCapabilities() if compaction else None,
            notices=NoticeCapabilities() if notices else None,
        )
        caps = ClientCapabilities(terminal=terminal, fs=fs, auth=auth, session=session)
        impl = Implementation(title=title, name=name, version=version)
        return cls(
            client_capabilities=caps,
            client_info=impl,
            protocol_version=protocol_version,
            field_meta=metadata,
        )
    

    create_for_package classmethod

    create_for_package(
        package_name: str,
        allow_terminal: bool = True,
        allow_file_operations: bool = True,
        terminal_auth: bool = False,
        prompt_suggestions: bool = False,
        compaction: bool = False,
        notices: bool = False,
        metadata: dict[str, Any] | None = None,
    ) -> InitializeRequest
    

    Create ACP initialize request for app with given name (based on pkg metadata).

    Source code in src/aclientp/schema/client_requests.py
    @classmethod
    def create_for_package(
        cls,
        package_name: str,
        allow_terminal: bool = True,
        allow_file_operations: bool = True,
        terminal_auth: bool = False,
        prompt_suggestions: bool = False,
        compaction: bool = False,
        notices: bool = False,
        metadata: dict[str, Any] | None = None,
    ) -> InitializeRequest:
        """Create ACP initialize request for app with given name (based on pkg metadata)."""
        from importlib.metadata import metadata as _metadata
    
        pkg_meta = _metadata(package_name)
        return cls.create(
            title=pkg_meta["Name"],
            version=pkg_meta["Version"],
            name=package_name,
            protocol_version=1,
            terminal=allow_terminal,
            read_text_file=allow_file_operations,
            write_text_file=allow_file_operations,
            terminal_auth=terminal_auth,
            prompt_suggestions=prompt_suggestions,
            compaction=compaction,
            notices=notices,
            metadata=metadata,
        )
    

    :fa-brands-github: Show source on GitHub