refactor: collapse /plan to a single LLM call - #41
Merged
Conversation
/plan made two LLM calls per request: the Agents SDK planner produced the structured PRDPlan that actually builds the PRD, and a second Responses API call whose free-text output was stored as raw_plan but never used to build the PRD or anything else. Remove the redundant call and the machinery that only existed to feed it: - drop openai_client.create_plan from the planner flow and raw_plan from the result dict (OpenAIClient itself stays: procedure_runner uses it for procedure model steps) - delete the DSPy side path (dspy_program.py, USE_DSPY setting, dspy_guidance metric): its guidance was computed after the planner already ran and only fed the deleted second call - delete the decorative YAML tool registry (tools.py, tools.yaml, TOOL_CONFIG_PATH): schemas were passed to the Responses API with no tool-call execution loop; the live planner path uses the Agents SDK @function_tool system instead config/agents.yaml is kept: agent_sdk loads it to override planner and critic agent defaults.
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
/planmade two LLM calls per request. The OpenAI Agents SDK planner produces the structuredPRDPlanthat actually builds the PRD; a second Responses API call produced free text stored asraw_planthat was never used to build the PRD or anything else. This PR removes the redundant call and everything that only existed to support it:agent_pm/planner.py(openai_client.create_plan) andraw_planfrom the result dict. Nothing else consumedraw_plan(models, traces, app response handling all verified by grep).agent_pm/dspy_program.py, theUSE_DSPYsetting, the guidance-application code inplanner.py, and thedspy_guidance_totalmetric. The guidance was computed after the planner agent already ran and only fed the deleted second call.agent_pm/tools.py,config/tools.yaml, and theTOOL_CONFIG_PATHsetting. The schemas were passed to the Responses API with no tool-call execution loop; the live planner path uses the Agents SDK@function_toolsystem (agent_sdk.py), which is untouched..env.exampleand README accordingly; updatedtests/test_planner.pyandtests/test_dry_run_paths.py(dropped 5 DSPy/second-call tests, removed now-dead mocks, no unrelated assertions weakened).Deliberately kept (audit said candidate for removal, but they're live)
agent_pm/clients/openai_client.py— used byprocedure_runner.pyfor procedure model steps (and asserted intests/test_connectors.py).config/agents.yaml+AGENTS_CONFIG_PATH— loaded byagent_sdk.py::_load_agent_config_fileto override planner/critic agent defaults; also referenced by the health endpoint andtests/test_agent_sdk.py.Test plan
uv run ruff check .— passuv run ruff format --check .— pass (112 files)uv run mypy agent_pm— pass (72 source files)uv run pytest -q— 134 passed (was 139; −5 removed DSPy/second-call tests)dspy,raw_plan,tools.yaml,ToolRegistry,TOOL_CONFIG_PATH