SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2403.03101 · 2024

KnowAgent: Knowledge-Augmented Planning for LLM-Based Agents

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 0 have no contract verdict; 8 failures of our instrument; 0 no recorded run), measured 2026-11-22; 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/2403.03101.json · badge: /api/ran/2403.03101.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
zjunlp/knowagent canonical (classifier label)
classifier basis: census
11 ran · 0 no recorded run
FunctionStatusWhere it lives
eval_llm_agent Ran
ran, honoured the contract we drafted
zjunlp/knowagent/Path_Generation/hotpotqa_run/evaluate.py
code served (permissive licence) · get_code("d4718882966222cb")
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 tuple, ndim 1, 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.

import pandas as pd
import os
import tempfile

# Create temporary directory and CSV files for testing
temp_dir = tempfile.mkdtemp()
execution_data_dir = os.path.join(temp_dir, 'execution_data', 'hotpotqa')
os.makedirs(execution_data_dir, exist_ok=True)

# Create sample CSV files for each level and agent/llm combination
levels = ['easy', 'medium', 'hard']
llm_name = 'gpt4'
agent_name = 'react'

for level in levels:
    file_name = os.path.join(execution_data_dir, f'{level}_{agent_name}_{llm_name}.csv')
    data = {
        'success': [1, 0, 1, 1, 0],
        'reward': [0.8, 0.2, 0.9, 0.7, 0.3]
    }
    df = pd.DataFrame(data)
    df.to_csv(file_name, index=False)

# Change working directory to temp directory so relative paths work
original_cwd = os.getcwd()
os.chdir(temp_dir)

ARGS = {
    'llm_name': 'gpt4',
    'agent_name': 'react'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family float — a tuple 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
eval_reward Ran
ran, honoured the contract we drafted
zjunlp/knowagent/Path_Generation/hotpotqa_run/evaluate.py
code served (permissive licence) · get_code("d3594f629a54f25b")
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 1, 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.

import pandas as pd
import tempfile
import os

# Create a temporary CSV file with reward data
temp_dir = tempfile.mkdtemp()
result_file = os.path.join(temp_dir, "results.csv")

# Write a sample CSV file with a 'reward' column
df = pd.DataFrame({
    'reward': [0.5, 0.75, 0.9, 0.6, 0.8],
    'episode': [1, 2, 3, 4, 5]
})
df.to_csv(result_file, index=False)

ARGS = {
    'result_file': result_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, 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
eval_success Ran
ran, violated the contract we drafted
zjunlp/knowagent/Path_Generation/hotpotqa_run/evaluate.py
code served (permissive licence) · get_code("ec4600e4ef7a5dab")
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 1, 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.

import pandas as pd
import tempfile
import os

# Create a temporary CSV file with the expected 'success' column
temp_dir = tempfile.mkdtemp()
result_file = os.path.join(temp_dir, "results.csv")

# Create a sample CSV with a 'success' column
df = pd.DataFrame({
    'success': [True, False, True, True, False]
})
df.to_csv(result_file, index=False)

ARGS = {
    'result_file': result_file
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, 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
format_step Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/agent_arch.py
code served (permissive licence) · get_code("84d28fbaf38b0a59")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) 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.

ARGS = {
    "step": "\n  This is a test step with newlines\n  and extra whitespace  \n"
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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
fuzzy_parse_action Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/agent_arch.py
code served (permissive licence) · get_code("9454beee89209dff")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, 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.

import re
import string
import os

# The function takes a single parameter 'text' which is a string
# It strips whitespace and periods, then tries to match a pattern like "action_type[argument]"
# If matched, returns (action_type, argument), otherwise returns (text, '')

# Test with a valid pattern
text_valid = "search[query string]"

# We can also test with other cases:
# - text without pattern: "just_text"
# - text with spaces and periods: "  action[arg].  "

ARGS = {
    'text': text_valid
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 tuple, ndim 1, dtype family float — a tuple 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
log_trial Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/utils.py
code served (permissive licence) · get_code("2fa5e49fdf800870")
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
import torch.nn as nn

class StandInAgent:
    def __init__(self, agent_id, is_correct_val, is_finished_val, key):
        self.agent_id = agent_id
        self._is_correct_val = is_correct_val
        self._is_finished_val = is_finished_val
        self.key = key
        self.prompt_text = f"Agent {agent_id} prompt"
    
    def is_correct(self):
        return self._is_correct_val
    
    def is_finished(self):
        return self._is_finished_val
    
    def _build_agent_prompt(self):
        return self.prompt_text

torch.manual_seed(0)

agents = [
    StandInAgent(agent_id=0, is_correct_val=True, is_finished_val=True, key="answer_A"),
    StandInAgent(agent_id=1, is_correct_val=False, is_finished_val=True, key="answer_B"),
    StandInAgent(agent_id=2, is_correct_val=False, is_finished_val=False, key="answer_C"),
]

ARGS = {
    "agents": agents,
    "trial_n": 1,
}
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
parse_action Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/agent_arch.py
code served (permissive licence) · get_code("9f8148d447f9ea0c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Sonnet 4.5, prompt python_fixture_v1) and returned tuple, ndim 1, 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.

ARGS = {
    'string': 'search[artificial intelligence]'
}
Setup block drafted by
a language model, Claude Sonnet 4.5, prompt python_fixture_v1
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 tuple, ndim 1, dtype family float — a tuple 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
process_ob Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/alfworld_run/run_alfworld.py
code served (permissive licence) · get_code("dfb17eb3e6eaed35")
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

def process_ob(ob):
    if ob.startswith('You arrive at loc '):
        ob = ob[ob.find('. ') + 2:]
    return ob

ARGS = {
    'ob': 'You arrive at loc A. This is a description of the location.'
}
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
prompt_retrieve Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Self-Learning/train/HotpotQA_reformat.py
code served (permissive licence) · get_code("9bc78b9cc9aaf2bc")
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

def prompt_retrieve(prompt: str) -> str:
    end_of_examples_index = prompt.find('(END OF EXAMPLES)')
    if end_of_examples_index != -1:
        prompt = prompt[end_of_examples_index + len('(END OF EXAMPLES)') + 1:]
    else:
        prompt = prompt
    prompt_index = prompt.find('Question: ')
    if prompt_index != -1:
        remaining_content = prompt[prompt_index:].split('\n', 1)[1]
    else:
        remaining_content = ''
    return remaining_content


torch.manual_seed(0)

ARGS = {
    "prompt": "(END OF EXAMPLES)\nQuestion: What is the answer?\nThis is the content after the question."
}
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
remove_fewshot Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/utils.py
code served (permissive licence) · get_code("9435e7e172eab04b")
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

# Construct a prompt string that matches the expected format
# The function expects a prompt with 'Here are some examples:' and '(END OF EXAMPLES)' markers
prompt = """You are a helpful assistant.
Here are some examples:
Example 1: Input -> Output
Example 2: Input -> Output
(END OF EXAMPLES)
Now please answer the following question."""

ARGS = {
    "prompt": prompt
}
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
summarize_trial Ran
ran; our contract draft was wrong, not the code
zjunlp/knowagent/Path_Generation/hotpotqa_run/utils.py
code served (permissive licence) · get_code("e55a194777b73c29")
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 tuple. 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

class Agent:
    def __init__(self, correct, finished):
        self._is_correct = correct
        self._is_finished = finished
    
    def is_correct(self):
        return self._is_correct
    
    def is_finished(self):
        return self._is_finished

torch.manual_seed(0)

agents = [
    Agent(correct=True, finished=True),
    Agent(correct=False, finished=True),
    Agent(correct=False, finished=False),
    Agent(correct=True, finished=True),
    Agent(correct=False, finished=False),
]

ARGS = {
    "agents": agents
}
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 tuple — a tuple output has no array shape of its own; none is 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, 4 are also present in other papers whose code we hold (4 with at least one paper dated earlier, 0 the same month, 1 later) and 7 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
process_ob 6 other papers
3 dated earlier, 3 later
2303.11366 (2023-03)
Reflexion: Language Agents with Verbal Reinforcement Learning
2311.16714 (2023-11)
Embodied Multi-Modal Agent trained by an LLM from a Parallel TextWorld
2402.16181 (2024-02)
How Can LLM Guide RL? A Value-Based Approach
and 3 more not named here
format_step 5 other papers
5 dated earlier
2303.11366 (2023-03)
Reflexion: Language Agents with Verbal Reinforcement Learning
2306.13304 (2023-06)
ToolQA: A Dataset for LLM Question Answering with External Tools
2308.05960 (2023-08)
BOLAA: Benchmarking and Orchestrating LLM-augmented Autonomous Agents
and 2 more not named here
fuzzy_parse_action 2 other papers
2 dated earlier
2308.05960 (2023-08)
BOLAA: Benchmarking and Orchestrating LLM-augmented Autonomous Agents
2401.05268 (2024-01)
AUTOACT: Automatic Agent Learning from Scratch for QA via Self-Planning
parse_action 2 other papers
2 dated earlier
2308.05960 (2023-08)
BOLAA: Benchmarking and Orchestrating LLM-augmented Autonomous Agents
2401.05268 (2024-01)
AUTOACT: Automatic Agent Learning from Scratch for QA via Self-Planning

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-22.

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) have demonstrated great potential in complex reasoning tasks, yet they fall short when tackling more sophisticated challenges, especially when interacting with environments through generating executable actions. This inadequacy primarily stems from the lack of built-in action knowledge in language agents, which fails to effectively guide the planning trajectories during task solving and results in planning hallucination. To address this issue, we introduce KnowAgent, a novel approach designed to enhance the planning capabilities of LLMs by incorporating explicit action knowledge. Specifically, KnowAgent employs an action knowledge base and a knowledgeable self-learning strategy to constrain the action path during planning, enabling more reasonable trajectory synthesis, and thereby enhancing the planning performance of language agents. Experimental results on HotpotQA and ALFWorld based on various backbone models demonstrate that KnowAgent can achieve comparable or superior performance to existing baselines. Further analysis indicates the effectiveness of KnowAgent in terms of planning hallucinations mitigation. Code is available in https://github.com/zjunlp/KnowAgent.

For agents

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

get_harvested_code_for_paper("2403.03101")
get_code_for_paper("2403.03101")
have("2403.03101")

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

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

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

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

Connect an agent — have() is free.