Skip to content

openai_agents: keep RunConfig.model as a name so the run model's defaults apply - #458

Merged
campoy merged 1 commit into
fix/openai-agents-run-agent-without-copyfrom
fix/openai-agents-run-model-defaults
Nov 9, 2026
Merged

campoy merged 1 commit into
fix/openai-agents-run-agent-without-copyfrom
fix/openai-agents-run-model-defaults

Conversation

@campoy

@campoy campoy commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

Depends on #426. This PR targets #426's branch, so the diff shows only this change. Once #426 merges, I'll point it at main.

  • RunConfig.model stays a name. The runner no longer wraps a string RunConfig.model in a _TemporalModelStub. Why was the stub there? To swap in Temporal's model. But the plugin's model provider already turns every model name into the model Activity, the same reason Breaking: openai_agents: run your agents, not copies, so permanent approvals carry over #426 dropped the agent copies. With the name in place, the SDK applies the run model's default settings, as it does without the plugin. A model that isn't a string still fails with the same error.
  • The model Activity keeps extra_args. When an agent is left at its default model settings, the model Activity swaps them for the defaults of the model its provider picks. That swap dropped extra_args, so a SandboxAgent's compaction threshold got lost. Now it stays.

Why?

#426 runs your agents, not copies, so the SDK finally sees each agent's model name. Its description lists two gaps it leaves "as before". This PR closes both.

What will you notice?

  • With RunConfig(model="gpt-5.4-pro") and an agent at its default settings, the model call now gets the defaults for gpt-5.4-pro, like reasoning.effort="medium". That's upstream's rule. Before, it got none.
  • A SandboxAgent with a Compaction capability gets the run model's threshold when RunConfig.model is set. When neither the agent nor RunConfig names a model, it keeps its compaction threshold instead of losing it.

What about replay? Model calls keep the same Activity type. With RunConfig.model set, their summary is now the agent's name, as for other runs, where it was empty. Replay doesn't compare summaries, and a run recorded on #426 with RunConfig.model set replays on this change. Replay doesn't compare Activity inputs, so a run that now sends different model settings replays and continues with them.

Checklist

  1. Closes: no issue.

  2. How was this tested:

  • New: test_run_model_gets_its_own_default_settings runs an agent with no model under RunConfig(model="gpt-5.4-pro") and checks that the model gets that model's default settings.
  • New: test_alignment_keeps_extra_args checks that a compaction extra_args entry survives the swap to the provider model's defaults.
  • make lint and make test pass with openai-agents 0.24.0 (533 passed, 1 skipped).
  1. Any docs updates needed? No.

…args

The runner no longer turns a string RunConfig.model into a model stub. The
plugin's model provider already turns the name into the model Activity, so
the SDK now applies the run model's default settings, as it does natively,
and a SandboxAgent's Compaction gets the run model's threshold.

When the model Activity swaps an agent's implicit default settings for the
defaults of the model its provider picks, it now keeps the extra_args that a
SandboxAgent's capabilities add, such as the compaction threshold.
@JasonSteving99
JasonSteving99 marked this pull request as ready for review November 9, 2026 23:25
@JasonSteving99
JasonSteving99 requested a review from a team as a code owner November 9, 2026 23:25
@campoy
campoy merged commit ec4ee7b into fix/openai-agents-run-agent-without-copy Nov 9, 2026
37 checks passed
@campoy
campoy deleted the fix/openai-agents-run-model-defaults branch November 9, 2026 23:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants