How microsoft/copilot-sdk works
This is a multi-language SDK for embedding the Copilot agent runtime in applications. The principal workflow is application → client startup/runtime connection → JSON-RPC session creation or resume → message submission and session events. Session support also exposes tools, filesystem callbacks, canvas, permissions and hooks; model HTTP/WebSocket interception and workflow APIs are distinct capabilities. The README documents in-process C-ABI hosting and optional process/server connections. Source excerpts and index entries support several binding-level links, but unsampled implementations and some cross-binding details are represented only at subsystem level.
Main entry points: client.ts Client API · JsonRpcClient.java JSON-RPC transport · client.py Python client · session.ts Session API
Components 23
SDK clients
- Client API
nodejs/src/client.ts - Python client
python/copilot/client.py - .NET client
dotnet/src/Client.cs - Java host manager
java/sdk/src/main/java/com/microsoft/copilot/AhpHostManager.java - Rust client
rust/src/lib.rs
Sessions and agent features
- Session API
nodejs/src/session.ts - Python session
python/copilot/session.py - Session filesystem
dotnet/src/ResolvingSessionFsHandler.cs - Canvas
nodejs/src/canvas.ts - Tool sets
nodejs/src/toolSet.ts - Workflows
nodejs/src/workflow.ts
Runtime connections
- Native runtime host
dotnet/src/FfiRuntimeHost.cs - Java runtime manager
java/sdk/src/main/java/com/microsoft/copilot/CliServerManager.java - Copilot runtime
Protocol and events
- JSON-RPC transport
java/sdk/src/main/java/com/microsoft/copilot/JsonRpcClient.java - Request router
rust/src/router.rs - Session event types
python/copilot/_generated/session_events.py - Protocol types
rust/src/types.rs
Host integrations
- Model request handler
rust/src/copilot_request_handler.rs - Python request handler
python/copilot/copilot_request_handler.py - Authentication providers
dotnet/src/BearerTokenProvider.cs - Host callbacks
dotnet/src/HostCallbacks.cs
Other components
- Application
Connections 27
- Application → Client API: uses
README.md - Application → Python client: uses
README.md - Application → .NET client: uses
README.md - Application → Java host manager: uses
README.md - Application → Rust client: uses
README.md - Client API → Session API: creates sessions
nodejs/src/client.ts - Client API → Native runtime host: loads runtime
nodejs/src/client.ts - Python client → Python session: manages sessions
python/copilot/client.py - Python client → Python request handler: registers handler
python/copilot/client.py - .NET client → Native runtime host: hosts runtime
dotnet/src/Client.cs - Java host manager → JSON-RPC transport: starts host
java/sdk/src/main/java/com/microsoft/copilot/AhpHostManager.java - Java runtime manager → JSON-RPC transport: uses transport
java/sdk/src/main/java/com/microsoft/copilot/CliServerManager.java - Rust client → Request router: routes requests
rust/src/lib.rs - Native runtime host → Copilot runtime: loads in process
README.md - Java runtime manager → Copilot runtime: connects runtime
README.md - Copilot runtime → JSON-RPC transport: exchanges messages
README.md - Session API → JSON-RPC transport: sends session requests
- Python session → Session filesystem: uses callbacks
- Request router → Protocol types: routes typed payloads
rust/src/router.rs - Session API → Session event types: handles events
- Client API → Canvas: exposes feature
nodejs/src/client.ts - Client API → Tool sets: configures tools
nodejs/src/client.ts - Client API → Workflows: exports workflow API
nodejs/src/index.ts - Copilot runtime → Model request handler: dispatches model traffic
rust/src/copilot_request_handler.rs - Copilot runtime → Python request handler: requests model handling
- Client API → Authentication providers: configures credentials
nodejs/src/client.ts - Client API → Host callbacks: wires callbacks