home / skills / bdambrosio / cognitive_workbench / scienceworld-reset

This skill initializes a ScienceWorld episode by loading scenario, difficulty, and seed from config and returning the first observation with a session_id.

npx playbooks add skill bdambrosio/cognitive_workbench --skill scienceworld-reset

Review the files below or copy the command above to add this skill to your agents.

Files (2)
SKILL.md
1.5 KB
---
name: scienceworld-reset
type: python
description: "Start a ScienceWorld episode. Reads scenario, difficulty, and seed from scienceworld_config in character YAML. Returns the initial observation plus a session_id for subsequent steps."
schema_hint:
  value: "ignored (scenario comes from scienceworld_config)"
  out: "$variable"
examples:
  - '{"type":"scienceworld-reset","out":"$sw_session"}'
---

# ScienceWorld Reset (Level 4)
## Input
- Scenario, difficulty, and seed are read from `scienceworld_config` in the character YAML file
- `value` parameter is ignored (scenario comes from config)
- No parameters needed - tool reads everything from config

## Output
- Note ID (bound to `out` variable) containing:
  - `text`: initial observation/description
  - `metadata.session_id`: identifier for this session
  - `metadata.scenario`, `metadata.variation_idx`, `metadata.simplification`, `metadata.seed`
  - `metadata.reward` (0 at reset), `metadata.done` (false)

## Requirements
- Python package `scienceworld` available in the environment.
- ScienceWorld assets accessible (installed with the package).

## Configuration
Requires `scienceworld_config` section in character YAML:
```yaml
scienceworld_config:
  scenario: "waterplant"
  difficulty: 0
  seed: 42
```

## Common Workflow
```json
{"type":"scienceworld-reset","out":"$sw"}
{"type":"scienceworld-act","action":"look","out":"$o1"}
```

Note: `scienceworld-act` no longer requires `session_id` - it uses the active session stored in `executive_node.scienceworld_env`.

Overview

This skill starts a new ScienceWorld episode using scenario settings read from the character YAML. It initializes the environment and returns the first observation plus a session_id and metadata for the session. The skill ignores any external value parameter because it reads scenario, difficulty, and seed from the configured scienceworld_config.

How this skill works

When invoked, the skill reads the scienceworld_config section from the character YAML to determine scenario, difficulty, and seed. It calls the scienceworld package to create and reset an environment, then returns the initial observation text and a note containing metadata such as session_id, scenario details, seed, reward (0), and done (false). The active session is stored for subsequent act steps, so follow-up tools can use the current environment without passing session_id explicitly.

When to use it

  • Start a new ScienceWorld episode using the scenario from your character configuration.
  • Reinitialize the environment when you want a fresh start with a known seed and difficulty.
  • Prepare the environment before issuing action steps (like look, move, or interact).
  • Recover from an invalid state by resetting and obtaining a new session_id.
  • Run reproducible experiments by resetting with a deterministic seed.

Best practices

  • Ensure the python package scienceworld and its assets are installed and accessible in the runtime environment.
  • Set scenario, difficulty, and seed under scienceworld_config in the character YAML before calling the skill.
  • Treat the returned note’s metadata.session_id as the authoritative identifier for the session.
  • Use the provided initial observation to plan the next action and call scienceworld-act; session management is handled automatically.
  • Log the metadata fields (scenario, variation_idx, simplification, seed) to reproduce or debug episodes.

Example use cases

  • Automated testing: reset with a fixed seed to reproduce a task failure reliably.
  • Curriculum learning: initialize episodes at varying difficulty levels defined in config.
  • Interactive play: start a scenario and immediately present the initial observation to an agent or user.
  • Batch experiments: programmatically reset multiple times with different seeds to gather statistics.
  • Debugging: reset to a known state to inspect environment setup and assets.

FAQ

Do I need to pass parameters to the skill?

No. The skill reads scenario, difficulty, and seed from scienceworld_config in the character YAML and ignores external value parameters.

What does the returned note include?

It includes text (initial observation), metadata.session_id, metadata.scenario, variation index/simplification/seed, metadata.reward (0), and metadata.done (false).

Is scienceworld-act required to receive session_id?

No. scienceworld-act uses the active session stored in the executive node environment, so you do not need to pass session_id for subsequent actions.