ACP Integration
API Integration
Learn how to integrate Langcli into your applications via the ACP API
Configuring Other ACP Clients
ACP is an open protocol, and any ACP-compatible client can connect to Langcli. General configuration pattern:
Command: langcli --acp
Arguments: ["--acp"]
Communication: stdin/stdout NDJSON
Protocol Version: ACP v1Custom Client
Use @agentclientprotocol/sdk to quickly build an ACP client:
import { ClientSideConnection, ndJsonStream } from '@agentclientprotocol/sdk'
// Create a connection (spawn langcli --acp as a child process)
const child = spawn('langcli', ['--acp'])
const stream = ndJsonStream(
Writable.toWeb(child.stdin),
Readable.toWeb(child.stdout),
)
const client = new ClientSideConnection(stream)
// Initialize
await client.initialize({ clientCapabilities: {} })
// Create a session
const { sessionId } = await client.newSession({
cwd: '/path/to/project',
})
// Send a prompt
const response = await client.prompt({
sessionId,
prompt: [{ type: 'text', text: 'Hello, explain this project' }],
})
// Listen for session updates
client.on('sessionUpdate', (update) => {
console.log('Update:', update)
})Last Updated