Skip to slide
Chapter 3 · Building the Prompt
19 / 142

CHAPTER 03 · Building the Prompt · 5 / 5

Key takeaways

  • A model request has three parts worth knowing: layered instructions, a list of tools (JSON schemas), and an input list of structured conversation items.
  • Roles carry authority, in order: system, developer, user, assistant.
  • Store history as typed items, and link each tool call to its result with a shared call_id so the model understands cause and effect.
  • Put stable content (instructions, tools) first and variable content (the latest message) last. This is what makes caching possible.
  • The model only knows what is in the prompt. Brief it like a sharp colleague who just walked into the room.

Original sources: OpenAI's Unrolling the Codex agent loop and Jonathan Fulton's "Inside the Agent Harness" analysis of the Codex codebase.


← → arrow keys work too