WhoBuilt

OpenAI on Securing Code-Executing AI Agents

Jul 30, 2025· 14 min· 3.0K views·Watch on YouTube

Speaker

Fouad Matin of OpenAI, who works on agent robustness and control, explains how to secure code-executing AI agents at an AI Engineer talk.

Agents are becoming code executors

Matin argues that coding agents are shifting from writing code to choosing and running it to achieve a goal. Code execution can also help with tasks beyond software engineering, such as using OCR or cropping images to interpret visual information.

Main risks and safeguards

Code execution brings risks including prompt injection and data exfiltration, malicious package installation, vulnerable code, privilege escalation, and sandbox escape. Matin points to sandboxing, limited internet access, and human review as key safeguards when deploying agents.

Sandbox the agent and control network access

Matin recommends giving agents isolated environments, such as the containers used by Codex and ChatGPT, or applying OS-level sandboxing for local runs. Codex CLI uses Seatbelt on macOS and seccomp with Landlock on Linux; its restricted mode limits file access to the working directory and controls network calls.

Combine system controls with human review

A GitHub issue can contain malicious instructions asking an agent to send a commit to an outside URL. Model-level detection can help, but Matin says system-level network rules provide a more deterministic control. Human review should check both proposed operations, such as package installs, and the resulting code.

Build agents with tools and layered checks

Matin describes using Local Shell, Apply Patch, and tools such as MCP and web search to let reasoning models carry out tasks. A Socket MCP server can check whether dependencies are vulnerable or suspicious, with an additional system-level check after rollout. Remote containers can run locally, in an organization's environment, or be hosted by OpenAI.

Takeaways

  • Run code-executing agents in isolated containers or OS sandboxes, with file access limited to what the task needs.
  • Restrict outbound network access, especially when agents read user-generated content such as GitHub issues.
  • Use model monitoring as an added layer; enforce critical limits through deterministic system controls.
  • Review agent operations and final code, including unfamiliar package installs, before they reach privileged environments.
  • Offer both restrictive and flexible operating modes, and make the tradeoffs clear to users.

Mentioned in this talk

Search inside this talk

What was claimed 13

Show all 13 facts

Related talks