How to Fetch YouTube Transcripts with Codex

OpenAI’s Codex CLI is a terminal-based AI coding agent. Like most agents, its default capabilities are limited to what it knows at training time and what’s in your local codebase. Pulling content from YouTube — a tutorial you want to reference, a conference talk with relevant context — normally means leaving the terminal. AgentPatch connects Codex to a YouTube transcript tool so it can fetch that content directly.

Why This Matters

Technical video content is everywhere but hard to work with programmatically. You can’t grep a video. If a key architectural explanation lives inside a 40-minute conference recording, your agent can’t do anything with it unless it can read the transcript.

With AgentPatch connected, Codex can fetch a YouTube transcript mid-session and use that content to answer questions, inform code decisions, or populate documentation. The transcript comes back with timestamps, so you can ask about specific sections.

Setup

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 working on an integration and there’s a recorded walkthrough of the API you’re implementing against. You tell Codex:

“Fetch the transcript for this video and find where they explain the authentication flow: https://www.youtube.com/watch?v=xyz789

Codex calls the YouTube Transcript tool through AgentPatch, returns the full transcript, and points you to the section where authentication is covered. You stay in your coding session. The agent did the research.

Another scenario: you’re writing a technical summary of a concept and want to cross-reference a well-known talk.

“Get the transcript from this video and summarize the main argument in two paragraphs.”

Codex fetches the transcript and writes the summary. No browser, no third-party tools, no copy-pasting text from a caption window.

Wrapping Up

The YouTube Transcript tool is part of a larger marketplace. Once AgentPatch is connected to Codex, you also get access to web search, email sending, image generation, and more with no additional configuration. Visit agentpatch.ai to see what’s available.