SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2501.11425 · 2025

Agent-R: Training Language Model Agents to Reflect via Iterative Self-Training

arXiv · PDF · Open in the Atlas

Code that ran

11 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 1 violated it and 4 have no contract verdict; 4 failures of our instrument; 0 no recorded run), measured 2026-11-23; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2501.11425.json · badge: /api/ran/2501.11425.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
bytedance/agent-r canonical (classifier label)
classifier basis not recorded on the link
11 ran · 0 no recorded run
FunctionStatusWhere it lives
clean Ran
ran; our contract draft was wrong, not the code
bytedance/agent-r/mcts_utils/sciworld/data_utils_sw.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/evoagent, is pointer only (licence: NONE) · get_code("44320b583dfcfb30")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/evoagent, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

clean_look Ran
ran; our contract draft was wrong, not the code
bytedance/agent-r/mcts_utils/sciworld/eval_utils_sw.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/evoagent, is pointer only (licence: NONE) · get_code("1f706832c8a6cfa6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/evoagent, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

find_leaf_paths Ran
ran on a synthesized input
bytedance/agent-r/path_collection.py
code served (permissive licence) · get_code("aa7f0424abfd1dc9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

class TreeNode:
    def __init__(self, is_terminal=False, children=None):
        self.is_terminal = is_terminal
        self.children = children if children is not None else []

# Create a simple tree structure to test find_leaf_paths
# Tree structure:
#       root
#      /    \
#    n1      n2
#   /  \      |
#  n3  n4    n5
# n3 and n5 are leaves (terminal nodes with no children)

n3 = TreeNode(is_terminal=True, children=[])
n4 = TreeNode(is_terminal=False, children=[])
n5 = TreeNode(is_terminal=True, children=[])

n1 = TreeNode(is_terminal=False, children=[n3, n4])
n2 = TreeNode(is_terminal=False, children=[n5])

root = TreeNode(is_terminal=False, children=[n1, n2])

ARGS = {
    "node": root
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
find_non_alpha_index Ran
ran, honoured the contract we drafted
bytedance/agent-r/mcts_utils/sciworld/eval_utils_sw.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/evoagent, is pointer only (licence: NONE) · get_code("2e2114f582089313")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/evoagent, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

get_last_processed_index Ran
ran, honoured the contract we drafted
bytedance/agent-r/mcts_utils/llm_server.py
code served (permissive licence) · get_code("3267d566c3f09e5d")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned int, ndim 0, dtype family int, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
import tempfile

# Create a temporary directory and file for testing
temp_dir = tempfile.mkdtemp()
progress_file = os.path.join(temp_dir, "progress.txt")

# Write a test index to the progress file
with open(progress_file, 'w', encoding='utf-8') as f:
    f.write("42")

ARGS = {
    "progress_file": progress_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type int, ndim 0, dtype family int, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_real_task_id Ran
ran on a synthesized input
bytedance/agent-r/mcts_utils/sciworld/data_utils_sw.py
code served (permissive licence) · get_code("a42373c7254c4594")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Setup code for get_real_task_id

ARGS = {
    'task_name': 'boil'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
is_action_failed Ran
ran, violated the contract we drafted
bytedance/agent-r/mcts_utils/sciworld/eval_utils_sw.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/evoagent, is pointer only (licence: NONE) · get_code("d3708c14e4ebb83f")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/evoagent, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

node_avg_value Ran
ran on a synthesized input
bytedance/agent-r/path_collection.py
code served (permissive licence) · get_code("1e1d935fc3c062b8")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

class Node:
    def __init__(self, value, visits):
        self.value = value
        self.visits = visits

# Test case 1: node with positive visits
node_with_visits = Node(value=10.0, visits=5)

# Test case 2: node with zero visits
node_zero_visits = Node(value=10.0, visits=0)

# Use the first node as the argument
ARGS = {
    "node": node_with_visits
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
read_json Ran
ran; our contract draft was wrong, not the code
bytedance/agent-r/mcts_utils/llm_server.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/SCUA, is pointer only (licence: NONE) · get_code("fc1433d5441ae6d6")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/SCUA, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

read_jsonline Ran
ran; our contract draft was wrong, not the code
bytedance/agent-r/mcts_utils/llm_server.py
pointer only (licence: Apache-2.0); the stored copy get_code serves, from siyuyuan/evoagent, is pointer only (licence: NONE) · get_code("66af883835d43b5c")
How it ran

The body of this sample is withheld: this paper's link allows the body inline (Apache-2.0), but get_code serves the stored copy, first harvested from siyuyuan/evoagent, and GitHub detected no licence in that repository when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

sanitizeStr Ran
ran on a synthesized input
bytedance/agent-r/mcts_utils/sciworld/data_utils_sw.py
code served (permissive licence) · get_code("a3d1f7c9f307b55f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

torch.manual_seed(0)

ARGS = {
    'inStr': 'hello\nworld\ttest\n\tgreen house example'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 7 are also present in other papers whose code we hold (7 with at least one paper dated earlier, 0 the same month, 0 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
read_jsonline 2 other papers
2 dated earlier
2406.11375 (2024-06)
Boosting Scientific Concepts Understanding: Can Analogy from Teacher Models Empower Student Models?
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
clean 1 other paper
1 dated earlier
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
clean_look 1 other paper
1 dated earlier
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
find_non_alpha_index 1 other paper
1 dated earlier
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
get_last_processed_index 1 other paper
1 dated earlier
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
is_action_failed 1 other paper
1 dated earlier
2406.14228 (2024-06)
EvoAgent: Towards Automatic Multi-Agent Generation via Evolutionary Algorithms
read_json 1 other paper
1 dated earlier
2406.11375 (2024-06)
Boosting Scientific Concepts Understanding: Can Analogy from Teacher Models Empower Student Models?

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) agents are increasingly pivotal for addressing complex tasks in interactive environments. Existing work mainly focuses on enhancing performance through behavior cloning from stronger experts, yet such approaches often falter in real-world applications, mainly due to the inability to recover from errors. However, step-level critique data is difficult and expensive to collect. Automating and dynamically constructing self-critique datasets is thus crucial to empowering models with intelligent agent capabilities. In this work, we propose an iterative self-training framework, Agent-R, that enables language Agent to Reflect on the fly. Unlike traditional methods that reward or penalize actions based on correctness, Agent-R leverages MCTS to construct training data that recover correct trajectories from erroneous ones. A key challenge of agent reflection lies in the necessity for timely revision rather than waiting until the end of a rollout. To address this, we introduce a model-guided critique construction mechanism: the actor model identifies the first error step (within its current capability) in a failed trajectory. Starting from it, we splice it with the adjacent correct path, which shares the same parent node in the tree. This strategy enables the model to learn reflection based on its current policy, therefore yielding better learning efficiency. To further explore the scalability of this self-improvement paradigm, we investigate iterative refinement of both error correction capabilities and dataset construction. Our findings demonstrate that Agent-R continuously improves the model's ability to recover from errors and enables timely error correction. Experiments on three interactive environments show that Agent-R effectively equips agents to correct erroneous actions while avoiding loops, achieving superior performance compared to baseline methods (+5.59%).

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2501.11425")
get_code_for_paper("2501.11425")
have("2501.11425")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2501.11425.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2501.11425.svg)](https://syntology.ai/paper/2501.11425)

Connect an agent — have() is free.