# Building on the Codex Harness — Dominik Kundel, OpenAI

Dominik Kundel, OpenAI

AI Engineer World's Fair 2026

[Talk page](https://ai.engineer/talks/9WiBJRO84yY-building-on-codex-harness) · [Video](https://www.youtube.com/watch?v=9WiBJRO84yY)

## Building on the Codex Harness

The Codex App Server lets a custom interface use the same agent harness as the Codex app. Dominik Kundel explains the message protocol, customization and packaging choices, then puts the agent inside Doom.

### Build the interface on an existing harness

[0:12](https://www.youtube.com/watch?v=9WiBJRO84yY&t=12s)

Building an agent harness can feel intimidating before you even get to the interface you wanted to make. Dominik Kundel, who works on Codex developer experience at OpenAI, opens with that problem: how can developers build their own interfaces while reusing the machinery that already runs Codex?

The Codex App Server provides a protocol around the Codex harness. Like Agent Client Protocol, or ACP, it gives an application a way to communicate with an agent implementation. Here, the implementation is the same harness behind the Codex app, its IDE integrations and third-party clients. The client can change while the underlying agent machinery stays familiar.

Both the harness and App Server are open source under Apache 2. Developers can inspect or fork them, and the model provider is configurable: Kundel describes support for providers with a Responses API-compatible interface, plus convenience settings for LM Studio and Ollama. That compatibility condition matters; the claim is not that any arbitrary model endpoint can be substituted unchanged.

The JSON-RPC-style protocol already supports several kinds of client. Kundel names the Codex app, VS Code, Xcode and JetBrains integrations, as well as a plugin that lets Claude Code hand tasks to Codex or ask it to review code. These are different entry points into the same harness, rather than separate agent implementations built for each interface.

### A message becomes thread activity and streaming events

[3:13](https://www.youtube.com/watch?v=9WiBJRO84yY&t=193s)

At the protocol level, the application is the client and Codex App Server is the server. The client sends messages to perform actions and receives events describing what happens. To make that exchange concrete, Kundel builds an inspector that intercepts traffic between the real Codex app and its server, then opens the inspector in the app’s browser and sends a message.

The first inspection appears to include old buffered events, so he starts again. The fresh activity gives the reader a useful question to follow: which messages establish the work, and which carry its output? Kundel points out thread-start messages containing configuration and project context, configuration reads, and delta messages carrying streamed data. A response arrives through a sequence of events that a client can render as work progresses.

The protocol exposes considerably more than sending a prompt and collecting text. At the time of the talk, Kundel reports more than 120 client messages, with coverage that includes:

- **Client setup:** initialization and configuration specific to the application.
- **Conversation and task control:** thread modifications, turns and setting a goal for a custom version of goal mode.
- **Application capabilities:** listing plugins, searching files and modifying the filesystem.

This breadth lets a custom client use capabilities that already appear in the Codex app, including streaming and file search.

That specificity is also Kundel’s distinction from ACP. ACP is described as the more generic protocol; App Server exposes controls over individual parts of the Codex harness. It also supports sign-in with ChatGPT, so users of a third-party application can bring their own subscription and consume their Codex usage allowance.

### Add instructions and tools without replacing the base

[6:59](https://www.youtube.com/watch?v=9WiBJRO84yY&t=419s)

Developer instructions provide the first customization layer. They augment Codex’s existing system instructions, which are themselves available in the repository. The recommendation is to add application-specific guidance through this layer, preserving the prompt work OpenAI has done for individual models. The Codex app uses this approach for functionality that differs from the IDE extension or CLI.

Tools provide a separate way to extend what the agent can do. An integration can use MCP or directly define dynamic tools that expose its own functions. Direct tool definitions make application behavior available to the agent: the interface can supply operations beyond the harness’s existing capabilities.

Deferred loading changes how those tools enter the agent’s context. Rather than putting every additional tool into the prompt upfront, deferred tools can be found through tool search. The functions remain available, while their definitions need not all occupy the context window from the start. This is especially useful as an application adds more functions; the mechanism is discovery on demand, rather than a growing inventory injected into every conversation.

Other settings can vary per thread. A client can choose a model provider or model, and control sandbox permissions such as which network connections are available and which files the agent can modify. Instructions, tools and permissions therefore answer different questions: how the agent should behave, what application functions it can call, and what access it has while doing the work.

### Ship the binary and bindings together

[8:28](https://www.youtube.com/watch?v=9WiBJRO84yY&t=508s)

App Server comes in the same binary as the Codex CLI. An existing CLI installation can therefore start it, but the Codex app takes a more controlled packaging approach: it includes the binary in its application bundle and updates that binary with the app. On Windows, it ships both Windows and Linux builds, selecting the Linux binary for WSL mode and the Windows binary for native operation.

The reason to bundle it is version alignment. App Server can generate TypeScript bindings or a JSON schema for a particular version, and the protocol changes between versions. Shipping the binary you built against keeps the client’s expected capabilities aligned with the server’s actual capabilities. Relying on a user’s installed CLI leaves that pairing dependent on when the user last updated.

The available integration choices solve different parts of the job:

- **Transport:** the server supports standard input/output (`stdio`) and WebSockets. Kundel leaves the choice to the application’s use case rather than prescribing one transport for everyone.
- **Python SDK:** the SDK handles much of the lifecycle management and makes features such as sign-in with ChatGPT easier to integrate through a familiar interface.
- **A custom client:** developers can implement the protocol directly, including by asking Codex to build against its documentation.

Kundel’s own example is a Visual Basic client intended to feel native on Windows, which he says Codex built largely in one shot. It illustrates how reusing the harness can shift effort toward the application and its interface. That is a personal implementation result, rather than a measured guarantee about how quickly every client can be built.

### Doom becomes a client—and tools change the game

[11:36](https://www.youtube.com/watch?v=9WiBJRO84yY&t=696s)

A client does not have to be a conventional chat window. The agent might run in the background, respond to an interaction in an existing application, or appear inside a video game. Kundel takes the last option literally: “How can I shove this into video games?” His experiment runs Codex inside Doom.

After a brief window and control-capture problem associated with the dual-monitor setup, the demo works. The client is an Electron app using Cloudflare’s Doom WASM renderer. Most of the game engine is implemented in C, and it loads Freedoom with a game file that Codex has modified. The agent interface renders through the game engine itself, and interaction is passed to App Server using Electron’s IPC mechanism. Saying hello produces a Codex response inside the game.

The more revealing question is what happens when the conversation can change the game. Dynamic tools expose game functions to Codex. Requests for health and armor cause tool calls that grant them; a request for weapons and ammunition triggers further tool calls. The interface displays the conversation, while the tools give that conversation an effect on game state. These requests turn the earlier discussion of application-specific functions into a concrete example.

![Codex reports the granted ammunition, while Doom’s HUD shows 200 health and armor plus filled ammo counters.](https://ai.engineer/api/talk-essay-media/c9fb2995ad0b02d27f86c2b5e865247f6b20fa000d03e23ec377423588e0d689)

Codex reports the granted ammunition, while Doom’s HUD shows 200 health and armor plus filled ammo counters.

The same client still connects to an App Server running on Kundel’s machine. When he asks, “What’s the directory?”, Codex calls a shell, retrieves the current working directory and renders the result in the game. Game tools have been added alongside the harness’s local workspace capabilities. You could do coding work inside Doom, though Kundel’s practical verdict is that the Codex app is probably a better place for it.

### Use codex exec for scripts, App Server for client control

[14:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=883s)

`codex exec` offers another entry point into Codex: a non-interactive command for starting tasks from scripts. Kundel gives a CI/CD workflow that automatically fixes a pull request as an example. When the surrounding system needs to kick off a task, a scripted command can be a suitable integration.

App Server becomes more useful when the application needs a comprehensive agent interface or many concurrent threads. An evaluation harness, for example, can start multiple threads through the protocol instead of building its own orchestration around separate `codex exec` calls. Goal functionality is another reason to use the richer interface. The distinction is the amount of harness control the application needs, including thread creation and task management.

### Three decisions that keep the integration manageable

[15:56](https://www.youtube.com/watch?v=9WiBJRO84yY&t=956s)

The closing advice returns to three implementation decisions, each addressing a different source of trouble:

- **Bundle your own harness version.** Experimental features can change, and users may have older CLIs without the features your client expects. Bundling makes the supported version a choice the application controls.
- **Expose application functions, then mark them deferred.** The Codex app itself exposes functions for actions such as creating automations. Tool search keeps added functions available without putting their full inventory into the context unnecessarily.
- **Start with developer instructions.** Replacing the base system prompt gives up the model-specific tuning already built into the harness. Adding instructions lets the application customize behavior while retaining that work.

The prompt warning is substantive. Kundel describes ongoing work to keep prompts in distribution and the agent performing well. Writing a replacement system prompt means taking responsibility for those concerns yourself. The recommended starting point is to retain the tuned base and add the instructions and functions that make the new application useful.

## Key takeaways

- App Server gives custom clients access to Codex’s harness through action messages and events, including streaming, thread control and file operations.
- Developer instructions preserve the tuned base prompt; deferred dynamic tools add application capabilities that Codex can discover through tool search.
- Bundle the server binary and generate bindings for that version so the client does not depend on the user’s installed CLI being compatible.
- Use codex exec for scripted tasks; use App Server when a client needs richer interaction, goal functionality or control over multiple concurrent threads.

## Slides

### Codex harness via app server

The App Server wraps the Codex harness in a protocol for building interfaces that integrate directly with it.

[0:55](https://www.youtube.com/watch?v=9WiBJRO84yY&t=55s) [A central box labels the Codex harness and app server.](https://assets.ai.engineer/sites/aiecode2025/sha256/34f82902c424ed12e2ee2a6f5380c407bb9c740c98cd6b9364ecd560954dc31d.webp)

CODEX HARNESS
VIA APP SERVER

OpenAI

### Codex repository

The Codex repository is Apache-2.0 licensed. Kundel says you can fork it and connect another model provider with a Responses API-compatible API.

[1:35](https://www.youtube.com/watch?v=9WiBJRO84yY&t=95s) [A GitHub repository page for Codex appears beside a QR code.](https://assets.ai.engineer/sites/aiecode2025/sha256/cbe8707987c3065e8493584306ffc4255a3c359ae361cfbdbb24270f7a2fc904.webp)

OpenAI

Interface text:
Platform
Solutions
Resources
Open Source
Enterprise
Pricing
Search or jump to...
Sign in
Sign up

openai / codex
Public
Notifications
Fork 13.7k
Star 92.8k
Code
Issues 5k+
Pull requests 429
Discussions
Actions
Security and quality 1
Insights

main
4096 Branches
1069 Tags
Go to file
Code

[illegible] and [illegible] [codex] Reject unlowered PowerShell AST ...
[illegible] · 31 minutes ago
7,714 Commits

.codex — core: log AGENTS.md paths as URIs (#28989) — 4 days ago
.devcontainer — build: run buildifier from just fmt (#28125) — last week
.github — ci: restore custom Windows runner with hermetic LLVM 0.7... — 10 hours ago
.vscode — Recommend Bazel VSCode extension. (#25161) — 3 weeks ago
bazel — core: load AGENTS.md from foreign environments (#28958) — 4 days ago
codex-cli — cli: add package path from install context (#26189) — 3 weeks ago
codex-rs — [codex] Reject unlowered PowerShell AST regions (#24092) — 31 minutes ago
docs — [codex] Remove child AGENTS.md prompt experiment (#2... — 4 days ago
patches — ci: restore custom Windows runner with hermetic LLVM 0.7... — 10 hours ago
scripts — Make formatter output quiet on success (#29467) — 2 hours ago
sdk — Make formatter output quiet on success (#29467) — 2 hours ago
third_party — bazel: add PowerShell to Wine test harness (#28120) — last week
tools — build: run buildifier from just fmt (#28125) — last week

About
Lightweight coding agent that runs in your terminal
Readme
Apache-2.0 license
Contributing
Security policy
Activity
Custom properties
92.8k stars
504 watching
13.7k forks
Report repository

Releases 865
0.142.0 Latest
5 hours ago
+ 864 releases

Packages
No packages published

### App server integrations

The Codex harness connects first-party products and third-party IDE integrations through the app server’s JSON-RPC protocol.

[2:16](https://www.youtube.com/watch?v=9WiBJRO84yY&t=136s) [A diagram connects first-party Codex products and third-party integrations to the Codex harness through JSON-RPC.](https://assets.ai.engineer/sites/aiecode2025/sha256/6bed85aeefb65a2070f9ee76b12077f5b858fce132fdfe7eef171a3b4231ab91.webp)

App server

Client
Server

First-party products
Codex Desktop App
Codex TUI/CLI
Codex SSH Connection
JSON-RPC

CODEX HARNESS
VIA APP SERVER

Third-party integrations
JetBrains IDEs
VS Code (Codex)
Xcode
JSON-RPC

OpenAI

### Codex plugin for Claude Code

The Claude Code plugin uses the same Codex app server and harness for code reviews or delegated tasks. The screen shows its installation command.

[2:46](https://www.youtube.com/watch?v=9WiBJRO84yY&t=166s) [A Claude Code terminal shows a Codex plugin installation command beside a QR code.](https://assets.ai.engineer/sites/aiecode2025/sha256/cd45d36f547042fe8cba23144117e78777be315e6d171f9000d756e64ef19ce5.webp)

/plugin install codex@openai-codex

Interface text:
Claude Code
Claude Code v2.1.85
Opus 4.6 · Claude Pro
~/Developer/codex
medium · /effort
OpenAI

### JSON-RPC protocol flow

The client starts a thread and turn with requests; the server sends lifecycle events back, including the user message’s start and completion.

[3:08](https://www.youtube.com/watch?v=9WiBJRO84yY&t=188s) [A client and server exchange requests and events for initialization, threads and turns.](https://assets.ai.engineer/sites/aiecode2025/sha256/345139d2ba4e728346c51eb3d3a0c892196b9a33fdf71368820b61ae034824d1.webp)

JSON-RPC Protocol
How does it work?

Request
Event

CLIENT
SERVER

1 Initialization handshake
2 Thread and turn lifecycle

thread/start
thread/started
turn/start
(input: "run tests and summarize failures")
turn/started
item/started
(user message: {"text": "run tests and summarize failures."})
item/completed
(user message: {"text": "run tests and summarize failures."})

OpenAI

### Codex app server traffic inspector

A custom inspector captures messages between Codex and its app server. Kundel opens it in the Codex app’s browser, where it waits for traffic; an earlier view shows a captured response and its compacted payload.

[3:31](https://www.youtube.com/watch?v=9WiBJRO84yY&t=211s) [An inspector lists app-server messages and displays a compacted response payload.](https://assets.ai.engineer/sites/aiecode2025/sha256/e2ec7380d57c9a04ac252019868f5d7f3bd0e81429c136777e601862cfc9c4b8.webp)

Inspector

Frames
TIME ↓ | FLOW | TYPE | METHOD | ID | SIZE
15:38:50.080 | SERVER → APP | RESPONSE | config/read | 02ee2c… | 280.0 KB
15:38:50.053 | SERVER → APP | RESPONSE | permissionProfile/list | 67d69a… | 255 B
15:38:50.041 | SERVER → APP | RESPONSE | config/read | be9251… | 61.2 KB
15:38:50.041 | SERVER → APP | RESPONSE | permissionProfile/list | 693c00… | 255 B
15:38:50.015 | APP → SERVER | REQUEST | config/read | 02ee2c… | 110 B
15:38:50.015 | APP → SERVER | REQUEST | permissionProfile/list | 67d69a… | 126 B
15:38:50.014 | APP → SERVER | REQUEST | config/read | be9251… | 111 B
15:38:50.014 | APP → SERVER | REQUEST | permissionProfile/list | 693c00… | 127 B
15:38:35.659 | SERVER → APP | RESPONSE | account/read | 73102a… | 168 B
15:38:35.658 | APP → SERVER | REQUEST | account/read | 73102a… | 101 B
15:37:34.069 | SERVER → APP | RESPONSE | hooks/list | 52dfe0… | 138 B
15:37:33.326 | APP → SERVER | REQUEST | hooks/list | 52dfe0… | 115 B
15:33:57.[illegible] | SERVER → APP | RESPONSE | mcpServerStatus/list | ab94f5… | 124.6 KB
15:33:57.486 | SERVER → APP | RESPONSE | mcpServerStatus/list | 80f063… | 124.6 KB
15:33:56.014 | SERVER → APP | RESPONSE | thread/list | 798748… | 9.9 KB
15:33:56.004 | APP → SERVER | REQUEST | thread/list | 798748… | 206 B
15:33:55.979 | SERVER → APP | RESPONSE | configRequirements/read | 82a67c… | 12.5 KB
15:33:55.978 | SERVER → APP | RESPONSE | configRequirements/read | dec7fc… | 12.5 KB
15:33:55.978 | SERVER → APP | RESPONSE | thread/list | c5ad3e… | 9.9 KB

Payload
RESPONSE  server → Codex.app
config/read
Request ID  02ee2ccd-e2a6-4480-a983-7dbcffe8702d
Captured  15:38:50.080
Size  280.0 KB
Session  app-6
Round trip  65 ms
Payload  compacted by relay
REQUEST  config/read  65 ms
JSON PAYLOAD  COMPACTED
{
  "id": "02ee2ccd-e2a6-4480-a983-7dbcffe8702d",
  "result": {
    "viewerNote": "Large result omitted by capture relay",
    "keys": [
      "config",
      "origins",
      "layers"
    ]
  },
  "capture": {
    "truncated": true,
    "originalBytes": 280024
  }
}

Interface text:
relay ready  1 app connection  500 frames
passive capture  ~/.codex-demo

[3:47](https://www.youtube.com/watch?v=9WiBJRO84yY&t=227s) [Codex beside an inspector waiting for app traffic.](https://assets.ai.engineer/sites/aiecode2025/sha256/5ad616348a2cc43ff42c681ddacdd534fab7030e829554da2bb285101f68c8b3.webp)

Inspector

Frames
TIME ↓ | FLOW | TYPE | METHOD | ID
Waiting for Codex.app traffic
Requests and responses will appear after Codex.app connects through the capture relay.

Payload
No frame selected
Send a message from Codex.app, then select a request or response.

Interface text:
Codex  File  Edit  View  Window  Help
Wed Jul 1  3:48 PM
Codex Wire · Nan
127.0.0.1:5174
What should we work on?
Do anything
5.5
Review a PRD
Debug an issue
Summarize updates
Connect your favorite apps to Codex
relay ready  1 app connection  0 frames
passive capture  ~/.codex-demo

### Inspecting a streamed message

After “Hello” is sent in Codex, the inspector shows requests, responses, and notifications. The selected message-delta payload contains the text fragment “ greeting”.

[4:05](https://www.youtube.com/watch?v=9WiBJRO84yY&t=245s) [The inspector displays captured events and a message delta payload beside a Codex conversation.](https://assets.ai.engineer/sites/aiecode2025/sha256/029bc6d64d21a0b720eba6c9d119129974e76a3a6b1d093b1353a146e5fe940d.webp)

Inspector

Frames
TIME ↓ | FLOW | TYPE | METHOD | ID
15:48:35.420 | SERVER → APP | RESPONSE | thread/name/set | 551173...
15:48:35.420 | SERVER → APP | NOTIFICATION | thread/name/upda... | –
15:48:35.406 | SERVER → APP | RESPONSE | thread/list | a45586...
15:48:35.405 | APP → SERVER | REQUEST | thread/list | a45586...
15:48:35.404 | APP → SERVER | REQUEST | thread/name/set | 551173...
15:48:35.402 | SERVER → APP | RESPONSE | thread/list | b16e02...
15:48:35.401 | APP → SERVER | REQUEST | thread/list | b16e02...
15:48:35.399 | SERVER → APP | RESPONSE | thread/unsubscri... | thread...
15:48:35.398 | SERVER → APP | NOTIFICATION | turn/completed | –
15:48:35.398 | APP → SERVER | REQUEST | thread/unsubscri... | thread...
15:48:35.397 | SERVER → APP | NOTIFICATION | thread/status/ch... | –
15:48:35.395 | SERVER → APP | NOTIFICATION | thread/tokenUsag... | –
15:48:35.395 | SERVER → APP | NOTIFICATION | account/rateLimi... | –

Payload
NOTIFICATION  server → Codex.app
item/agentMessage/delta
Request ID  –
Captured  15:48:35.297
Size  231 B
Session  app-6
JSON PAYLOAD  COMPLETE
{
  "method": "item/agentMessage/delta",
  "params": {
    "threadId": "[illegible]",
    "turnId": "[illegible]",
    "itemId": "[illegible]",
    "delta": " greeting"
  }
}

Interface text:
Codex  File  Edit  View  Window  Help
Wed Jul 1 3:48 PM
Respond to gr...
Codex Wire · Nan
127.0.0.1:5174
Hello
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
Ask for follow-up changes
5.5
relay ready  1 app connection  119 frames
passive capture  ~/.codex-demo

### Inspecting Codex app server events

The inspector captures a new thread’s startup and configuration messages, then shows the delta notifications streaming the assistant’s response to the Codex app.

[4:33](https://www.youtube.com/watch?v=9WiBJRO84yY&t=273s) [The inspector shows a thread-start notification and its payload beside a Codex conversation.](https://assets.ai.engineer/sites/aiecode2025/sha256/5df45a38f40e335e4e07144f84483083a764388730968bd9ef20a74c5e954cc7.webp)

Inspector
Frames
TIME ↓ | FLOW | TYPE | METHOD | ID
15:49:03.146 | APP → SERVER | REQUEST | configRequiremen... | 745685...
15:49:03.144 | APP → SERVER | REQUEST | thread/start | thread...
15:49:03.139 | SERVER → APP | RESPONSE | configRequiremen... | 7a7fd8...
15:49:03.135 | APP → SERVER | REQUEST | configRequiremen... | 7a7fd8...
15:49:03.127 | SERVER → APP | RESPONSE | config/read | fb39f2...
15:49:03.118 | APP → SERVER | REQUEST | config/read | fb39f2...
15:49:02.619 | APP → SERVER | RESPONSE | attestation/gene... | 7
15:49:02.607 | SERVER → APP | REQUEST | attestation/gene... | 7
15:49:02.603 | SERVER → APP | RESPONSE | thread/start | df43fc...
15:49:02.603 | SERVER → APP | NOTIFICATION | thread/started | –
15:49:02.501 | APP → SERVER | REQUEST | thread/start | df43fc...
15:49:02.499 | SERVER → APP | RESPONSE | experimentalFeat... | 242410...
15:49:02.489 | SERVER → APP | RESPONSE | model/list | d20e82...

Payload
NOTIFICATION  server → Codex.app
thread/started
Request ID: –
Captured: 15:49:02.603
Size: 657 B
Session: app-6
JSON PAYLOAD  COMPLETE
{
  "method": "thread/started",
  "params": {
    "thread": {
      "id": "[illegible]",
      "sessionId": "[illegible]",
      "forkedFromId": null,
      "parentThreadId": null,
      "preview": "",
      "ephemeral": false,
      "modelProvider": "openai",
      "createdAt": 1782946142,
[remainder not visible]

Interface text:
Codex  File  Edit  View  Window  Help
Greet user
Codex Wire - Nan
127.0.0.1:5174
Hello
Hello! What are we working on today?
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
Ask for follow-up changes
5.5
relay ready  1 app connection  105 frames
passive capture  ~/.codex-demo

[4:52](https://www.youtube.com/watch?v=9WiBJRO84yY&t=292s) [Codex conversation beside an inspector showing agent message notifications and a selected delta payload.](https://assets.ai.engineer/sites/aiecode2025/sha256/82e099b07f57f38a83e0412a3e8847d6e82ec861a40fcc90f6f92b586dc687e3.webp)

Inspector
Frames
TIME ↓ | FLOW | TYPE | METHOD | ID
15:49:05.370 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.356 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.351 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.325 | SERVER → APP | NOTIFICATION | item/started | –
15:49:05.325 | SERVER → APP | NOTIFICATION | item/completed | –
15:49:05.323 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.318 | SERVER → APP | NOTIFICATION | item/started | –
15:49:05.317 | SERVER → APP | NOTIFICATION | item/completed | –
15:49:04.474 | SERVER → APP | NOTIFICATION | item/started | –
15:49:03.822 | SERVER → APP | NOTIFICATION | item/started | –
15:49:03.822 | SERVER → APP | NOTIFICATION | item/completed | –
15:49:03.272 | SERVER → APP | RESPONSE | model/list | a5d9e8...
15:49:03.271 | SERVER → APP | RESPONSE | thread/list | 4efdb2...

Payload
Request ID: –
Captured: 15:49:05.323
Size: 225 B
Session: app-6
JSON PAYLOAD  COMPLETE
{
  "method": "item/agentMessage/delta",
  "params": {
    "threadId": "[illegible]",
    "turnId": "[illegible]",
    "itemId": "[illegible]",
    "delta": "[illegible]"
  }
}

Interface text:
Codex  File  Edit  View  Window  Help
Greet user
Codex Wire - Nan
127.0.0.1:5174
Hello
Hello! What are we working on today?
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
Ask for follow-up changes
5.5
relay ready  1 app connection  105 frames
passive capture  ~/.codex-demo

### Token usage event

The inspector captures a token-usage update with input, cached input, output and reasoning-token counts. Kundel says custom clients can use capabilities exposed through app-server traffic.

[4:56](https://www.youtube.com/watch?v=9WiBJRO84yY&t=296s) [Inspector showing a selected token usage update alongside the completed Codex conversation.](https://assets.ai.engineer/sites/aiecode2025/sha256/682c1d0bdcd5440c21858a27ea73d5b81a3263fdc8714b4a4476c0210e1f011e.webp)

Inspector

Frames
TIME | FLOW | TYPE | METHOD | ID
15:49:05.498 | SERVER → APP | NOTIFICATION | turn/completed | –
15:49:05.497 | SERVER → APP | NOTIFICATION | thread/tokenUsag... | –
15:49:05.468 | SERVER → APP | NOTIFICATION | item/completed | –
15:49:05.407 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.393 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.387 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.370 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.356 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.351 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.325 | SERVER → APP | NOTIFICATION | item/started | –
15:49:05.325 | SERVER → APP | NOTIFICATION | item/completed | –
15:49:05.323 | SERVER → APP | NOTIFICATION | item/agentMessag... | –
15:49:05.318 | SERVER → APP | NOTIFICATION | item/started | –

Payload
JSON PAYLOAD
{
  "method": "thread/tokenUsage/updated",
  "params": {
    "threadId": "[illegible]",
    "turnId": "[illegible]",
    "tokenUsage": {
      "total": {
        "totalTokens": 10485,
        "inputTokens": 10414,
        "cachedInputTokens": 5632,
        "outputTokens": 71,
        "reasoningOutputTokens": 52
      },
      "last": {
        "totalTokens": 10485,
        "inputTokens": 10414,
        "cachedInputTokens": 5632,
        "outputTokens": 71,
        "reasoningOutputTokens": 52
      },
      "modelContextWindow": 258400
    }
  }
}

Interface text:
Codex  File  Edit  View  Window  Help
Wed Jul 1 3:49 PM
Greet user
Codex Wire · Nan
127.0.0.1:5174
Hello
Hello! What are we working on today?
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
Ask for follow-up changes
5.5
relay ready  1 app connection  105 frames
passive capture  ~/.codex-demo

### App server protocol

The app server exposes 120+ client request types, from threads and turns to plugins and file search. Clients can control the agent and authenticate with ChatGPT or an API.

[5:28](https://www.youtube.com/watch?v=9WiBJRO84yY&t=328s) [Slide describing client request types, agent controls and built-in authentication, beside a list of protocol categories.](https://assets.ai.engineer/sites/aiecode2025/sha256/07fee2dce86143d5f65d63a78cbc11f45eafc433f0f39cf6aa2cfd3491d16c7e.webp)

App server protocol

In-depth exposure
120+ different client request types

Agent and capability controls
Events to control goals, memories, plugins, etc. on top of customizations for the agent.

Built-in authentication
Offers support for “Sign in with ChatGPT” to bring your subscription or use API auth.

# Connection
- initialize
- initialized (notification)

# Threads
- thread/start
- thread/fork
- thread/goal/set
- ...
- thread/read
- thread/inject_items

# Turns and review
- turn/start
- turn/steer
- turn/interrupt
- review/start

## Skills and hooks
- skills/list
- ...

## Marketplaces, plugins, and apps
- marketplace/add
- plugin/list
- app/list
- ...

# Filesystem
# Models and features
# MCP
# Account
# Commands and processes
# Configuration and imports
# File search
# Windows sandbox
# Feedback

OpenAI

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Customize the agent

Developers can append instructions, define dynamic tools and change configuration per thread. Deferred loading lets Codex find tools through search instead of placing them in the system prompt.

[6:48](https://www.youtube.com/watch?v=9WiBJRO84yY&t=408s) [Slide describing prompt overrides, dynamic tools, and configuration, alongside a thread-start example.](https://assets.ai.engineer/sites/aiecode2025/sha256/5c663a0d0ecba7097405b7d32ca19abcf19a4472dd7941f75ced02aca9aa6a3d.webp)

Customize the agent

Override prompts
Append guidance using developerInstructions or override the full instructions using baseInstructions.

Bring your own tools
Define dynamic tools for your client and control exposure by deferring discovery.

Control any config
Change the model provider, control sandbox behavior, and more.

{
  "method": "thread/start",
  "id": 10,
  "params": {
    "developerInstructions": "Use get_build_status [illegible] user asks about a build.",
    "dynamicTools": [
      {
        "name": "get_build_status",
        "description": "Returns the current status of a CI build.",
        "deferLoading": true,
        "inputSchema": {
          "type": "object",
          "properties": {
            "buildId": {
              "type": "string",
              "description": "The build identifier."
            }
          },
          "required": ["buildId"],
          "additionalProperties": false
        }
      }
    ]
  }
}

OpenAI

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Using app server

The app server is part of the Codex CLI and uses the same binary, so an existing CLI installation can start it.

[8:39](https://www.youtube.com/watch?v=9WiBJRO84yY&t=519s) [Section slide titled Using app server.](https://assets.ai.engineer/sites/aiecode2025/sha256/2822c0aeccc23fb16e9587a6019f3aee8f861b92eba54be03542c5ccb7a0e712.webp)

Using app server

OpenAI

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Check the bundled Codex CLI version

The Codex app bundles the CLI binary used to run the app server. Here, a version check on the bundled binary returns codex-cli 0.142.4.

[8:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=523s) [Terminal displays a version check for the Codex binary bundled with the app.](https://assets.ai.engineer/sites/aiecode2025/sha256/4bb77daf52683aac1e22ac9d4aae7a8bdf7dbe5436a386f9f902d99dc8fb9b94.webp)

➜  ~  /Applications/Codex.app/Contents/Resources/codex --version
codex-cli 0.142.4

Interface text:
~
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
OpenAI

### App server command help

The app server can generate TypeScript bindings and JSON Schema for its protocol. Kundel says the protocol changes between versions, so generating them for the version being used helps developers build against its capabilities.

[9:34](https://www.youtube.com/watch?v=9WiBJRO84yY&t=574s) [Terminal displays app-server help, including daemon, proxy, and schema generation commands.](https://assets.ai.engineer/sites/aiecode2025/sha256/f5d3c1c3b8a326a3149d1eb94c68d0c3317b3de58ae261144561af630d13d843.webp)

➜  ~ codex app-server --help
[experimental] Run the app server or related tooling

Usage: codex app-server [OPTIONS] [COMMAND]

Commands:
  daemon                Manage the local app-server daemon
  proxy                 Proxy stdio bytes to the running app-server control socket
  generate-ts           [experimental] Generate TypeScript bindings for the app server protocol
  generate-json-schema  [experimental] Generate JSON Schema for the app server protocol
  help                  Print this message or the help of the given subcommand(s)

Options:
  -c, --config <key=value>
          Override a configuration value that would otherwise be loaded from `~/.codex/config.toml`. Use a dotted path (`foo.bar.baz`) to override nested values. The `value` portion is parsed as TOML. If it fails to parse as TOML, the raw string is used as a literal.

          Examples: - `-c model="o3"` - `-c 'sandbox_permissions=["disk-full-read-access"]'` - `-c shell_environment_policy.inherit=all`

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?
OpenAI

### Python SDK

The Python SDK manages the app-server lifecycle and simplifies ChatGPT sign-in. The example starts a workspace-write thread, then runs a read-only review.

[10:24](https://www.youtube.com/watch?v=9WiBJRO84yY&t=624s) [Slide describes the Python SDK's lifecycle and authentication conveniences and shows an installation command and code example.](https://assets.ai.engineer/sites/aiecode2025/sha256/7bea981c0746351782c549d15c47b1a3480978fb773342a7001eee06045a83da.webp)

Option 1
Python SDK

Wraps the Codex app server
No need to manage the app server lifecycle.

Convenience functionality
Easy way to handle the “Sign in with ChatGPT” auth flow.

pip install openai-codex

from openai_codex import Codex, Sandbox

with Codex() as codex:
    thread = codex.thread_start(
        model="gpt-5.5",
        sandbox=Sandbox.workspace_write,
    )
    result = thread.run(
        "Make a plan to diagnose and fix the CI failures",
    )
    print(result.final_response)
    review = thread.run(
        "Review the diff only.",
        sandbox=Sandbox.read_only,
    )

OpenAI

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Just ask Codex

The example asks Codex to build a macOS menu bar chat app using the app server documentation and the Build macOS Apps plugin, with styling modeled on iMessage.

[10:49](https://www.youtube.com/watch?v=9WiBJRO84yY&t=649s) [Slide shows a Codex prompt requesting a native-style macOS menu bar chat app using the app server.](https://assets.ai.engineer/sites/aiecode2025/sha256/b0269a08c80e32c7aa83709af483beb350f06627a01d977b14dbf3e6585ae01c.webp)

Option 2
Just ask Codex

Create a Build macOS Apps menubar chat app using developers.openai.com/codex/app-server. It should feel native using the same styling as iMessage

OpenAI

Interface text:
Approve for me
5.5 Extra High
Choose project
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Be creative!

Kundel suggests using the app server beyond a chat interface: trigger it inside an app, run it in the background, or bring it to unusual hardware and video games.

[11:34](https://www.youtube.com/watch?v=9WiBJRO84yY&t=694s) [A black panel reads “Be creative!” against a blue background.](https://assets.ai.engineer/sites/aiecode2025/sha256/3a21eef76badd554bc29d1857bdbfcc1ff2909db938624a095c04dcc48424a8e.webp)

Be creative!

OpenAI

Interface text:
Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

### Codex in Doom

A Doom scene places a Codex terminal inside the game. Kundel introduces a live demo of running Codex inside Doom.

[12:01](https://www.youtube.com/watch?v=9WiBJRO84yY&t=721s) [A Doom game scene shows a green Codex terminal graphic, with a QR code alongside it.](https://assets.ai.engineer/sites/aiecode2025/sha256/2de6342bb53ade02d348e8b4e6d5d92c032ecf15dfb839c9b000eeae4d6ca2b2.webp)

CODEX 101
AGM

Interface text:
520 AMMO
100% HEALTH
ARMS: 2 3 4 5 6 7
200% ARMOR
400 / 1
300 / 0
100 / 0
520 / 0

Greet user
Hello! What are we working on today?
Respond to greeting
Hello! What are we working on today?

OpenAI

### Codex Doom app

Kundel starts a live Codex-in-Doom demo from a desktop app, then pauses to fix control capture in his dual-monitor setup.

[12:14](https://www.youtube.com/watch?v=9WiBJRO84yY&t=734s) [A macOS desktop shows the Codex Doom app icon.](https://assets.ai.engineer/sites/aiecode2025/sha256/d962053ba343d6c6876bdc60f9dcb26ed675c1a7b8049267fa7b614f53c01455.webp)

Codex Doom.app

Interface text:
Codex Doom
File  Edit  View  Window  Help
US
Wed Jul 1 3:57 PM

### Codex Doom gameplay and terminal

A wall-mounted Codex terminal appears inside the Doom game. Kundel says interacting with it boots Codex and passes requests to the Electron app server through IPC.

[12:54](https://www.youtube.com/watch?v=9WiBJRO84yY&t=774s) [A Doom game window shows a dark corridor and the player's status display.](https://assets.ai.engineer/sites/aiecode2025/sha256/3f1bb7e47b7c9ae63000f15ee45b51b41edbedede3ab864ac0cbc3e67c3c776a.webp)

AMMO
HEALTH 100%
ARMS 2 3 4 5 6 7
ARMOR 0%
50 / 1
300 / 0
1 / 0
50 / 0

Interface text:
Codex Doom  File  Edit  View  Window  Help
Wed Jul 1 3:57 PM

[13:14](https://www.youtube.com/watch?v=9WiBJRO84yY&t=794s) [A green Codex terminal built into a wall in the game.](https://assets.ai.engineer/sites/aiecode2025/sha256/4d3f6f1d142e3d172d02e7d1326fb46e828a5ce4cf027820ac9156ce2c42a21e.webp)

CODEX 101
A

AMMO
HEALTH 100%
ARMS 2 3 4 5 6 7
ARMOR 0%
50 / 1
300 / 0
1 / 0
50 / 0

Interface text:
Codex Doom  File  Edit  View  Window  Help
Wed Jul 1 3:57 PM

### Updating health and armor

Codex calls a game tool to max health and armor at 200; the player then types a request for all weapons and ammo.

[13:55](https://www.youtube.com/watch?v=9WiBJRO84yY&t=835s) [The in-game terminal reports maxed health and armor, and the player types a request for weapons and ammunition.](https://assets.ai.engineer/sites/aiecode2025/sha256/856bd2d7fa1fa5f956aa6338a714c5e7542455bcaca95bb5d9c925a8fb4a1c1e.webp)

C[illegible]TERM-101 | GPT-5.5 | LIVE

change.
> hello
codex> Hello.
> give me max health and armor
codex> Done. Health and armor are both maxed at 200.
[tool] doom_give_vitals [illegible] completed

doom$ give me all the weapons with all ammo_

enter send  sh+enter nl  cmd+up/down  cmd+n

Game HUD:
HEALTH 200%
ARMOR 200%
AMMO
ARMS
50 / 1
300 / 0
1 / 0
50 / 0

Interface text:
Codex Doom  File  Edit  View  Window  Help
Wed Jul 1 3:58 PM

### Adding weapons and ammunition

After the request for all weapons and ammo, Codex completes two weapon calls and four ammunition calls. The Doom HUD shows updated ammunition counts.

[14:07](https://www.youtube.com/watch?v=9WiBJRO84yY&t=847s) [The terminal lists completed weapon and ammunition tool calls above updated game counters.](https://assets.ai.engineer/sites/aiecode2025/sha256/7b218d50b777a5c40959398784168ddd9b439098000addf8552129de4fff4765.webp)

CODEXTERM-101 | GPT-5.5 | LIVE

[tool] doom_give_weapon ? completed
[tool] doom_give_weapon ? completed
[tool] doom_give_ammo ? completed
[tool] doom_give_ammo ? completed
[tool] doom_give_ammo ? completed
[tool] doom_give_ammo ? completed

doom> _

Interface text:
enter send  sh+enter nl  cmd+up/down  cmd+n
AMMO  HEALTH 200%  ARMS 2 3 4 [illegible] 6 7  ARMOR 200%
400 / 1
100 / 0
100 / 0
600 / 0
Codex Doom  File  Edit  View  Window  Help
Wed Jul 1 3:58 PM

### Running a directory command

The in-game terminal runs pwd through zsh after a directory request. The presenter says the app server runs locally and has its own workspace.

[14:10](https://www.youtube.com/watch?v=9WiBJRO84yY&t=850s) [The in-game terminal shows a request for the current directory and a completed shell command.](https://assets.ai.engineer/sites/aiecode2025/sha256/18dadb30dc34740af2c2d8dbd4f6cd9e138e3f92bf3d706de0773c1c01d182f4.webp)

CDEXTERM-101 | GPT-5.5 | LIVE

- Shells: 100
- Rockets: 100
- Cells: 600
> What's the dir
codex> ...
[exec] /bin/zsh -lc pwd [illegible] completed

[illegible] _

Interface text:
enter send  sh+enter nl  cmd+up/down  cmd+n
AMMO  HEALTH 200%  ARMS  ARMOR 200%
Weapon slots: 2 3 4 [illegible] 6 7
400 / 1
100 / 0
100 / 0
600 / 0
Codex Doom  File  Edit  View  Window  Help
Wed Jul 1 3:58 PM

### Tips using app server

Ship your own harness to avoid version surprises, mark added tools as deferred to keep them available without filling context, and add developerInstructions before replacing the base instructions.

[16:03](https://www.youtube.com/watch?v=9WiBJRO84yY&t=963s) [Three tips: ship your own harness, inject dynamic tools as deferred, and prefer developerInstructions to changing the full instructions.](https://assets.ai.engineer/sites/aiecode2025/sha256/a2e5589604b4550629fb77c21123362f9cf23bfd0d2fd2cfa82cc52804bc3271.webp)

Tips using app server

01
Ship your own copy of the harness.

02
Inject dynamic tools as deferred.

03
Prefer using developerInstructions over changing the full instructions.

OpenAI

## Full transcript

[0:12](https://www.youtube.com/watch?v=9WiBJRO84yY&t=12s) All right everyo- hi everyone. Um, I want to start with a quick raise of hands. How many of you have built your own agent harness? All right. How many of you, um, feel like it's way too intimidating to build an agent harness? Okay, cool. So, uh, over the next 18 minutes or so, I wanna talk to you all about how you can actually build on top of the Codex Harness, and hopefully make it a bit easier and less daunting for you to, um, actually build your own interfaces on an a- on an Agent Harness,

[0:42](https://www.youtube.com/watch?v=9WiBJRO84yY&t=42s) and hopefully also a little bit fun. Uh, my name is Dom. I work, uh, at OpenAI on developer experience, specifically for Codex. Um, and I have one more raise of hands. I promise I'm gonna give you all a break. Um, but how many of you have heard of the Codex App Server? All right, this was a bit of a trick question because if you attended the keynote yesterday, all of you should have raised your, your hand, um, otherwise you probably didn't listen to Roman. Um, but, uh, we talked briefly about it yesterday, but we didn't really explain what the app server is.

[1:13](https://www.youtube.com/watch?v=9WiBJRO84yY&t=73s) Um, so the app server's actually the protocol that wraps the Codex Harness. Um, if you've ever looked into something like Agent Client Protocol, this is a very similar concept where basically we have a protocol that allows you to directly build on top of the, uh, harness and deeply integrate into it. And we'll talk a bit in the talk about what the differences are between, uh, App Server and ACP. Uh, the big thing here to keep in mind is both the Codex Harness as well as the App Server itself are open source, so

[1:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=103s) we're gonna cover a couple of different things on how you can engage with it. Um, but more importantly, we're gonna both dive tomorrow in the afternoon into how a couple of these things work behind the scenes. But you can also always just ask Codex to read the repo and dive really deep into it. It's Apache 2 licensed, so feel free to fork it, do it, make it your own and have- have fun with it. You can even connect it to any other model provider as long as they have a responses API capab- uh, compatible API. Uh, we even have, uh, convenience

[2:12](https://www.youtube.com/watch?v=9WiBJRO84yY&t=132s) settings to connect it easily to LM Studio or Ollama. Um, in terms of how it works, the App Server protocol is a JSON RPC style protocol that we actually use to power the Codex app, the IDE extension, uh, our VS code extension, so all of our first party interfaces, but also third-party ones. So if you've ever used Codex through Xcode, JetBrains, IDEs, um, or even some open source projects like Theos T3 Code or Remotex, you can actually... Uh,

[2:42](https://www.youtube.com/watch?v=9WiBJRO84yY&t=162s) all of these are powered by the same harness, the same app server. We even used it earlier this year to put Codex into Claude Code, um, using that same app server. So if you're still on u- uh Claude Code, uh, and you wanna use Codex from there, either to have it review your code or, um, you know, pass off tasks to Codex to handle it, you can actually use that plugin, and it uses that same app server, that same harness behind the scenes. Uh, if you've looked into things like ACP,

[3:13](https://www.youtube.com/watch?v=9WiBJRO84yY&t=193s) this should seem pretty familiar. At a high level, basically the app server, the way it works is we're gonna send messages between the client, which is the application you're building, and the server, which is the Codex App Server, uh, to perform different actions and receive events. But rather than showing you a bunch of hypothetical messages, um, I went a bit overboard and actually built a little inspector that intercepts all of the events between the real Codex app and the, uh, Codex App Server, so we can look at

[3:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=223s) some real events. Um, let me actually switch over here to the Codex app. So I loaded up that same inspector in the, um, in-app browser here of the Codex app. And so if we send a message, we're gonna see here a bunch of different events coming in. Um, this might seem daunting at first, but as you're sort of going through some of these messages, a lot of this should feel relatively familiar. So, um, we can look through here, um,

[4:13](https://www.youtube.com/watch?v=9WiBJRO84yY&t=253s) some of these might be a... Let me do this once more. Um, I think I had some old ones buffered, so just gonna start a new one. Um,

[4:28](https://www.youtube.com/watch?v=9WiBJRO84yY&t=268s) there we go. Also, don't mind my Codex pad up here.  Uh, but you're gonna see like different messages from like threads being started, uh, with sort of your different configurations of what is actually happening, what project are we working on, uh, over to configuration reads, um, where is new threads being started, and then here's like some of your delta messages of like d- uh, data actually being streamed in.

[4:58](https://www.youtube.com/watch?v=9WiBJRO84yY&t=298s) And so there's a lot of additional information that you can find here. And one of the big things that makes this protocol so flexible is that we're really exposing anything that is really in the app, um, a key functionality. Meaning if we're streaming in things, we're doing file search, all of that information is actually handed back and forth between the app server and the, and the app. And so if you're building your own harness, uh, harness integration, your own client, you can actually leverage, uh, the same capabilities.

[5:29](https://www.youtube.com/watch?v=9WiBJRO84yY&t=329s) In fact, we have right now over 120, um, so different client, uh, client messages that we continuously add more to. Um, and this goes from everything from initialization, where you're able to configure some of the more like specific things to your client, um, over thread modifications and, uh, turns, which are sort of the things that you would assume are like the most classic things, but also stu- uh, stuff like setting a goal if you wanna implement your own version of goal

[5:59](https://www.youtube.com/watch?v=9WiBJRO84yY&t=359s) mode- Um, and listing plugins, doing all of the different other aspects that you might see in the app, all the way to things like file search and modific- uh, modifying the file system. So you can really have that full access. We also try to make it easy so that you can, uh, configure the underlying agent, and that's a bit different to ACP, where it's a more s- more, uh, generic protocol. We can actually give you more control over the individual parts of the harness as well through the protocol, and we'll look into that in a second. The other thing that is ex-

[6:29](https://www.youtube.com/watch?v=9WiBJRO84yY&t=389s) exciting for a lot of people is you can actually, you- if you're using this protocol, you can have sign-in with ChatGPT as part of that, meaning that if someone is using your app, they can still bring their own ChatGPT subscription, and it goes off their Codex, uh, use- usage limit. So if you've used something like T3 Code or similar, you're actually using that. In terms of customizing the agent, the mo- the biggest two things then you might wanna look at if you're building on top of this app server is developer

[6:59](https://www.youtube.com/watch?v=9WiBJRO84yY&t=419s) instructions as a way for you to augment the instruction, the system instructions of the actual app, as well as, uh, bringing tools. So with developer instructions, we're actually appending on top of the system prompt of Codex. You can look at the actual system prompt of Codex as well. It's in the repo. Um, but we generally recommend that you actually append to that using the developer instructions. That way, you're still leveraging all of the work that we put into tweaking the prompts for the individual models, while still

[7:28](https://www.youtube.com/watch?v=9WiBJRO84yY&t=448s) customizing it for your specific use case of the harness. This is, for example, what we do when, uh, you load up the Codex app, since there's some functionality that is, uh, more specific for the app over, like, the IDE extension or CLI, for example. And then the other part of this is dynamic tools, where you can expose, uh, additional functions that you wanna, uh, that wa- you want the agent to be able to use. You could use MCP or other things similar to what you would do in, like, the agent client protocol, but you can also just

[7:58](https://www.youtube.com/watch?v=9WiBJRO84yY&t=478s) straight up define tools, and you can actually mark them as deferred loading, which means that rather than injecting them into the system prompt, it, uh, allows Codex to use a tool search tool, which we'll cover more tomorrow in the other session. Um, but it allows it to y- find these tools through tool search rather than polluting the, uh, overall context window. And then on top of that, you can even, on a per-thread basis, modify any other configuration that you might have for your agent. So think about,

[8:28](https://www.youtube.com/watch?v=9WiBJRO84yY&t=508s) uh, setting a different model provider, choosing a different model, or even doing fine grain control on the sandbox, like what network connections, uh, it should have access to or what files it can modify. In terms of how you can actually use the app server, the first thing to, uh, know is that the app server actually comes as part of the Codex CLI. It's the same binary, so if you have the Codex CLI already on your system, you can just, uh, use that to spin up the app server right now.

[8:59](https://www.youtube.com/watch?v=9WiBJRO84yY&t=539s) But you can also look at how we're, for example, shipping it with the Codex app. So the Codex app has the, uh, binary as part of the actual bundle. So if you're looking into your installed Codex app, you should find it in the contents of that bundle, and it changes with every version of the app that you're updating. We're shipping a new version of the CLI behind the scenes. On Windows, we actually ship with two versions of the binary, both the Linux compiled one and the Windows one, so that if you're loading the app in WSL mode, it

[9:29](https://www.youtube.com/watch?v=9WiBJRO84yY&t=569s) uses, uh, the Linux one, and otherwise it starts up the app server in Windows native.

[9:35](https://www.youtube.com/watch?v=9WiBJRO84yY&t=575s) Um, from here, you actually have a lot of different, um, additional convenience functionality. One, you can have Codex generate you, for that particular version of the app server, the TypeScript bindings or the, um, JSON schema, which is incredibly helpful since this, uh, protocol regularly changes between versions, which is also why you actually wanna bundle it with your application, which is what we're doing with the Codex app, so that you have full control over what are the actual capabilities of the version that you're

[10:05](https://www.youtube.com/watch?v=9WiBJRO84yY&t=605s) expecting to build against. Um, in terms of protocols, you can spin up the app server both using standard input output, so stdio, or you can use WebSockets. It's gonna depend on your use case, and honestly, the easiest way to figure out what works better for you is probably to just ask Codex. Um, from here, there's two ways that you can integrate it, um, most easily. The first one is the Python SDK that we recently re- uh, released. It handles a lot of the life

[10:35](https://www.youtube.com/watch?v=9WiBJRO84yY&t=635s) cycle management for you, so you don't have to deal with any of that. And then on top of that, it makes it a bit easier for you to, like, integrate things like sign-in with ChatGPT, and gives you, like, a familiar interface. That being said, we are at an AI engineer conference, so, um, probably most of you are gonna choose option two, which is you just ask Codex. So unsurprisingly, Codex is incredibly good at implementing this protocol, and you largely just have to point it at, um, the documentation. In most cases, you don't even have to do that, but it

[11:05](https://www.youtube.com/watch?v=9WiBJRO84yY&t=665s) sometimes helps it to nudge it. Um, and from here, you can combine it with any of our plugins, like build macOS apps, um, if you wanna quickly spin up something or completely go wild. I used it, for example, to build a client using, um, Visual Basic, uh, to have a, like, truly Windows native app. Um, and it did it largely in one shot. So, uh, you can build really impressive applications with this in a fairly short amount of time without you having to learn all the nitty-gritty parts of buil- building an agent.

[11:36](https://www.youtube.com/watch?v=9WiBJRO84yY&t=696s) The most interesting thing for me with this a- uh, with this app server though is that you're not limited to sort of the classic agent chat interface. You can really be creative, whether it's, um, you-- how you actually, like, trigger it inside of your UI and your existing app, whether you're running it in the background, whether you put it on weird hardware like Maddie does all the time, um , or if you're like me, you think about, "How can I shove this into video games?" Um, and recently, um, I think

[12:06](https://www.youtube.com/watch?v=9WiBJRO84yY&t=726s) like a month ago or so, I thought about, how can I actually run Codex inside of Doom rather than running Doom inside of Codex? Um, and I figured, let's actually do that live, and I'm gonna dismiss a couple of messages here. Uh, so I have this Codex app, Doom version, and I boot it up in the wrong window, so let me pull that over.

[12:29](https://www.youtube.com/watch?v=9WiBJRO84yY&t=749s) There we go.

[12:36](https://www.youtube.com/watch?v=9WiBJRO84yY&t=756s) So this is... Oh, it messed up the controls. My bad. One sec. Something with this, like, dual monitor setup sometimes messes with the control capture. So let's hope that this works better now. Yep. Okay, so this is, um, an Electron app that has, uh, uses Cloudflare's Doom WASM renderer. Um, and it's, uh, so the most of the game engine itself is implemented in,

[13:06](https://www.youtube.com/watch?v=9WiBJRO84yY&t=786s) uh, C, and then it loads the Freedoom game, except that I actually manipula- had Codex change the game file. So you can see here, this is rendered natively in the video game using all of their, that game engine. Um, and if we actually interact with it here, we're booting up Codex, and again, this is rendered natively inside the, um, actual video game, and then passes the, passes it to the app server using Electron's, um, IPC protocol. So if we say hello here,

[13:36](https://www.youtube.com/watch?v=9WiBJRO84yY&t=816s) um, we can see Codex actually responding. So this is using 5.5. The fun part, though, is you can actually use dynamic tools to expose additional functionality. So naturally, um, we can get, um,

[13:53](https://www.youtube.com/watch?v=9WiBJRO84yY&t=833s) we can get all of the, um, armor and health, and it's calling the tools, gives me all that, or even, say, like, all the weapons with all ammo. Um, and it's calling all of the different tools. It's, so it's interacting with them. But again, r-remember, this is still an app server actually running on my machine, so if I say, like,

[14:18](https://www.youtube.com/watch?v=9WiBJRO84yY&t=858s) um, "What's the directory?" It's actually calling zshell, getting the current working directory, and you can see here it's r- uh, rendering. It ha- it has its own workspace. So if you want, you can vibe code directly into code, i-in-inside Doom. Uh, not sure if I would recommend it. Uh, I think the app, uh, the Codex app is slightly better for this. But you can really have fun here and, and implement your own interface.

[14:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=883s) Awesome. Uh, I talked with a couple of you already during the show about, uh, the app server, and one question that came up a lot of times is: What's the difference with Codex Exec? So if you've used the Codex CLI before, you're, might be familiar with this. There's another command called Codex Exec, which spins up a non-interactive interface for you to, uh, pass, uh, to kick off tasks to Codex. This is great for scripting. If you're building a CI/CD implementation and you want to script certain

[15:13](https://www.youtube.com/watch?v=9WiBJRO84yY&t=913s) acts like auto-fixing a PR, um, this is a great opportunity. But if you're trying to build, like, a more comprehensive client, uh, where you're interfacing, uh, where you're showing the agent, or more importantly, if you're trying to do something where you're spinning up a bunch of different, uh, Codex threads at the same time, for example, um, you're running, um, you're, you're running your own, like, eval harness, or you wanna use, like, /goal, that's where the app server really shines because you have that full control

[15:43](https://www.youtube.com/watch?v=9WiBJRO84yY&t=943s) over the harness, and you don't have to figure out your own way of parallelizing all of the Codex Exec calls rather than just sending off a bunch of, like, new thread events and spinning off tasks that way.

[15:56](https://www.youtube.com/watch?v=9WiBJRO84yY&t=956s) Before I let you all go to the keynote, um, I have, uh, three more tips just to recap, um, what we talked about, things that you should keep in mind if you're using the app server. The first one is you should actually ship your own version of the harness. Uh, this will eliminate so many headaches for you. If you're, if you're relying on the user's installed CLI, you're gonna constantly run into things from, uh, like, breaking changes, even though we are trying to minimize them. But if you're relying on experimental features, that might happen. Um, but you

[16:26](https://www.youtube.com/watch?v=9WiBJRO84yY&t=986s) also don't have to worry about whether a user has actually updated their version and has the latest feature that you wanna use or have them nudge the, them updating it. So ship your own version of the harness. The other part is you should absolutely expose new, um, functions as part of your interface. We do this with a Codex app, for example, for it to be able to, um, c-control itself as part of the Codex, uh, thread, like spinning up automations, et cetera. But mark them as deferred. That way, you're not polluting

[16:56](https://www.youtube.com/watch?v=9WiBJRO84yY&t=1016s) the context window unnecessarily with all of the different additional functions that you're adding, and instead, still have them available for the agent without, um, necessarily confusing it. And if you are changing the instructions, try to start with over, uh, like, adding developer instructions rather than changing the base instructions. It might feel like you wanna immediately rush to, "I'm gonna write my own system prompt," but there's a lot of different things that we constantly have to think about when we're building a harness to make sure that the actual

[17:25](https://www.youtube.com/watch?v=9WiBJRO84yY&t=1045s) prompt is in distribution and make sure that the agent performs well. And you're losing out on all of that if you're actually jumping in and, like, writing your own system prompt. So be careful there, uh, if you're doing that. And with that, thank you so much. Uh, thanks for taking your time. Feel free to scan that QR code if you wanna have the slides, and I'll be around for, uh, like, the next 15 minutes at the OpenAI booth if you wanna ask me any questions there. Thank you so much.
