Skip to main content

spawn_acp_session

Function spawn_acp_session 

Source
pub async fn spawn_acp_session<F, C>(
    agent_command: &str,
    init_request: InitializeRequest,
    new_session_request: NewSessionRequest,
    client_factory: F,
) -> Result<AcpSession, AcpClientError>
where F: FnOnce(UnboundedSender<AcpEvent>) -> C + Send + 'static, C: Client + 'static,
Expand description

Spawn an agent subprocess and establish an ACP session.

The handshake (initialize + new_session) runs on a dedicated !Send thread. client_factory creates the ACP Client implementation, receiving the event sender so it can forward protocol events.

For the common auto-approve case, use AutoApproveClient::new:

spawn_acp_session("my-agent", init_req, session_req, AutoApproveClient::new).await