Repository navigation
feat(envs): add AppWorld benchmark (react_code protocol) - #471
Yanan (yanan1116) wants to merge 3 commits into
Conversation
|
@microsoft-github-policy-service agree |
|
Thank you for this. It's a carefully built environment and it was a pleasure to review. Things I especially liked:
It's also stdlib-only, so people who don't use AppWorld get no new dependencies, and the wheel ships the prompt and split files. Before merging I'd like a few small, concrete changes, mostly about the AppWorld server processes:
Small nits, not blocking:
Thanks again. With these changes this will be a great addition. |
|
Yifan Yang (@Yif-Yang) thanks. working on it. and will report test results soon. |
…e, port locks, licence, results page)
0b387ed to
787b337
Compare
|
Thank you for the careful review. Yifan Yang (@Yif-Yang) All nine points and the nits are addressed in the new commit, and the branch is rebased on current
Nits:
Validation: full suite 2655 passed, 23 skipped, 4 xfailed; ruff has nothing new beyond the 6 pre-existing E402 in Re-test with this code on all 585 test tasks, using the skills trained with the earlier revision. Nothing was retrained.
|
Summary
This adds AppWorld as a SkillOpt environment (
env.name: appworld). Agents complete everyday tasks by writing Python against 9 simulated apps, and each task is graded by AppWorld's own state-based tests. The PR also adds a results page with three executor / optimizer settings and a re-test of their best skills with the current code.Design
Protocol. The episode is an adaptation of AppWorld's
react_codeagent, not the leaderboard protocol, so scores are not comparable with the AppWorld leaderboard.execute_codetool instead of fenced code blocks. The few-shot is sent as one message, under a short system prompt of our own.## Skill Knowledge, and an empty skill adds nothing.{{ app_descriptions }}. The app list is read once per process from the AppWorld venv, and a venv that cannot produce it stops the run.Servers. AppWorld's dependencies conflict with SkillOpt's, so servers run from a separate venv (
env.appworld_venvor$APPWORLD_VENV).python -m uvicorn appworld.serve.environment:app --host 127.0.0.1. Theappworld serve environmentCLI is not used: it binds0.0.0.0and kills whatever holds its port.PATH,HOME,LANG,LC_*,TMPDIR,APPWORLD_ROOT,APPWORLD_CACHE,NO_PROXY. Requests to it bypass proxies./initialize(withload_ground_truth: false),/execute,/task_completed,/evaluateand/closeare used./closeruns after every task, so a reused server starts each task from a fresh world.flock, so concurrent runs can share a range. The lock file records the server pid, and a later run stops a server whose owner died.Scoring.
hardis AppWorld task goal completion;softis the fraction of tests passed, counting only tests a do-nothing agent fails. An infrastructure failure is kept and counted as a failure.Splits.
python -m skillopt.envs.appworld.make_splitbuilds them from the user's local AppWorld data:--test_set scen1gives a 195-task subset (one task per scenario).AppWorld distributes its data encrypted, so task instructions are not committed.
Failure feedback. For failed train tasks, the analysts see up to 8 failed test descriptions from
/evaluate. Val is used only for its score, and test is never seen during training.env.fail_reason_stylepicks the wording:checks(default) leads with the failed tests;legacykeeps the earlier text.Configs.
configs/appworld/holdsdefault.yaml, a Qwen3.8-27B (thinking off) base, and four arms: gated slow update, force-accepted slow update, slow update off, and Accept Every Edit. The model endpoint comes fromQWEN_CHAT_BASE_URL.Licence. The prompt is AppWorld's (Apache-2.0).
prompts/LICENSEandprompts/NOTICE(source URL, path, commit42b5bcf) ship next to it.Docs.
docs/guide/appworld.mdcovers install, servers, splits, running and scoring.docs/guide/appworld-results.mdholds the results.Experiments
Test success rate (AppWorld task goal completion) on all 585 test tasks. Training: 4 epochs × 3 steps (batch 40) on the 90 train tasks, temperature 0.7. "Best skill" has the best val score, with its training step in parentheses. "Last skill" is the final skill, and "= Best" means the two are the same skill. Each cell is one training run and one test run.
These three tables were produced with an earlier revision of this environment, and no training run has been made with the current code. That revision differed in four ways:
legacy;/close.The re-test below checks whether these changes move the scores.
Qwen3.8-27B executor, Qwen3.8-27B optimizer (both thinking off)
Qwen3.5-4B executor, Qwen3.5-4B optimizer (both thinking on)
Qwen3.5-4B executor (thinking on), Qwen3.8-27B optimizer (thinking off)
In this table the trajectory budget also differs between columns: 480,000 characters for Gated and turned off, 330,000 for the other two.
Findings
Re-test with the current code
The No-skill baseline and the best cell of each table were tested again with this PR's code on all 585 test tasks, with the same executor settings. The skills are the ones trained with the earlier revision; nothing was retrained.
show_app_descriptionswas called in 44% of No-skill episodes (94% before) and in 9–12% of skill episodes (76–79% before).test_normaltasks and 258 of the 417test_challengetasks.test_normaltasks.Code layout
episode.py: the episode loop, the server process (command, environment, start and stop), the prompt,execute_codedispatch and budgets.rollout.py: the SkillOpt side, i.e. the target-model call, skill injection, the server pool with port locks, failure text and the reflection conversation.grading.py: turns AppWorld's/evaluateoutput intohardandsoft.prompts/react_code_instructions.txt: AppWorld's prompt, copied unchanged, withLICENSEandNOTICE.pyproject.tomlships the prompt, licence files and split lists, so a wheel install has them.Test plan
tests/test_appworld_env.py(37 tests, offline). A fake AppWorld venv whosebin/pythonserves the routes backs end-to-end tests ofrun_batch:/initializesendsload_ground_truth: false;/closeruns once per task;There are also unit tests for the port lock, pool exhaustion,
stop(), the SIGTERM handler, unknown tools, splits, grading, failure text and prompt filling.python -m pytest -q tests: 2655 passed, 23 skipped, 4 xfailed.ruff checkis clean on the changed files.Live checks against a real AppWorld install:
/proc/<pid>/environ);ssshows 127.0.0.1 only;End-to-end smoke against a Qwen3.8-27B endpoint: 4 train, 3 val and 3 test tasks, 2 epochs, then
eval_only.The 585-task re-tests above, run with this code: 0 infrastructure failures, and no server or lock left afterwards.