RemoteAgent class provides a client-side proxy that mimics the local Agent interface while communicating with remote agents via HTTP. The connect() function creates these proxies easily.
Import
connect() Function
RemoteAgent proxy.
Parameters
str
required
Full URL to the agent endpoint. The last part of the path is extracted as the
agent_id. Examples: - “https://api.myapp.com/agents/researcher” -
“https://lambda.execute-api.amazonaws.com/prod/worker”
dict[str, str] | None
default:"None"
Optional HTTP headers for authentication or other purposes.
Returns
Examples
RemoteAgent Class
Constructor
connect() instead).
Parameters
HTTPTransport
required
HTTP transport instance for communication.
str
required
Agent ID to communicate with.
Properties
id
Methods
chat
Parameters
str
required
Chat message to send.
AbortSignal | None
default:"None"
Optional abort signal to cancel the request.
Returns
Examples
stream
Parameters
str
required
Chat message to send.
AbortSignal | None
default:"None"
Optional abort signal.
Returns
Examples
events
?stream=events mode and reconstruct
each JSON payload into its public Python event dataclass.
turn.failed is yielded as a typed terminal event. HTTP failures, malformed
wire payloads, and event: error frames raise an exception from the iterator.
call
Parameters
type[T] | None
default:"None"
Optional agent class for type hints. If provided, enables IDE autocomplete for
that agent’s methods.