How to Chain Multiple Tools Together in Codex

Codex CLI is focused on code tasks, but those tasks often need real-world context — current library docs, live data, competitor analysis. AgentPatch gives Codex access to the full tool marketplace. When a task benefits from multiple tools, Codex uses them together.

Why This Matters

Terminal-first developers tend to want fewer context switches. If Codex can pull data, do research, and write code in the same session, that’s better than bouncing between a terminal, a browser, and whatever other tools you’re juggling.

Multi-tool capability matters most for tasks that would otherwise take several manual steps: research followed by code, data gathering followed by analysis, lookups followed by generation.

Setup

The AgentPatch CLI is designed for AI agents to use via shell access. Install it, and your agent can discover and invoke any tool on the marketplace.

Install (zero dependencies, Python 3.10+):

pip install agentpatch

Set your API key:

export AGENTPATCH_API_KEY=your_api_key

Example commands your agent will use:

ap search "web search"
ap run google-search --input '{"query": "test"}'

Get your API key from the AgentPatch dashboard.

Add AgentPatch to ~/.codex/config.toml:

[mcp_servers.agentpatch]
url = "https://agentpatch.ai/mcp"
bearer_token_env_var = "AGENTPATCH_API_KEY"

Then set your API key:

export AGENTPATCH_API_KEY=your_api_key

Replace your_api_key with your actual key from the AgentPatch dashboard. Codex discovers all AgentPatch tools automatically on next start.

Example

You’re building a local search feature and want to test how it behaves when you combine place data with trend context. You tell Codex:

“For the city of Austin, search for coworking spaces, check if remote work is trending up or down, and pull any relevant news. Then generate a sample JSON payload I can use in the integration tests.”

Codex works across three tools:

Searching Google Maps for "coworking spaces Austin TX"...
Checking Google Trends for "remote work Austin"...
Searching Google News for "coworking spaces Austin"...

Results:

Maps: 8 coworking spaces found in central Austin. Top: WeWork 6th Ave (4.2★),
Capital Factory (4.6★), Industrious Domain (4.4★).

Trends: "Remote work Austin" is up 15% YoY. "Coworking Austin" up 28%.

News: Two new coworking spaces opened Q4 2025. Article from Austin American-Statesman
on downtown office vacancy driving co-working demand.

Sample JSON for integration tests:

{
  "city": "Austin",
  "results": [
    { "name": "Capital Factory", "rating": 4.6, "type": "coworking" },
    { "name": "WeWork 6th Ave", "rating": 4.2, "type": "coworking" },
    { "name": "Industrious Domain", "rating": 4.4, "type": "coworking" }
  ],
  "trend": { "direction": "up", "change": "+28%", "period": "12mo" },
  "newsCount": 2
}

Writing to tests/fixtures/local-search.json.

Codex combined three data sources and produced something directly useful. One prompt, no context-switching.

Wrapping Up

AgentPatch gives Codex access to the full tool marketplace in a single connection. Chaining tools is just what Codex does when the task calls for it — no additional configuration required. Explore everything at agentpatch.ai.