Building State-of-the-Art AI Programming Agents with OpenAI's o1 Model

weights_&_biases · Tech · 2023 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.5 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: software engineering agent evaluation

Weights & Biases built an autonomous programming agent for SWE-Bench-Verified, where the system had to repair real GitHub issues inside Docker images by reading code, editing files, running tests, and deciding when a fix was complete.

Constraints:

Architecture

The agent used o1 in high-reasoning mode as the main step and editing driver, wrapped by a GPT-4o memory compressor, custom Python code-editing tools, auto-commands after edits, five parallel rollouts per SWE-Bench instance, and an o1 crosscheck step to choose the best rollout. Weave tracked experiments and evaluations, while Eval Studio and Phaseshift emerged as supporting analysis and composition tools.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  swe-bench-verified-instance["SWE-Bench-Verified instance"] --> o1-agent-driver["o1 agent driver"]
  o1-agent-driver --> custom-python-editor-tools["custom Python editor tools"]
  custom-python-editor-tools --> auto-command-runner["auto-command runner"]
  auto-command-runner --> swe-bench-verified-instance
  auto-command-runner --> o1-agent-driver
  o1-agent-driver --> gpt-4o-memory-compressor["GPT-4o memory compressor"]
  gpt-4o-memory-compressor --> o1-agent-driver
  o1-agent-driver --> parallel-rollout-workers["parallel rollout workers"]
  parallel-rollout-workers --> crosscheck-selector["crosscheck selector"]
  crosscheck-selector --> weave-evaluation-and-trace-store["Weave evaluation and trace store"]
  weave-evaluation-and-trace-store --> eval-studio["Eval Studio"]
  weave-evaluation-and-trace-store --> phaseshift["Phaseshift"]
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
SWE-Bench-Verified instance Provides the GitHub issue, Docker environment, and hidden tests that define each repair task. o1 agent driver
o1 agent driver Runs the agent's step logic, bug analysis, and code-editing decisions. custom Python editor tools, GPT-4o memory compressor, auto-command runner, parallel rollout workers
GPT-4o memory compressor Compresses step history so long trajectories remain usable by the o1 driver. o1 agent driver
custom Python editor tools Expose code-editing operations designed to use model context efficiently. auto-command runner
auto-command runner Runs registered commands after every editing step to reduce temporal-ordering mistakes. SWE-Bench-Verified instance, o1 agent driver
parallel rollout workers Run multiple candidate attempts for each instance. crosscheck selector
crosscheck selector Uses an o1 tie-breaker to choose the best rollout. Weave evaluation and trace store
Weave evaluation and trace store Tracks experiments, evaluations, traces, and supporting analysis data. Eval Studio, Phaseshift
Eval Studio Analyzes live runs, result statistics, and performance changes between model versions. Weave evaluation and trace store
Phaseshift Composes AI-agent functions and pipelines with versioned code/data and first-class evaluations. Weave evaluation and trace store

Data flow

A SWE-Bench issue and container entered the agent loop; o1 inspected context, edited code with custom Python tools, auto-commands ran after each edit, GPT-4o compressed long step history, five rollouts explored candidate fixes, and an o1 crosscheck selected the final solution while Weave recorded evaluations and traces.

3 supporting quotes
“Typical agents operate autonomously within docker containers as a human programmer would, iteratively reading and writing code and tests until they believe the issue is solved.”article, stated
“Weights & Biases are heading with this. ## How it works Our SWE-Bench-Verified agent uses: * o1 with reasoning_mode high for all agent step and editing logic * a gpt4o based memory component that compresses the agent’s step history * a custom built python code editor toolset designed”article, stated
“5 parallel rollouts for each instance, and a final “crosscheck” step for choosing the best rollout, using an o1 tie-breaker”article, stated

Why this architecture

The architecture separates high-value reasoning from support tasks: o1 performs coding decisions, GPT-4o compresses history, custom tools reduce context waste, auto-commands compensate for temporal-ordering weakness, and parallel rollouts plus crosscheck spend extra compute where benchmark accuracy matters.

3 supporting quotes
“o1 is better than prior models at pin-pointing bugs in large chunks of code context. It is better at doing exactly what you tell it.”article, stated
“reasoning_mode high for all agent step and editing logic * a gpt4o based memory component that compresses the agent’s step history * a custom built python code editor toolset designed to efficiently use model context * the ability to register “auto-commands” that run after every editing step”article, stated
“My solution to resolving this was to reduce the need for the agent to reason about time-ordered events. The “auto-command” tools allow the agent to register commands to run after every file modification. o1 is so good at doing what you say that I think you”article, stated

Models used: OpenAI o1 with reasoning_mode high · GPT-4o · o1 tie-breaker

Scale

Alternatives considered (roads not taken)

Use OpenAI's basic o1 agent framework.

Rejected because: W&B reports that its richer agent framework substantially outperformed OpenAI's published o1 result.

“It’s also a significant improvement over OpenAI’s published o1 result, which used a basic agent framework. Read on to learn how I achieved this score, lessons from working with o1, and where we at Weights & Biases are heading with this. ## How it works Our”article, stated

Prompt o1 to reason through event ordering instead of changing the architecture.

Rejected because: The author considered this plausible but avoided it because such prompts more often triggered invalid prompt detection.

“you could actually instruct it to get the time ordering of events right, by saying something like “review each prior step you took in order”article, stated
“prompts like this currently trigger OpenAI’s invalid prompt detection logic more frequently, so I didn’t spend a lot of time with this approach.”article, stated

Rely on generic code-manipulation tools.

Rejected because: The team built custom Python editor tools specifically to preserve and use model context efficiently.

“component that compresses the agent’s step history * a custom built python code editor toolset designed to efficiently use model context * the ability to register “auto-commands” that run after every editing step * 5 parallel rollouts for each instance, and a final “crosscheck” step for choosing”article, stated

Use a single rollout per problem.

Rejected because: The chosen design spends test-time compute on five rollouts and a final selector, implying a quality preference over single-attempt cost/latency.

“5 parallel rollouts for each instance, and a final “crosscheck” step for choosing the best rollout, using an o1 tie-breaker”article, stated

Patterns

tool-use-orchestration (agent architecture)

The coding agent used custom editor tools and auto-commands as first-class controls around model actions instead of relying on raw text generation.

“a custom built python code editor toolset designed to efficiently use model context”article, stated
“the ability to register “auto-commands” that run after every editing step”article, stated

context-compaction (agent memory)

A GPT-4o memory component compressed the step history so o1 could continue long repair trajectories with reduced context pressure.

“a gpt4o based memory component that compresses the agent’s step history”article, stated

eval-driven-development (evaluation)

The team used Weave evaluations and 977 eval runs to iterate on prompt instructions, tool design, and agent behavior.

“I used Weave to track everything I did, and used Weave’s eval framework for all of the experiments I ran.”article, stated
“In fact, I ran 977 evals in the course of achieving this solution. Press enter or click to view image in full size Weave itself improved a ton while I was doing this work.”article, stated

llm-as-judge (evaluation)

The crosscheck step used o1 as a tie-breaker to choose among multiple rollouts.

“5 parallel rollouts for each instance, and a final “crosscheck” step for choosing the best rollout, using an o1 tie-breaker”article, stated

prompt-versioning (llmops)

Phaseshift was framed around versioning data and code together so agent changes could be inspected during iteration.

“you get things like versioning of both data and code together, so you can figure out what you changed while iterating.”article, stated

Tradeoffs

Use o1 for core agent reasoning and editing.

Chose A high-reasoning o1 driver over A basic agent framework or weaker prior completion-style models.

Rationale: The author attributes the result partly to o1's bug-finding, instruction-following, and repository reasoning behavior.

“o1 is better than prior models at pin-pointing bugs in large chunks of code context. It is better at doing exactly what you tell it.”article, stated
“Our solution is the first o1-based agent that we know of, and it tops the SWE-Bench Verified leaderboard.”article, stated

Handle temporal-ordering weakness architecturally.

Chose Auto-commands after every edit over Prompt-only temporal reasoning instructions.

Rationale: Prompts might help, but the specific prompt style triggered invalid prompt detection more often, so the tool layer reduced the reasoning burden.

“My solution to resolving this was to reduce the need for the agent to reason about time-ordered events.”article, stated
“prompts like this currently trigger OpenAI’s invalid prompt detection logic more frequently, so I didn’t spend a lot of time with this approach.”article, stated

Spend extra compute on multiple rollouts and crosscheck.

Chose Five parallel rollouts plus an o1 tie-breaker over One autonomous attempt per benchmark instance.

Rationale: The article presents crosscheck selection as a quality-improving mechanism, but the cost/latency burden is implied by running multiple attempts.

“5 parallel rollouts for each instance, and a final “crosscheck” step for choosing the best rollout, using an o1 tie-breaker”article, stated
“works pretty well and may be somewhat novel. But that will be a story for another day.”article, stated

Build Phaseshift in TypeScript.

Chose TypeScript over An unspecified alternative implementation language.

Rationale: The author says TypeScript's type system helped reason about agent interfaces and composition.

“I wrote it in typescript because its powerful type system helps me reason about interfaces and composition.”article, stated

Gotchas (what bit them)

o1 could misread the order of edit and test events.

Root cause: The model did not always reason correctly about temporal ordering in agent trajectories.

Resolution: Move temporal bookkeeping into auto-commands that run after every edit rather than depending only on model reasoning.

3 supporting quotes
“it does not always reason about the time ordering of events correctly.”article, stated
“Sometimes after such a sequence, the agent would say something like “I edited the code to do X, but the unit test still fails”, without having actually run the test after the second edit.”article, stated
“The “auto-command” tools allow the agent to register commands to run after every file modification.”article, stated

More instructions can be risky with older models, even when o1 handled them well here.

Root cause: The author had prior experience that adding prompt detail could degrade adherence elsewhere in the prompt.

Resolution: Treat instruction-heavy prompts as model-specific and validate them through trajectory review and evaluations.

“I had this lingering feeling from working with prior models that adding one more line to the prompt may start to degrade a model’s ability to adhere to the rest of the prompt.”article, stated
“Each is hard-earned from grinding out evals and reviewing lots of agent trajectories.”article, stated

The crosscheck mechanism is promising but under-specified in the public write-up.

Root cause: The author explicitly defers details of how the N-rollout selector works.

Resolution: Use the pattern cautiously until implementation details and contribution versus extra test-time compute are documented.

“our new “cross-check” mechanism for algorithmically choosing the best of N agent rollouts works pretty well and may be somewhat novel. But that will be a story for another day.”article, stated

Evaluation

The work was evaluated on SWE-Bench-Verified and developed through Weave-tracked experiments, trajectory review, live-run analysis, and statistical comparison in Eval Studio.

Metrics: 64.6% resolved on SWE-Bench-Verified · 977 evaluations during development · 5 parallel rollouts per instance · 500 benchmark issues

4 supporting quotes
“I made an OpenAI o1-based AI programming agent that is now state of the art on SWE-Bench-Verified! It resolves 64.6% of issues.”article, stated
“I used Weave to track everything I did, and used Weave’s eval framework for all of the experiments I ran.”article, stated
“This charts view is super useful for watching live runs, and digging into results statistically.”article, stated
“I spent tons of time in the table view and rollout drawer, to understand instances where a new model did worse or better than prior models.”article, stated

Outcomes

The article reports 500 benchmark issues, 5 rollouts per instance, 977 evaluations over roughly two months, and a 64.6% resolved rate.

4 supporting quotes
“Our solution is the first o1-based agent that we know of, and it tops the SWE-Bench Verified leaderboard.”article, stated
“Weave itself improved a ton while I was doing this work. In particular the new playground with first-class support for testing multiple trials of the same prompt was invaluable.”article, stated
“Along the way I built some new tools, that now make up what we currently call “Eval Studio”.”article, stated
“### Phaseshift Phaseshift is a new framework for composing AI agents. I wrote it in typescript because its powerful type system helps me reason about interfaces and composition.”article, stated