Repository navigation
Agent model/budget env tuning + self-correction retry - #9
Merged
Merged
Conversation
…nable Agent model was hardcoded to openai/gpt-4o-mini and output caps/compression were fixed in source. Add opt-in env overrides so a free OpenRouter model and looser budgets can be used without editing code: - STACKFORGE_MODEL / STACKFORGE_MODEL_<AGENT>: per-agent or global model - STACKFORGE_OUTPUT_SCALE: scale factor on maxOutputTokens and tokenBudget - STACKFORGE_COMPRESSION: global compression level override Defaults are unchanged when env is unset, so existing behaviour and tests are preserved. Document the new vars in .env.example.
Weak/free models frequently emit malformed or incomplete JSON, which previously failed the entire job on the first validation error. When validateStepOutput throws, run one repair call that shows the model its own output plus the validation error and asks for corrected strict JSON, then re-validate. If the repair also fails, the original failure propagates as before. Add a test proving the engine recovers from an invalid planner output via exactly one repair pass with no agent_failed event emitted.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
The 'remove husky pre-commit hooks' change dropped husky from package.json but left it in bun.lock, so 'bun install --frozen-lockfile' (used in CI) failed. Regenerate the lockfile to drop the stale husky entry.
This branch was successfully 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
Two improvements to how the agent pipeline runs, aimed at making it work well on free/weak models without editing source.
Changes
1. Env-tunable agent config (
packages/agents/src/config/agent.configs.ts)Model was hardcoded to
openai/gpt-4o-mini; output caps and compression were fixed in source. New opt-in env overrides:STACKFORGE_MODEL/STACKFORGE_MODEL_<AGENT>- global or per-agent modelSTACKFORGE_OUTPUT_SCALE- scale factor onmaxOutputTokensandtokenBudgetSTACKFORGE_COMPRESSION- global compression level overrideDefaults are identical when env is unset, so existing behaviour and tests are preserved. Documented in
.env.example.2. Self-correction retry (
packages/agents/src/workflow/engine.ts)Weak/free models frequently emit malformed JSON, which previously failed the entire job on first validation error. On
validateStepOutputfailure, the engine now runs one repair call (shows the model its bad output + the error, asks for corrected strict JSON) and re-validates. If repair also fails, the original error propagates as before.Testing
agent_failedemittedSTACKFORGE_OUTPUT_SCALE=1.5 STACKFORGE_COMPRESSION=low: full pipeline completes, download produces a valid ZIP