Repository navigation
Description
Parent workstream: #3000
Slowdown path
flowchart LR
A[Agent run] --> B[Loopback HTTP POST]
B --> C[Agent middleware and validation]
C --> D[Episode loop]
D --> E[HTTP response parse]
Current behavior
SimpleAgent.run posts body.responses_create_params to the same agent server's /v1/responses route, waits for HTTP status, parses the JSON response, and recovers cookies. See SimpleAgent.run.
The self-call is not a simple function substitution. SimpleResponsesAPIAgent.setup_webserver registers rollout-prefixed route twins, and SimpleAgent.responses propagates model/resources cookies and optional trajectory data. See SimpleResponsesAPIAgent.setup_webserver and SimpleAgent.responses.
Impact and provenance
Measured
PR #1439 reports end-to-end throughput improvements of 7.5% for simple_agent and 13.3% for proof_refinement_agent in its original real-OpenAI-model measurements. These are the PR's measurements, not new measurements and not guaranteed for other agents or production workloads.
Expected
An in-process path should remove one loopback serialization/parse cycle, one middleware traversal, and associated socket pressure per self-call. Agents that self-call repeatedly may benefit more, but that remains workload-dependent.
Implementation constraints
- Preserve public
/v1/responsesbehavior for external callers. - Explicitly propagate resources/model cookies, rollout ID and URL correlation, token capture, model-call capture, trajectory data, telemetry, status/error semantics, and cancellation behavior.
- Cover every production agent that self-calls; do not introduce divergent helper contracts per agent.
- Keep downstream agent → model and agent → resources HTTP trust boundaries intact.
Acceptance criteria
- Production agents no longer POST to their own
/v1/responsesendpoint. - External
/v1/responsesroutes and rollout-prefixed variants remain compatible. - Stateful resources-server sessions and cookie updates survive multi-step rollouts.
- Evaluation/model-call capture, training token capture, trajectories, retries, errors, and cancellation retain parity.
- An audit test prevents new production self-calls.
Benchmark plan
Run alternating baseline/candidate end-to-end rollouts for simple_agent and a repeatedly self-calling agent such as proof_refinement_agent. Measure rollouts/s, p50/p99 latency, loopback requests, open sockets, CPU time, and failures at low and high concurrency. Include stateful resource sessions, capture enabled/disabled, and representative failure paths.
Related work/PRs
- Parent: Performance workstream: agent servers #3000
- Direct implementation: perf(responses_api_agents): bypass HTTP self-calls in all agents #1439
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDev WIP
Activity