home / skills / bdambrosio / cognitive_workbench / scienceworld-act

This skill executes a ScienceWorld action in the active session and returns observation, reward, and completion status.

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

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

Files (4)
SKILL.md
934 B
---
name: scienceworld-act
type: python
description: "Take a ScienceWorld action in the active session. Returns observation, reward, done. No session_id needed - uses active session from executive_node."
schema_hint:
  action: "string (text command)"
  out: "$variable"
examples:
  - '{"type":"scienceworld-act","action":"look","out":"$step1"}'
---

# ScienceWorld Act (Level 4)
## Input
- `action`: text command (e.g., "look", "go north", "take shovel")
- No `session_id` needed - uses active session from executive_node.scienceworld_env

## Output
- Note ID (bound to `out` variable) containing:
  - `text`: observation after the action
  - `metadata.reward`, `metadata.done`
  - `metadata.session_id`, `metadata.action`, `metadata.info`

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


Overview

This skill runs a single action inside the active ScienceWorld session and returns the resulting observation, reward, and done flag. It uses the executive node's active ScienceWorld environment, so you do not need to provide a session_id. The skill is designed for rapid iterative interaction with the environment during policy evaluation or scripted play.

How this skill works

You call the skill with a text command like "look", "go north", or "take watering can". The skill sends the command to the active scienceworld_env and returns a note containing the observation text plus metadata fields: reward, done, session_id, action, and info. Outputs are bound to the specified out variable so downstream steps can reference the observation and metadata.

When to use it

  • Stepping through an existing ScienceWorld session action-by-action.
  • Collecting observations and rewards for reinforcement learning rollouts.
  • Testing and debugging text commands against the current environment state.
  • Driving scripted agents or interactive demos without managing session IDs.

Best practices

  • Keep actions short and in the same imperative style used by the environment (e.g., "take shovel").
  • Check metadata.done after each action to handle episode termination promptly.
  • Store the returned session_id and info if you need to correlate across multiple skills.
  • Rate-limit actions when running automated loops to avoid overwhelming the environment.

Example use cases

  • Reset the environment, then call look and take commands to build an initial observation sequence.
  • Run single-step interactions inside a training loop and collect reward and done to update a policy.
  • Use in a test harness to verify that specific commands produce expected observations and info.
  • Drive a human-in-the-loop demo where the UI sends typed commands to the active session.

FAQ

Do I need to pass a session_id?

No. The skill uses the executive node's active ScienceWorld session automatically.

What metadata is returned?

The note includes metadata.reward, metadata.done, metadata.session_id, metadata.action, and metadata.info alongside the observation text.