CodexKit documentation

September 11, 2026 ยท View on GitHub

Back to the README

Start with the quickstart, then choose a guide for the capability you are integrating. These guides describe the 2.0 development line on main.

Guides

GuideTopics
Backend configuration and modelsAccount auth, retries, response budgets, GPT-6 Astra, reasoning, response state
Request preparation and model selectionFixed, account-aware, and host-defined selection; exact overrides; delegating wrappers
Local Codex login on macOSRead-only discovery, external ownership, renewal, and disconnect
Runtime progress, tools, and turn controlParallel tools, progress, model discovery, usage limits, steering, interruption
Messaging and imagesEvent buffering, execution limits, typed context, structured replies, images
SDK integrationHost-managed sessions, execution handles, async observation, typed HTTP errors
Structured request recoveryFrozen requests, lifecycle suspension, bounded retries, completed receipts, schema upgrades, retention
Persistence and observationSQLite/Realm integration, migration, queries, Combine, context compaction
MemoryCapture, retrieval, guided writing, raw stores, attribution
Personas and skillsLayered instructions, tool policies, dynamic definitions, previews
Apple app integrationsBackground completion, share extensions, App Intents, Shortcuts
Logging and troubleshootingDiagnostics, production checks, common failures
Migration and releasesChanges between alpha versions and release conventions
VerificationCI simulator execution, opt-in live tests, performance checks
Release readinessAlpha.28 candidate verification and publication status
Workload measurementsImages, database paging, cancellation, optimized pipeline
Demo appSetup and a walkthrough of the runtime features

Core Concepts

  • AgentRuntime The main entry point. Owns auth state, threads, turn control, tool execution, personas, skills, and optional memory.
  • AgentThread A persistent conversation with its own status, title, persona stack, skill IDs, and optional memory context.
  • Request A single turn request. Can include text, images, imported content, optional app-provided context, optional fulfillment-policy options, persona override, skill override, and memory selection.
  • RequestOptionsRepresentable A typed, app-owned way to describe fulfillment policy for a turn through a mode plus natural-language requirements.
  • CodexResponsesBackend The built-in ChatGPT/Codex-style backend used for text/image/tool turns.
  • ToolDefinition A host-defined capability the model can call through your app.
  • AgentPersonaStack Layered behavior instructions pinned to a thread or applied for one turn.
  • AgentSkill A behavior module that can carry instructions plus tool policy.
  • AgentStructuredOutput A typed Decodable contract for schema-constrained replies.
  • AgentMemoryConfiguration Optional local memory storage, retrieval, ranking, and capture policy.

Choose Your Level

  • Simple chat Sign in, create a thread, and call stream(...) or send(...).
  • Typed app flows Use send(..., response:) to get a Decodable value back.
  • Guided retrieval/enrichment Use Request.options to tell the model how to fulfill the turn so the typed response contract can be satisfied.
  • Tool-driven agents Register host tools, optionally gate them with approvals, and opt independent tools into bounded parallel execution.
  • Rich behavior Add thread personas, skills, and execution policies.
  • Memory-backed agents Opt into automatic memory capture, guided writing, or raw record management.

Feature Matrix

CapabilitySupport
Supported platformsiOS 17+, macOS 14+
iOS auth: device codeYes
iOS auth: browser OAuth (localhost callback)Yes
macOS auth: browser OAuth and device codeYes
macOS auth: reuse a local Codex sessionRead-only file/direct Keychain discovery with explicit effective settings; renewal depends on the owner
Threaded runtime state + restoreYes
Streamed assistant outputYes
Host-defined tools + approval flowYes
Independent parallel toolsOpt-in, bounded concurrency
Reasoning summaries, search progress, message phasesYes, when supplied by the model
Account model discovery + usage-limit snapshotsYes
Add input to an active turn + interruptYes
Per-thread model + thinking levelYes
Web search toggle (enableWebSearch)Yes
Built-in request retry/backoffYes (configurable)
Structured local memory layerYes
Text + image inputYes
Typed request contextYes
Declarative request fulfillment policyYes
Typed structured output (Decodable)Yes
Mixed streamed text + typed structured outputYes
Share/import helper (AgentImportedContent)Yes
App Intents / Shortcuts exampleYes
Assistant image attachment renderingYes
Hosted image generation (enableImageGeneration)Yes
Video/audio input attachmentsNot yet

Architecture

flowchart LR
    A["SwiftUI App"] --> B["AgentRuntime"]
    B --> C["ChatGPTAuthProvider"]
    B --> D["SessionSecureStore<br/>KeychainSessionSecureStore"]
    B --> E["RuntimeStateStore<br/>SQLite or Realm"]
    B --> F["CodexResponsesBackend"]
    B --> G["ToolRegistry + Executors"]
    B --> H["ApprovalPresenter<br/>ApprovalInbox"]
    F --> I["OpenAI Responses API"]

Design notes