amp
Research notes on Sourcegraph Amp's configuration, credential discovery, and runtime behavior.
Research notes on OpenAI Codex's configuration, credential discovery, and runtime behavior based on agent-jj implementation.
How it fires
How this agent gets triggered: by you, by Claude, or both.
Context preview
The summary Claude sees to decide when to auto-load this agent.
Research notes on OpenAI Codex's configuration, credential discovery, and runtime behavior based on agent-jj implementation.
Research notes on OpenAI Codex's configuration, credential discovery, and runtime behavior based on agent-jj implementation.
**The SDK wraps a bundled binary** - it does NOT make direct API calls.
Sources: [Codex SDK docs](https://developers.openai.com/codex/sdk/), [GitHub](https://github.com/openai/codex)
You can use the `codex` binary directly instead of the SDK:
codex "your prompt here" codex --model o3 "your prompt"
codex exec "your prompt here" codex exec --json "your prompt" # JSONL output codex exec -m o3 "your prompt" codex exec --dangerously-bypass-approvals-and-sandbox "prompt" codex exec resume --last # Resume previous session
| Flag | Description | |------|-------------| | `--json` | Print events to stdout as JSONL | | `-m, --model MODEL` | Model to use | | `-s, --sandbox MODE` | `read-only`, `workspace-write`, `danger-full-access` | | `--full-auto` | Auto-approve with workspace-write sandbox | | `--dangerously-bypass-approvals-and-sandbox` | Skip all prompts (dangerous) | | `-C, --cd DIR` | Working directory | | `-o, --output-last-message FILE` | Write final response to file | | `--output-schema FILE` | JSON Schema for structured output |
codex resume # Pick from previous sessions codex resume --last # Resume most recent codex fork --last # Fork most recent session
1. User-configured credentials (from `credentials` array) 2. Environment variable: `CODEX_API_KEY` 3. Environment variable: `OPENAI_API_KEY` 4. Bootstrap extraction from config files
| Path | Description | |------|-------------| | `~/.codex/auth.json` | Primary auth config |
// API Key authentication
{
"OPENAI_API_KEY": "sk-..."
}
// OAuth authentication
{
"tokens": {
"access_token": "..."
}
}import { Codex } from "@openai/codex-sdk";
// With API key
const codex = new Codex({ apiKey: "sk-..." });
// Without API key (uses default auth)
const codex = new Codex();Dynamic import is used to avoid bundling the SDK:
const { Codex } = await import("@openai/codex-sdk");// Start new thread const thread = codex.startThread(); // Resume existing thread const thread = codex.resumeThread(threadId);
const { events } = await thread.runStreamed(prompt);
for await (const event of events) {
// Process events
}Codex App Server uses JSON-RPC 2.0 over JSONL/stdin/stdout (no port required).
{ "method": "thread/started", "params": { "thread": { "id": "thread_abc123" } } }
{ "method": "item/completed", "params": { "item": { "type": "agentMessage", "text": "..." } } }
{ "method": "turn/completed", "params": { "threadId": "thread_abc123", "turn": { "items": [] } } }The server can send JSON-RPC requests (with `id`) for approvals:
These require JSON-RPC responses with a decision payload.
Codex app-server also supports an experimental WebSocket transport:
codex app-server --listen ws://127.0.0.1:4500
// CodexRunResultSchema
type CodexRunResult = string | {
result?: string;
output?: string;
message?: string;
// ...additional fields via passthrough
};Content is extracted in priority order: `result` > `output` > `message`
Thread ID can be obtained from multiple sources:
1. `thread.started` event's `thread_id` property 2. Thread object's `id` getter (after first turn) 3. Thread object's `
Run Coding Agents in Sandboxes. Control Them Over HTTP. Supports Claude Code, Codex, OpenCode, and Amp.
Repo: rivet-dev/sandbox-agent
Research notes on Sourcegraph Amp's configuration, credential discovery, and runtime behavior.
Research notes on OpenClaw's architecture, API, and automation patterns for integration with sandbox-agent.
Research notes on OpenCode's configuration, credential discovery, and runtime behavior based on agent-jj implementation.