AcpAgent

class AcpAgent(val name: String, cwd: String = "/", files: AcpFileSystem? = null, connect: suspend (scope: CoroutineScope) -> Transport) : Closeable(source)

A connection to an Agent Client Protocol agent — a coding agent such as Claude Code, Codex or Gemini CLI, or any agent built on an ACP SDK (e.g. Pydantic AI Harness run_acp_stdio). This app is the ACP client: it creates sessions, sends prompts, renders session/updates and answers session/request_permission (and, when files is given, fs/read_text_file / fs/write_text_file).

The connection opens on first use, is shared by every conversation (AcpBackend) using this agent, and reopens after a failure. Sessions are kept per conversation; a conversation whose session is gone is resumed with session/load when the agent supports it.

Transports: process (stdio, the transport the ACP spec defines) and webSocket (the ACP Kotlin SDK's WebSocket transport, one JSON-RPC message per text frame, for agents on another machine — the spec's remote transport is still a draft).

Parameters

name

shown in the UI until the agent introduces itself in initialize.

cwd

the session's working directory on the agent's machine (absolute, ACP session/new).

files

the client file system offered to the agent; null offers none.

connect

opens a transport; called again after the connection failed.

Constructors

Link copied to clipboard
constructor(name: String, cwd: String = "/", files: AcpFileSystem? = null, connect: suspend (scope: CoroutineScope) -> Transport)

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

Functions

Link copied to clipboard
open override fun close()
Link copied to clipboard
suspend fun displayName(): String

The agent's display name: its agentInfo title or name, else name.

Link copied to clipboard
suspend fun info(): AgentInfo

What the agent said about itself in initialize (connects if needed).