icecap.infrastructure.communication.rpc
Classes:
-
AgentClient–High-level client for communicating with icecap-agent.
-
AgentClientEventHandler–Callback protocol for handling agent events.
-
AgentConnectionError–Raised when connection to an agent fails or is lost.
-
AgentError–Base exception for agent client errors.
-
AgentTimeoutError–Raised when waiting for a response times out.
AgentClient
Bases: Protocol
High-level client for communicating with icecap-agent.
add_event_handler
add_event_handler(callback: AgentClientEventHandler) -> None
Add an event handler for all received events.
Parameters:
-
(callbackAgentClientEventHandler) –Function to call for each event
close
connect
Connect to the agent.
Parameters:
-
(timeoutfloat, default:5.0) –Connection timeout in seconds
Raises:
-
AgentConnectionError–If connection fails
is_connected
is_connected() -> bool
remove_event_handler
remove_event_handler(callback: AgentClientEventHandler) -> None
send
Send a command and wait for the response event.
Parameters:
-
(commandCommand) –Command protobuf to send
-
(timeoutfloat, default:5.0) –Maximum time to wait for response in seconds (None = wait forever)
Returns:
-
Event–The response event with matching operation_id
Raises:
-
AgentConnectionError–If not connected or connection fails
-
AgentTimeoutError–If no response is received within timeout
Source code in icecap/infrastructure/communication/rpc/interface.py
AgentClientEventHandler
AgentConnectionError
Bases: AgentError
Raised when connection to an agent fails or is lost.
AgentError
Bases: Exception
Base exception for agent client errors.
AgentTimeoutError
Bases: AgentError
Raised when waiting for a response times out.