Choose an integration surface
App server and JSON-RPC
The app server exposes structured requests, responses, notifications, threads, turns, streamed items, configuration, authentication, and approval interactions. It is the appropriate surface for editor integrations or custom clients that need lifecycle control.
Clients initialize a connection, create or resume a thread, start turns, and react to server notifications. Experimental methods require explicit capability negotiation and should not be assumed stable.
Python and TypeScript SDKs
The Python SDK can start threads, run turns, stream progress, and control workspace access. The TypeScript SDK wraps the CLI, exchanges structured JSONL events, supports streamed runs, structured output, image inputs, and thread resume.
Use an SDK when your application needs a language-native API. Use the app server when you need the broad protocol surface or are building a standalone client.
Preserve the security boundary
An integration should expose approval requests instead of bypassing them, pass the intended working directory explicitly, and avoid sending secrets through prompts. Environment and network access should be limited to what the automation needs.
Read the AI coding agent security guide before deploying unattended workflows.
Primary sources: app-server protocol, Python SDK, and TypeScript SDK.
Build on the runtime
Choose a terminal, app-server, Python, or TypeScript integration surface.
Explore Midnight CoderReview source