Skip to content

Strands Math Agent

An RL-trainable GSM8K math agent using Bedrock AgentCore RL Toolkit. The agent solves grade-school word problems by invoking a calculator tool for arithmetic steps and emitting a final answer after ####.

This is the “hello world” for the toolkit — minimal prompt and single tool. Start here.

Terminal window
cd examples/strands_math_agent
uv venv --python 3.13 && source .venv/bin/activate
uv pip install -e .
# Run the RL-adapted app as a local HTTP server
python rl_app.py

Deploy using the commands in the Math README, then use its Runtime ARN in the slime training configuration.

  • basic_app.py — deployment-ready reference using BedrockModel.
  • rl_app.py — RL-adapted version; reads base_url / model_id from _config, returns {"reward": ...}.
  • reward.py — GSM8KReward: extract the #### answer, exact-match against ground truth.
  • evaluate.py — batch evaluation on GSM8K.

For local setup, request examples, and GSM8K evaluation, see the full README on GitHub.