Typed end to end
Parameters, results, notifications, and server requests follow the pinned Codex schema, including experimental APIs.
A typed app-server client and Node.js transports for streaming conversations, approvals, and tools in your own application.
The client finds Codex, starts the app-server, and streams the reply. Everything else, from state to interface, stays yours.
import { CodexAppServerClient, CodexAppServerStdioTransport } from '@korus-dev/codex-sdk';
const client = new CodexAppServerClient(new CodexAppServerStdioTransport());
client.onNotification('item/agentMessage/delta', ({ params }) => {
process.stdout.write(params.delta);
});
await client.start();
try {
await client.initialize({
clientInfo: { name: 'hello_codex', title: null, version: '1.0.0' },
capabilities: null,
});
const { thread } = await client.request('thread/start', {});
const finished = new Promise<void>(resolve => {
client.onNotification('turn/completed', () => resolve());
});
await client.request('turn/start', {
threadId: thread.id,
input: [{ type: 'text', text: 'Say hello!', text_elements: [] }],
});
await finished;
} finally {
await client.close();
}Follow the full walkthrough β
| If you want to⦠| Read |
|---|---|
| Run your first turn | First conversation |
| Render output as it streams | Stream events |
| Choose how to reach Codex | Connect to Codex |
| Answer approvals and expose your own tools | Approvals and tools |
| Load history and resume work | Threads and turns |
| Survive crashes and dropped connections | Reconnect and recover |
| Sign users in | Authentication |
| Look up a method or type | Protocol inventory |
One layer of three
Codex SDK is the raw protocol layer: typed JSON-RPC, transports, and executable discovery. multi-agent-sdk adds a provider-neutral agent API, and agent-ui-sdk adds Vue conversation components and Electron integration.
This is an independently maintained SDK, separate from OpenAI's official SDKs. The generated protocol targets codex-cli 0.167.0; the running server determines which features are available.