Share Debug Logs and Error Reports with Codex CLI and AgentPatch Paste
When something breaks, the first thing you do is get the logs in front of the right people. That usually means copying a pile of text, hunting for a place to paste it, and sending a link — all while you’re in the middle of debugging. With the AgentPatch Paste tool connected to Codex, the agent can handle that step for you.
Why This Matters
Stack traces, crash dumps, and verbose error output are hard to share well. Pasting them directly into Slack truncates them. Attaching files is clunky. Sending raw text in a ticket is messy. What you want is a clean URL that opens the full content in a browser, formatted for readability.
The Paste tool gives Codex a way to do that without stepping outside the terminal session. It accepts text/plain and application/json, so it works whether your logs are raw text or structured output. Pastes expire automatically — up to 7 days — so there’s no cleanup needed. Each call costs 25 credits.
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
Your service is throwing 500 errors in production and you need to share the relevant logs with a teammate who’s going to help you debug.
“Fetch the last 200 lines from ./logs/app.log and filter for lines containing ERROR or FATAL.”
Codex reads the log file and filters the output. You’ve got the relevant entries. Now:
“Create a paste of those log lines and give me the link.”
Codex calls the AgentPatch Paste tool with the filtered log content as text/plain and a 1-day expiry. The tool returns:
https://agentpatch.ai/paste/a1b2c3d4e5f6
You drop that into a DM. Your teammate opens it, sees the full log output formatted and readable, and can start diagnosing without needing access to your machine.
For structured error data, the JSON content type is cleaner:
“Parse the errors from logs/errors.json, extract the unique error types with counts and example stack traces, and upload it as a JSON paste with a 3-day expiry.”
Codex processes the log file, builds a structured summary, calls the Paste tool with application/json, and returns a URL. Your teammate can fetch that URL programmatically or open it in a JSON viewer.
You can also use Paste as part of a bug report workflow:
“Collect the last 500 lines from app.log, the contents of config/production.yaml, and the output of
node --version && npm --version. Format it all as a plain-text bug report and upload it as a paste.”
Codex gathers all three pieces of information, assembles a structured report, and uploads it in one shot. The URL goes into the GitHub issue. Anyone who opens the issue gets the full context at a glance without needing to ask for logs separately.
For recurring issues, you can make this part of a standing routine:
“Every time a test run fails, collect the error output, format it as a plain text report with the test name, failure message, and stack trace for each failure, and upload it as a paste. Log the URL to ./reports/last-run.txt.”
Codex handles the collection, formatting, upload, and local record — you get a durable URL for every failed run without touching the workflow manually.
Wrapping Up
Getting logs into a shareable link is one of those small things that comes up constantly during debugging. Paste makes it a single agent action instead of a manual process. The same AgentPatch connection also gives Codex access to web search, email, image generation, and the full tool marketplace. Visit agentpatch.ai to see what else is available.