Skip to content

Add missing extract / prepare scripts for task-intent generation#4

Open
xhluca wants to merge 1 commit into
mainfrom
fix/missing-prepare-tasks-intents-prompts
Open

Add missing extract / prepare scripts for task-intent generation#4
xhluca wants to merge 1 commit into
mainfrom
fix/missing-prepare-tasks-intents-prompts

Conversation

@xhluca

@xhluca xhluca commented May 8, 2026

Copy link
Copy Markdown
Contributor

What

The documented pipeline jumps from a3-explore straight to scripts/generate_task_intents.py, but generate_task_intents.py consumes prepared prompt files under outputs/task_intents/prompts/<exploration_model>/ that the released code had no script to produce. This PR ports the two intermediate scripts from the internal repo and documents Step 2 properly.

Changes

  • scripts/extract_chat_messages.py — converts an agentlab study directory ($AGENTLAB_EXP_ROOT/<study_dir>/<task_dir>/step_*.pkl.gz) into a parallel JSON tree at outputs/chat_messages/<study_dir>/<task_dir>/step_*.json. Each output JSON contains the chat messages, goal, screenshot path, and step number for that step. Supports --find-latest <agent> to auto-locate the most recent exploration study.

  • scripts/prepare_tasks_intents_prompts.py — for each trajectory in the chat-messages tree, samples N steps (default 3, skipping step_0), appends TASK_INTENT_PROMPT_TEMPLATE (parameterized by WEBARENA_ANNOTATOR_INSTRUCTIONS and --num_intents) as a final user turn, and writes each as outputs/task_intents/prompts/<exploration_model>/task_<i>.step_<j>.json — exactly the layout generate_task_intents.py expects.

  • README.md — Step 2 of the pipeline now lists the four sub-steps (a3-exploreextract_chat_messages.pyprepare_tasks_intents_prompts.pygenerate_task_intents.py) and includes a short paragraph explaining what part of the trajectory is fed to the Task Designer and how the step index is sampled.

Resolves

Question about the missing intermediate step between a3-explore and generate_task_intents.py. Documents the trajectory representation passed to the Task Designer (full chat-message history of one randomly sampled step + one appended user turn).

Notes

The two scripts are direct ports from the internal repo with the only change being llm_annotatorsagent_as_annotators in two import lines.

The pipeline section of the README jumps straight from `a3-explore` to
`scripts/generate_task_intents.py`, but the latter consumes prepared prompts
under `outputs/task_intents/prompts/<exploration_model>/` that the released
code did not provide a way to build. This adds the two intermediate scripts
and documents the full Step 2 in the README, including which part of the
exploration trajectory is fed to the Task Designer and how `step_num` is
selected (random sample of N steps per trajectory, dropping step 0).

- scripts/extract_chat_messages.py: agentlab `step_*.pkl.gz` -> per-step JSON
  with chat messages, goal, screenshot path, etc.
- scripts/prepare_tasks_intents_prompts.py: per-trajectory random step sample
  + appended TASK_INTENT_PROMPT_TEMPLATE user turn, written as
  `task_<i>.step_<j>.json` matching `generate_task_intents.py`'s expected
  input layout.
- README.md: expand Step 2 to spell out the four sub-steps and the sampling
  semantics.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant