StateForge: Synthesizing 69-Call Tool-Use Data via State-Change Supervision

StateForge (arXiv:2611.38108) unifies executable environment synthesis, SFT, and RL under exact state-change supervision—generating 544 environments and 1,697 tasks averaging 69 tool calls each—enabling compact 4B and 9B agents to score 91.17%–91.74% on tau2-Bench and 43.33%–46.67% on DeepPlanning.
StateForge: Synthesizing 69-Call Tool-Use Data via State-Change Supervision: StateForge (arXiv:2611.38108) unifies executable environment synthesis, SFT, and RL under exact state-change supervision—generating 544 environments and 1,697 tasks averaging 69 tool calls each—enabling compact 4B and 9B agents to score 91.17%–91.74% on tau2-Bench and 43.33%–46.67% on DeepPlanning. Designed as a zero-dependency, open-source TypeScript architecture under the MIT License with native Model Context Protocol (MCP) support and deterministic phase state machines.
- 91.17%–91.74% Macro tau2-Bench: Outperforms Claude Opus 4.5 (85.30%), Gemini-3-Pro-Pre (82.47%), and GPT-5.2 High (78.16%) using only 4B–9B parameters.
- 69 Tool Calls Per Task Depth: Covers 544 synthesized environments averaging 50.87 tools/env—nearly 4–6x deeper than EnvScaler (15–17 calls) and EnvFactory (11.9).
- Three Trajectory Modes Per Target: Direct (full goal), Progressive (staged reveal), and Recovery (recoverable environment faults) share one exact target state diff.
- Zero Alternative-Path False Negatives: Grades RL rollouts by exact final state-change matching, rewarding valid tool sequences while penalizing unintended side effects.
import { createAgent } from '@smoke-monkey/harness';const stateVerifiedAgent = createAgent({agentId: 'stateforge-4b-rl-executor',provider: 'openai-compatible',model: 'StateForge-4B-RL',baseUrl: 'http://127.0.0.1:8000/v1',workspacePath: process.cwd(),permissions: {read_file: 'allow',write_file: 'allow',run_command: 'ask',},});async function runStateCheckedWorkflow() {const result = await stateVerifiedAgent.run('Execute staged inventory reallocation, recover from simulated lock timeout on step 4, and verify final SQL state diff matches target snapshot.');console.log('Verified State Diff Result:', result.summary);}runStateCheckedWorkflow().catch(console.error);
Watch: Related Video Guides
RL Training Over Black-Box Agent Harnesses: How ClawGym II Optimizes Long-Horizon Agents
RL Environments Explained: How AI Agents Learn Real-World Work | Brendan Foody, Mercor
What Is StateForge? State-Change Supervision Over Reference-Call Matching
StateForge (arXiv:2611.38108) is a training and environment-synthesis framework that replaces brittle tool-call sequence matching with exact state-change supervision across SFT and RL. By building 544 executable environments (50.87 tools/env) and executing dependency-guided tool chains averaging 69 calls per task (1,697 tasks total), StateForge derives verifiable target state diffs.
Each task spawns three trajectory modes targeting the identical final state diff: Direct (complete initial specification), Progressive (staged multi-turn goal reveals), and Recovery (injected mid-horizon perturbations requiring rollback or retry). RL rewards credit required state mutations and penalize unintended side effects.
tau2-Bench, DeepPlanning & BFCL-v3 Multi-Turn Results
Evaluated against both frontier proprietary models and prior open-weight agent checkpoints, StateForge-4B-RL and StateForge-9B-RL achieve top macro scores across multi-turn tool execution benchmarks.
| Model | Scale / Class | tau2-Bench Macro | DeepPlanning Acc. | BFCL-v3 Multi-Turn Overall |
|---|---|---|---|---|
| GPT-5.2 High | Proprietary Frontier | 78.16% | 61.40% | 21.13% |
| Claude Opus 4.5 | Proprietary Frontier | 85.30% | 51.40% | 18.88% |
| Gemini-3-Pro-Pre | Proprietary Frontier | 82.47% | 54.00% | 38.25% |
| Qwen3.5-4B (Base) | 4B Open Backbone | 84.40% | 35.83% | 25.25% |
| EnvScaler-8B | 8B Agent Baseline | 39.47% | 10.83% | 20.13% |
| StateForge-4B-RL | 4B SFT + State RL | 91.17% | 43.33% | 27.25% |
| StateForge-9B-RL | 9B SFT + State RL | 91.74% | 46.67% | 26.75% |
Compared against prior synthetic tool datasets, StateForge's 544 environments scale tool density to 50.87 tools/env and 69 calls/task versus EnvFactory (85 envs, 9.91 tools/env, ~11.9 calls) and EnvScaler (191 envs, 18.58 tools/env, ~15–17 calls).
Supervise End-State Diffs, Not Exact Tool Call Traces
Grading agents by exact intermediate tool-call matching rejects valid recovery sequences. Capture pre-run and post-run state snapshots and verify required keys plus zero unintended mutations.
Implementing State-Change Supervision in Local Agent CI
Apply StateForge's state-change verification pattern inside your own tool-use test harness using deterministic SQLite or filesystem snapshot diffs before and after agent execution.
# Serve compact 4B RL checkpoint locally via vLLM with tool-calling enabled
vllm serve StateForge/StateForge-4B-RL \
--enable-auto-tool-choice \
--tool-call-parser hermes \
--max-model-len 32768 \
--port 8000
# Snapshot workspace + DB state before and after 60+ step agent rollout
sqlite3 env.db .dump > /tmp/state_before.sql
npx smoke-monkey run --model StateForge-4B-RL --task-file progressive_task.json
sqlite3 env.db .dump > /tmp/state_after.sql
diff -u /tmp/state_before.sql /tmp/state_after.sql | tee /tmp/state_diff.patchMirroring Progressive & Recovery Modes in Smoke Monkey Harness
Smoke Monkey Harness natively enforces StateForge-style outcome verification: the Verify phase asserts target repository tests, git diffs, and database invariants rather than dictating a rigid sequence of read_file or bash calls, while the Recover phase mirrors StateForge's perturbation recovery loop when transient tool failures occur.
Frequently Asked Questions
Q:How does StateForge avoid rejecting valid alternative tool sequences?
Instead of matching generated tool calls against a single reference trace, StateForge compares the environment's final state against the reachable target state diff—crediting required changes and penalizing unintended side effects.
Q:How long are the tool-calling trajectories in StateForge?
StateForge synthesizes 544 executable environments (averaging 50.87 tools per environment) and 1,697 tasks averaging 69 tool calls per task, far deeper than EnvFactory (~11.9) and EnvScaler (~15–17).
Q:Can a 4B model trained with StateForge compete with frontier APIs?
Yes. StateForge-4B-RL achieves 91.17% macro-average on tau2-Bench and 27.25% on BFCL-v3 Multi-Turn (91.74% and 46.67% DeepPlanning for StateForge-9B-RL), surpassing GPT-5.2 High (78.16%) and Claude Opus 4.5 (85.30%) on tau2-Bench.
Q:What are the three trajectory modes in StateForge?
Every task is synthesized in Direct mode (complete goal upfront), Progressive mode (goals revealed incrementally across turns), and Recovery mode (injected recoverable environment errors).
Related Alternatives & Comparisons
Related Architecture Guides
View all guidesBest Open Source Coding Agents in 2026: Free, Local & Fully Hackable Harnesses
MCP Server Security Best Practices: Hardening Model Context Protocol Agents in 2026
Open Source Coding Agent Harness: Build a Forkable, Local AI Engineering Runtime
Build with Smoke Monkey Harness
Zero dependencies. 24 built-in tools. Human-in-the-loop safety. 100% open source under the MIT License.