OpenAI has developed the Performance Factory, a cloud-based system powered by Codex that automates performance engineering for ChatGPT services. Since launching its first workflow, the system has handled more than 1,700 investigations in just over three months, identified the root cause in over 600 cases, and helped engineers validate fixes.
From manual debugging to an agent factory
Performance investigations once required engineers to inspect metrics and logs, compare traces, debug live machines, and read code. Repeated problems led the team to build specialized tools, including CPU and allocation profilers, eventually creating a collection of more than 30 performance tools.
Codex initially worked as an assistant: engineers could ask why a service had slowed down, while the model searched codebases, metrics, traces, and service interactions. Engineers still had to choose the right tools and guide the investigation.
OpenAI then encoded the team’s process in a shared perf-forensics skill. It instructs Codex to establish when a slowdown began, identify affected requests, and examine deployments or configuration changes that might explain the problem. After testing the skill against earlier incidents, the team could provide an alert and receive a diagnosis without directing every step manually.
The next stage moved investigations into the cloud. Alerts could start Codex sessions automatically, but engineers still had to develop fixes, review them, and check their effect after deployment. The Performance Factory was created to connect these steps into complete workflows.
Four components power the Performance Factory
The system combines four main elements:
- Task service: stores tasks, workflow states, transitions, and instructions for agents.
- Dispatch loop: checks which tasks are ready and assigns them to Codex agents.
- Cloud execution: runs Codex in an internal environment with access to repositories and observability tools.
- Subscriptions: wake agents when events such as pull-request comments, deployment completion, or failed checks occur.
Engineers define workflows through configuration files and Markdown prompts. Every task retains its state and findings, allowing work to move between agents and people, pause for code review or deployment, and then continue from the appropriate stage.
The Regression Workflow
The first production workflow handles performance regressions. It moves tasks through four stages: detection, root-cause analysis, fix proposal, and recovery verification. Engineers can follow progress in Slack or through the workflow interface, add context, and review proposed changes.
Finding the cause
When a configured alert fires, an agent examines which metrics deteriorated, when the change began, and which requests were affected. It compares request groups to determine whether similar requests became slower or whether the service received more requests that were already slow.
The agent then reviews deployments, feature-flag changes, source code, logs, and traces. Because an alert may appear hours after a regression starts, the investigation looks back through historical data to identify the earliest evidence of deterioration.
Adversarial review
To reduce premature or incorrect conclusions, OpenAI added a separate Codex review step. This reviewer challenges the proposed diagnosis, checks its assumptions, and examines counterfactuals, such as whether unaffected requests remained healthy or whether a rollback restored the metric.
In one case, an agent linked failing ChatGPT conversations to image-download errors. The reviewer found that the internal file-location service had already recovered while image requests continued to fail, showing that the initial explanation was incomplete and that the investigation needed to continue.
In a manual review of 100 suggested root causes, 70% were judged accurate, while the remaining cases required refinement or did not fully establish causality. The workflow uses separate Codex turns for investigation, challenge, and fix proposals to add checks and balances.
Proposing and checking fixes
After a diagnosis passes review, Codex can implement a change and open a pull request. Engineers decide whether the proposal should be merged. Each task includes a summary of the incident, its impact, the suspected cause, and the proposed fix, supported by material such as metric time series, CPU flame graphs, and traces.
Comments on the pull request can wake an agent to address requested changes. Once a fix is deployed, another agent checks whether performance has returned to its previous baseline.
- If performance recovers, the task is marked resolved.
- If recovery is partial, the original issue is closed and a new task is opened for the remaining slowdown.
- If there is no improvement, the task returns to investigation with the latest findings recorded.
OpenAI says producing a correct fix has been more difficult than identifying the cause. Proposed changes can be unnecessarily complex or introduce new problems, so fixes also undergo adversarial review. Architectural choices, such as adding a cache with possible stale-data tradeoffs, still require guidance from an engineer familiar with the service.
Lessons from operating agents in production
Protecting engineers’ attention
Raw agent output can be difficult to interpret. The team has therefore focused on concise reports, related-incident grouping, impact ranking, and preserving the most useful evidence. This allows engineers to concentrate on context, tradeoffs, and shipping decisions instead of reconstructing an investigation from scattered messages.
Testing changes to agent workflows
Changes to a skill or model may improve some investigations while weakening others. OpenAI evaluates the investigation itself separately from the usefulness of the summary delivered to engineers.
For investigations, the team replays historical production incidents as test cases. Agents receive the original signal without details that would reveal the answer, then are evaluated on when the problem began, its scale, affected requests, evidence use, and the ranking of possible causes.
Task summaries are tested with saved task snapshots. A separate grader assesses whether an engineer unfamiliar with the system can understand what happened, why it matters, whether important charts were retained, and whether the proposed next step is supported by evidence.
Making the system self-repairing
The agents themselves need monitoring. A broken profiler or missing permission can prevent an investigation from reaching a reliable conclusion, so OpenAI runs a daily agent that scans recent messages and logs for tool failures and access problems.
When the same error blocks several investigations, the Performance Factory can create a task to fix it. An agent may propose the change, while an engineer reviews and decides whether to merge it. Follow-up evaluations then test whether the original blockage has been removed.
What OpenAI plans next
The Regression Workflow is one example of a broader agent-factory model in which tasks move through explicit states, reviewers challenge conclusions, and engineers intervene when judgment is needed. Workflows can also create tasks for other workflows, allowing agents to coordinate across different types of performance work.
Today, the regression process begins when an alert fires. OpenAI is exploring proactive monitoring that would use fine-grained data to detect issues that alerts miss and identify optimization opportunities. Agents could compare CPU and memory profiles, heap dumps, and request traces across releases, then open a task to investigate a small performance change and prepare a fix for review.
The team is also encoding known patterns into reusable workflows. Its service-rightsizing skill, for example, helps identify autoscaling configurations that keep more replicas running than a service needs. The goal is to run such workflows regularly across services and turn lessons from one slowdown into improvements for future investigations.
OpenAI’s broader direction is toward performance systems that become more autonomous and improve over time. Codex is already used to accelerate ChatGPT development; the Performance Factory applies the same technology to keeping the service responsive.