You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+75Lines changed: 75 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,40 @@ Use `CodexKit` if you are building a SwiftUI/iOS app and want:
21
21
22
22
The SDK stays tool-agnostic. Your app defines the tool surface and runtime UX.
23
23
24
+
## Core Concepts
25
+
26
+
-`AgentRuntime`
27
+
The main entry point. Owns auth state, threads, tool execution, personas, skills, and optional memory.
28
+
-`AgentThread`
29
+
A persistent conversation with its own status, title, persona stack, skill IDs, and optional memory context.
30
+
-`UserMessageRequest`
31
+
A single turn request. Can include text, images, imported content, persona override, skill override, and memory selection.
32
+
-`CodexResponsesBackend`
33
+
The built-in ChatGPT/Codex-style backend used for text/image/tool turns.
34
+
-`ToolDefinition`
35
+
A host-defined capability the model can call through your app.
36
+
-`AgentPersonaStack`
37
+
Layered behavior instructions pinned to a thread or applied for one turn.
38
+
-`AgentSkill`
39
+
A behavior module that can carry instructions plus tool policy.
40
+
-`AgentStructuredOutput`
41
+
A typed `Decodable` contract for schema-constrained replies.
42
+
-`AgentMemoryConfiguration`
43
+
Optional local memory storage, retrieval, ranking, and capture policy.
44
+
45
+
## Choose Your Level
46
+
47
+
- Simple chat
48
+
Sign in, create a thread, and call `streamMessage(...)` or `sendMessage(...)`.
49
+
- Typed app flows
50
+
Use `sendMessage(..., expecting:)` to get a `Decodable` value back.
51
+
- Tool-driven agents
52
+
Register host tools and optionally gate them with approvals.
53
+
- Rich behavior
54
+
Add thread personas, skills, and execution policies.
55
+
- Memory-backed agents
56
+
Opt into automatic memory capture, guided writing, or raw record management.
57
+
24
58
## Quickstart (5 Minutes)
25
59
26
60
1. Add this package to your Xcode project.
@@ -125,6 +159,17 @@ The recommended production path for iOS is:
125
159
126
160
For browser OAuth, `CodexKit` uses the Codex-compatible redirect `http://localhost:1455/auth/callback` internally and only runs the loopback listener during active auth.
127
161
162
+
## Platform Boundary
163
+
164
+
`CodexKit` ships a ChatGPT/Codex-style account flow and backend. It does not provide general OpenAI API platform access.
165
+
166
+
That means:
167
+
168
+
- built in: ChatGPT sign-in, Codex-style threaded turns, tools, personas, skills, structured output, and optional local memory
169
+
- not built in: separate API-key-based OpenAI platform clients, Realtime voice sessions, or other non-Codex API access
170
+
171
+
If your app needs capabilities outside the built-in backend path, the intended approach is to expose them through your own host tools or custom backend integration.
172
+
128
173
`CodexResponsesBackend` also includes built-in retry/backoff for transient failures (`429`, `5xx`, and network-transient URL errors like `networkConnectionLost`). You can tune or disable it:
129
174
130
175
```swift
@@ -163,6 +208,15 @@ Available values:
163
208
164
209
## Typed Completions
165
210
211
+
For most apps, there are now three common send paths:
212
+
213
+
-`streamMessage(...)`
214
+
Stream deltas, tool events, approvals, and final turn completion.
215
+
-`sendMessage(...)`
216
+
Return the assistant's final text as a `String`.
217
+
-`sendMessage(..., expecting:)`
218
+
Return a typed `Decodable` value from a structured response.
219
+
166
220
For App Intents, share flows, widgets, or other non-chat surfaces, `CodexKit` can return a typed value directly from `sendMessage`:
167
221
168
222
```swift
@@ -560,6 +614,17 @@ The demo app exercises:
560
614
- a one-tap skill policy probe that compares tool behavior in normal vs skill-constrained threads
561
615
- a Health Coach tab with HealthKit steps, AI-generated coaching, local reminders, and tone switching
562
616
617
+
Each tab is focused on a single story:
618
+
619
+
-`Assistant`
620
+
Chat runtime, auth, threads, tools, reasoning level, personas, and skills.
621
+
-`Structured`
622
+
Typed structured output and imported-content flows.
623
+
-`Memory`
624
+
High-, mid-, and low-level memory APIs.
625
+
-`Health Coach`
626
+
A product-style demo using tools, memory, notifications, and HealthKit-backed context.
627
+
563
628
## Skill Examples
564
629
565
630
`CodexKit` skills are behavior modules, not just tone layers. They can carry both instructions and execution policy (tool allow/require/sequence/call limits).
@@ -687,6 +752,16 @@ print(preview)
687
752
688
753
`CodexKit` uses Semantic Versioning. The latest stable release is `v1.1.0`, while `main` tracks the upcoming 2.0 development line.
689
754
755
+
### 2.0 Messaging API
756
+
757
+
The 2.0 line standardizes runtime sends around:
758
+
759
+
-`streamMessage(...)` for streaming turn events
760
+
-`sendMessage(...)` for final text
761
+
-`sendMessage(..., expecting:)` for typed structured replies
762
+
763
+
This is the shape new examples and docs target on `main`.
764
+
690
765
- Release notes live in [CHANGELOG.md](CHANGELOG.md)
691
766
- CI runs on pushes/PRs via [`.github/workflows/ci.yml`](.github/workflows/ci.yml)
692
767
- Pushing a `v*` tag creates a GitHub Release automatically via [`.github/workflows/release.yml`](.github/workflows/release.yml)
0 commit comments