Repository navigation
Conversation
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
ananthsub
force-pushed
the
inprocess-self-call-perf
branch
2 times, most recently
from
May 28, 2026 07:36
ed66904 to
75473cb
Compare
ananthsub
marked this pull request as ready for review
May 28, 2026 12:54
Contributor
|
Did you run training or benchmarks to confirm no accuracy or convergence degradation? Seems fine to me otherwise, although the logic around cookies seems to change a bit |
ananthsub
marked this pull request as draft
June 16, 2026 17:06
ananthsub
marked this pull request as ready for review
August 31, 2026 17:18
ananthsub
force-pushed
the
inprocess-self-call-perf
branch
from
August 31, 2026 17:18
75473cb to
8a80d0a
Compare
…sponses Each agent's `/run` handler previously made an HTTP self-call to its own `/v1/responses` endpoint, paying for aiohttp round-trip, FastAPI middleware, and pydantic re-validation on every rollout. This converts all production agents that still did this to call the implementation in-process. The refactor extracts the existing `responses()` body into a private `_responses(body, cookies) -> (response, set_cookies)` helper. The public `responses(request, response, body)` method keeps its FastAPI signature and is now a 4-line adapter that delegates to `_responses`, so external HTTP callers see no change. `/run` replaces the 7-line self-call block with two lines that call `_responses` directly. Agents converted: simple_agent, proof_refinement_agent, non_executing_simple_agent, speed_bench_agent, cvdp_agent, finance_agent, browsecomp_agent, hermes_agent, claude_code_agent, and the langgraph_agent base + 4 subclasses (rewoo, orchestrator, parallel_thinking, reflection). swe_agents, aviary_agent, verifiers_agent, and stirrup_agent were already on this pattern. Microbenchmark shows ~0.7-1.2 ms framework overhead per self-call at concurrency=1, scaling to a ~70-150x rps multiplier in the LLM-overhead-isolated case. End-to-end with a mock model: simple_agent +25% rps / 20% wall-time reduction; proof_refinement_agent (3 self-calls per rollout) up to +2x rps / 50% wall-time reduction at concurrency=256. With a real OpenAI model in the loop the absolute per-rollout savings carry over (~7% rps on simple, ~13% on pref) and the HTTP path also hit FD exhaustion at concurrency=1024 where the in-process path did not. Signed-off-by: Ananth Subramaniam <[email protected]>
Keep the existing in-process helper so MCP configuration, skills, rollout identity, and observation collection remain in scope. Signed-off-by: Ananth Subramaniam <[email protected]>
ananthsub
force-pushed
the
inprocess-self-call-perf
branch
from
September 1, 2026 00:06
8a80d0a to
03852a7
Compare
5 tasks
Contributor
Author
5 tasks
7 tasks
This was referenced Sep 8, 2026
Contributor
Author
|
closing in favor of environment server abstraction, which will keep this hop |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A production agent's
/runpath should not send an HTTP request back to that same agent's/v1/responsesendpoint. The loopback request adds an aiohttp round trip, FastAPI middleware, Pydantic validation, and socket pressure to every rollout.This change replaces every remaining production self-call with an in-process invocation. The public
responses(request, response, body)endpoint remains unchanged for external callers.The in-process helpers preserve request-specific behavior that was added after the original implementation, including cookies, rollout-scoped URL paths and IDs, trajectory capture, retry handling, metadata, and diagnostics.
Scope
The optimization now covers:
simple_agent,non_executing_simple_agent,simple_agent_with_compaction, andsimple_strands_agentproof_refinement_agent,speed_bench_agent,browsecomp_agent,cvdp_agent, andfinance_agentcline_agent,kilocode_agent,openclaw_agent,opencode_agent,pi_agent, andprime_agenthermes_agent,remote_agent,scicode_agent,terminus_2_agent,critpt_agent, andtool_simulation_agentconversational_tool_use/simulationlanggraph_agentbase and itsrewoo,orchestrator,parallel_thinking, andreflectionimplementationsAgents that already used an in-process path, including
claude_code_agent, are unchanged. An audit ofresponses_api_agentsfound no remaining production posts from an agent to its own/v1/responsesendpoint.Performance
Model inference remains the dominant latency. In the original end-to-end measurements with a real OpenAI model, removing the self-call improved throughput by 7.5% for
simple_agentand 13.3% forproof_refinement_agent, which performs multiple response calls per rollout. The in-process path also avoids file-descriptor pressure from loopback connections at high concurrency.