Skip to content

AgentEvents

Base classes

Name Children Inherits
Protocol
typing
Base class for protocol classes.

⋔ Inheritance diagram

graph TD
  107846717106512["connection.AgentEvents"]
  107846686588704["typing.Protocol"]
  107846685555472["typing.Generic"]
  137699722799616["builtins.object"]
  107846686588704 --> 107846717106512
  107846685555472 --> 107846686588704
  137699722799616 --> 107846685555472

🛈 DocStrings

Bases: Protocol

What the UI provides to a connection: handlers for messages from the agent.

Source code in src/acptui/protocol/connection.py
class AgentEvents(Protocol):
    """What the UI provides to a connection: handlers for messages from the agent."""

    def session_update(self, notification: UpdateSessionNotification) -> None:
        """Handle a ``session/update`` (called in the order the agent sent them)."""
        ...

    async def request_permission(
        self, request: RequestPermissionRequest
    ) -> RequestPermissionResponse:
        """Ask the user for permission."""
        ...

    async def create_elicitation(
        self, request: CreateElicitationRequest
    ) -> CreateElicitationResponse:
        """Ask the user for structured input (a form or a URL to visit)."""
        ...

    def complete_elicitation(self, notification: CompleteElicitationNotification) -> None:
        """A URL elicitation was completed."""
        ...

    def auth_status_update(self, notification: AuthStatusUpdateNotification) -> None:
        """The agent's authentication status changed."""
        ...

    def ext_notification(self, method: str, params: JsonValue) -> None:
        """A custom (``_``-prefixed) notification."""
        ...

    def stderr_line(self, line: str) -> None:
        """A line the agent process wrote to stderr."""
        ...

    def traffic(self, direction: str, text: str) -> None:
        """A JSON-RPC message sent (``outgoing``) or received (``incoming``), as JSON text."""
        ...

auth_status_update

auth_status_update(notification: AuthStatusUpdateNotification) -> None

The agent's authentication status changed.

Source code in src/acptui/protocol/connection.py
def auth_status_update(self, notification: AuthStatusUpdateNotification) -> None:
    """The agent's authentication status changed."""
    ...

complete_elicitation

complete_elicitation(notification: CompleteElicitationNotification) -> None

A URL elicitation was completed.

Source code in src/acptui/protocol/connection.py
def complete_elicitation(self, notification: CompleteElicitationNotification) -> None:
    """A URL elicitation was completed."""
    ...

create_elicitation async

create_elicitation(request: CreateElicitationRequest) -> CreateElicitationResponse

Ask the user for structured input (a form or a URL to visit).

Source code in src/acptui/protocol/connection.py
async def create_elicitation(
    self, request: CreateElicitationRequest
) -> CreateElicitationResponse:
    """Ask the user for structured input (a form or a URL to visit)."""
    ...

ext_notification

ext_notification(method: str, params: JsonValue) -> None

A custom (_-prefixed) notification.

Source code in src/acptui/protocol/connection.py
def ext_notification(self, method: str, params: JsonValue) -> None:
    """A custom (``_``-prefixed) notification."""
    ...

request_permission async

request_permission(request: RequestPermissionRequest) -> RequestPermissionResponse

Ask the user for permission.

Source code in src/acptui/protocol/connection.py
async def request_permission(
    self, request: RequestPermissionRequest
) -> RequestPermissionResponse:
    """Ask the user for permission."""
    ...

session_update

session_update(notification: UpdateSessionNotification) -> None

Handle a session/update (called in the order the agent sent them).

Source code in src/acptui/protocol/connection.py
def session_update(self, notification: UpdateSessionNotification) -> None:
    """Handle a ``session/update`` (called in the order the agent sent them)."""
    ...

stderr_line

stderr_line(line: str) -> None

A line the agent process wrote to stderr.

Source code in src/acptui/protocol/connection.py
def stderr_line(self, line: str) -> None:
    """A line the agent process wrote to stderr."""
    ...

traffic

traffic(direction: str, text: str) -> None

A JSON-RPC message sent (outgoing) or received (incoming), as JSON text.

Source code in src/acptui/protocol/connection.py
def traffic(self, direction: str, text: str) -> None:
    """A JSON-RPC message sent (``outgoing``) or received (``incoming``), as JSON text."""
    ...

:fa-brands-github: Show source on GitHub