# Openai Codex

> OpenAI Codex CLI and Responses API -- sandbox modes, approval policies, AGENTS.md, multi-provider support, built-in tools, and enterprise admin controls.

- Skill: `leolin990405/openai-codex` (Agent Skill)
- Install (CLI): `npx get-skill add leolin990405/openai-codex`
- Raw SKILL.md: https://api.skillmd.com/api/skills/leolin990405/openai-codex/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Integrations & APIs
- Author: LeoLin990405 (https://skillmd.com/u/leolin990405)
- Updated: 2026-11-11
- Page: https://skillmd.com/skills/leolin990405/openai-codex

---


# OpenAI Codex CLI & Responses API

## Codex CLI

### Approval Modes

| Mode | Behavior |
|------|----------|
| **Suggest** | Proposes changes, user approves each |
| **Auto Edit** | Auto-applies file edits, asks for commands |
| **Full Auto** | Executes everything autonomously |

### Sandbox Architecture

| Platform | Technology |
|----------|-----------|
| macOS | Seatbelt (sandbox-exec) |
| Linux | Docker container |
| Windows | WSL2 |

- `workspace-write` (default): Read/edit within workspace only
- `danger-full-access`: No restrictions

### AGENTS.md (Instructions File)

Hierarchical loading:
1. `~/.codex/AGENTS.md` — global
2. `<project>/AGENTS.md` — project-level
3. `<project>/.codex/AGENTS.md` — alternative location

### Multi-Provider Support

10+ providers via OpenAI-compatible API:
- OpenAI, Anthropic, Google Gemini, Mistral, Groq, Ollama, Azure, etc.

### Product Variants

| Variant | Description |
|---------|-------------|
| Codex CLI | Terminal agent |
| Codex IDE | VS Code / JetBrains integration |
| Codex Web | Cloud-hosted in GitHub Actions |

### Enterprise Admin Controls
- Allowed approval policies and sandbox modes
- Web search behavior restrictions
- MCP server allowlists
- Feature pins and command restrictions

## Responses API

New API replacing Chat Completions for agentic use cases.

### Built-in Tools

| Tool | Purpose |
|------|---------|
| `web_search` | Search the web |
| `file_search` | RAG over uploaded files |
| `code_interpreter` | Python sandbox execution |
| `computer_use` | Desktop automation |
| `mcp` | MCP server tools |
| `image_generation` | DALL-E integration |

### State Management

```python
# Auto-chaining with previous_response_id
response1 = client.responses.create(
    model="gpt-4o",
    input="What's the weather in NYC?"
)

response2 = client.responses.create(
    model="gpt-4o",
    input="And in London?",
    previous_response_id=response1.id  # Carries context
)
```

### Conversation State
- `previous_response_id` — chain responses
- `conversation_id` — persistent conversations
- Both HTTP and WebSocket transport

## OpenAI Guardrails Library

Standalone safety library with 8 built-in checks:

```python
from openai_guardrails import GuardrailsOpenAI

# Drop-in replacement for OpenAI client
client = GuardrailsOpenAI(config_path="guardrails.json")

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "..."}]
)
```

### Built-in Guardrails

| Guardrail | Purpose |
|-----------|---------|
| Moderation | Content classification |
| URL Filter | Domain allowlists/blocklists |
| Contains PII | Personal data detection |
| Hallucination | Vector store comparison |
| Jailbreak | Manipulation detection |
| NSFW Text | Inappropriate content |
| Off Topic | Business scope enforcement |
| Custom Prompt | LLM-based custom rules |

### Pipeline Configuration (JSON)

```json
{
  "stages": {
    "preflight": ["moderation", "jailbreak_detection"],
    "input": ["pii_detection", "off_topic"],
    "output": ["hallucination_detection", "url_filter"]
  }
}
```

## Sources

- [Codex Sandboxing](https://developers.openai.com/codex/concepts/sandboxing/)
- [Agent Approvals](https://developers.openai.com/codex/agent-approvals-security/)
- [OpenAI Guardrails](https://github.com/openai/openai-guardrails-python)
- [Responses API](https://platform.openai.com/docs/api-reference/responses)

