Apply to my task
arXiv:2610.27327 ★ 85 Oct 19, 2026

TEAL: The Agent Builds Its Own Library of Tools and Skills From Its Past Runs

Key result

An agent treats every data question as if it were the first one. It wastes steps finding a file among thousands and parsing a messy Excel header, and never reaches the answer. The TEAL method lets the agent build its own tool library and rules file from its own logs, with no reference answers needed. The trick: a new tool is judged not by the answer but by the agent's behavior on a rerun. If the agent doesn't use it, the change is rolled back. A script with no errors can still read the wrong table, so "it ran" proves nothing.

01

TL;DR

TEAL is a setup where the agent stops throwing away its work after every question. Several roles (the same model wearing different hats) turn repetitive work into ready-made tools and a rules file. The Explorer studies the data without a single question and prepares catalogs and search scripts, the way an expert would. The Critic reads logs from past runs and finds where the agent wasted steps or made mistakes. The Skill Writer records in the instructions file when to use which tool. A change survives only if, after a rerun, the agent actually uses the tool.

By default, an agent starts from scratch every time. It hunts for the right files among thousands again, untangles messy Excel headers again, and writes the same table-joining code again. That eats steps, and under a step limit the agent simply runs out of road before it reaches an answer. A tool that "runs without errors" can still read the wrong table or drop rows. So you can't judge it by the absence of errors, and you usually don't have correct answers to check against.

The method plugs that hole like this: verification is based on the agent's behavior on a rerun, not on a reference answer. Did the agent use the new tool? Did it take longer or end up with no answer? If the answer changed, which of the two is better backed by the log? A bonus insight: grow the library under a tight step limit. Failures are crisp there, so it's easy to see which tool actually helps.

Want this for your own case? Apply this study to your task: AI adapts its method to what you are working on and writes the prompt.

02

Method Blueprint

STEP 0: The Executor solves a batch of questions (5) with the current library
        → logs + summary: which tools were used, where there were many steps in a row without them
STEP 1: The Explorer studies the data WITHOUT questions or logs (once every 4 batches)
        → add tool / update tool (catalog, index, search, loader)
STEP 2: The Critic reads the logs + the tool list
        → update tool (defects) / promote tool (exists but unused) / add tool (gap)
STEP 3: The Skill Writer updates the rules file
        → general rules + an entry for each tool
STEP 4: Verification. The Executor reruns the questions with the new library
        → keep if: (a) the tool was used, (b) there is an answer and no more steps,
          (c) if the answer changed, the log supports the new one
        → otherwise roll back (one attempt to fix the skill wording)

Each role is a separate request or a separate agent. The Toolsmith writes code and tests based on the proposals. The Analyst acts as referee and compares two runs when their answers disagree.

03

Example

Task: An Amazon seller keeps a folder of 60 exports: monthly reports on sales, returns and ads. The Excel headers don't start on the first row, and the file names make no sense. A Claude Code analyst burns the first 10 steps every time just finding the right file and parsing the header. The goal: have the agent build a catalog and scripts once, and add rules for using them to CLAUDE.md.

Prompt (Explorer role):

<Role>
You are an experienced marketplace data analyst setting up a workspace 
for your colleagues. You have not been given a single question. Your job is to prepare 
tools for the entire ./amazon_reports folder, not for one report.
</Role>

<Task>
1. Walk the folder: structure, formats, headers, sample rows.
2. Propose a list of tools (add tool) — for each: name, 
   what it does, which questions it will speed up.
3. For search — build a catalog in SQLite: file, sheet, header 
   row number, column names, 3 sample rows, period.
4. Write an Excel loader that finds the header row on its own.
5. Write unit tests and run them.
</Task>

<Constraints>
- Don't build for a specific question — only what many questions will need.
- Don't modify the source files.
</Constraints>

<Output>
A list of tools with descriptions + script files + test results.
</Output>

Result: The agent walks the folder and builds a catalog of files with columns and sample rows. It writes an Excel loader with header detection, runs the tests and hands back a list of tools, explaining which questions each one speeds up. The next steps (Critic, Skill Writer, verification) are separate requests based on the template below.

04

Why It Works

Weakness: The model doesn't accumulate experience between runs. The agent tackles every question as if it were seeing the data for the first time. Under a step limit, it spends the budget on searching and cleaning and never gets to the analysis. And there's no way to check that a new script is correct: there are no reference answers.

Strength: The model is good at reading its own logs and spotting recurring waste: seven steps in a row of file searching, the same header parsing over and over. It also writes scripts well and can compare two runs on whether an answer is backed by tool output or merely asserted.

How the method exploits this: Two roles attack the problem from different sides. The Explorer builds general tools without any questions. The Critic fixes specific defects found in the logs. Correctness is checked indirectly: if a tool is genuinely useful, the agent uses it, stays within the step budget and reaches an answer backed by the log.

Control knobs: - Step limit during "training" → the tighter the limit, the clearer the signal. A library grown under a narrow limit also worked better under a wide one. - Step tolerance during verification (in the paper: more than 20%, at least 2 steps) → loosen it for hard tasks, tighten it for easy ones. - How often the Explorer runs (in the paper: once every 4 batches) → less often for stable data. - One attempt to fix the skill when a tool is ignored → if the agent ignored a tool, the skill wording is more often to blame than the tool itself. - The referee doesn't assume the old answer is correct → don't hand it the "right" option as an anchor.

05

Prompt Template

The paper doesn't include prompt texts, so the template below was assembled from the descriptions of the roles and stages. I kept the logic intact (roles, inputs, three checks).

=== ROLE 1: EXPLORER (run at the start and periodically) ===
<Role>
You are an expert in {subject_area} preparing tools for 
the entire dataset {data_path}. You do NOT see questions or logs.
</Role>
<Task>
Study the structure, formats and schemas. Propose operations:
- add tool {name}: what it does, what it speeds up
- update tool {name}: what to fix
Build tools that store precomputed data (catalog, value 
index) in {storage_format}. Implement them and verify with tests.
</Task>

=== ROLE 2: CRITIC (after each batch of questions) ===
<Role>
You are an auditor of the agent's work. You look for where it wasted steps or made mistakes.
</Role>
<Input>
Logs: {run_logs}
Tool summary: {used / unused / 
where_many_steps_in_a_row_without_tools}
Current tools: {list}
</Input>
<Task>
Propose changes using only these operations:
- update tool — a defect in a tool that is being used
- promote tool — the tool existed, could have helped, but wasn't used
- add tool — a gap the current tools don't cover
Back every proposal with a reference to an episode in the log.
</Task>

=== ROLE 3: SKILL WRITER ===
<Task>
Update the file {skills.md} / {CLAUDE.md}. Two parts:
1. General rules (for example: "query the catalog first, then search in the shell")
2. An entry for each tool: when to call it, how, an example.
Account for every change and every promote tool.
</Task>

=== ROLE 4: VERIFICATION (rerun the same questions) ===
<Verification>
For each change, compare the original run and the rerun:
Check 1: did the agent call the changed tool? No → ask the Skill 
            Writer to rewrite the instruction and rerun once.
Check 2: was an answer produced? no more steps than {n} + max(2, 20% of {n})?
Check 3 (only if the answer changed): compare the logs. Which answer 
            is backed by tool output rather than merely asserted? 
            Do not assume the original answer is correct. If it favors the old one — 
            fail; if it favors the new one or is unclear — pass.
The change stays if at least one rerun passed all three checks. 
Otherwise — roll back.
</Verification>

Fill in: {subject_area}, {data_path}, {run_logs}, {skills.md} (the name of your instructions file), {n} (the number of steps in the original run).

🚀 Quick start — paste into the chat:

Here is the TEAL template (a loop for improving an agent's tools). Adapt it to my task: [your task and where the data lives]. 
Ask me questions to fill in the fields.

[paste the template above]

The LLM will ask about your subject area, the format and location of your data, what typical questions look like, what tools and step limits your agent has, and where your instructions file lives. It needs these answers because the Explorer role works off the data structure, while the Critic and the verification work off logs and limits. It will take the roles and the three checks from the template and fit them to your environment.

06

Limitations

⚠️ Requires infrastructure: in the study, five agents were orchestrated in code (OpenHands). You can repeat the loop manually in a chat step by step, but running it automatically in batches only works if you build your own pipeline or set up automation.

⚠️ Narrow domain: tested only on "data lake" analytics (lots of heterogeneous files and tables). No gains were shown for single-file tasks or tasks without repetitive work.

⚠️ May not help with a generous budget: a library grown with a limit of 20–30 steps sometimes turned out worse than the baseline without tools. The agent solves everything on its own anyway, the tool changes nothing, and there's nothing to verify against.

⚠️ A strong model in the evolution roles: all the tool-building roles were played by the most powerful model in the lineup (Opus-4.8). Results with weaker models in those roles were not tested.

⚠️ Verification is indirect: without a reference, you can let through a tool that is "backed by the log" but substantively wrong. The authors say their verification is comparable to reference-based checking, but the samples are small (dozens of questions).

07

How They Tested It

The researchers took two data-lake analytics benchmarks. KramaBench: 1,742 files, 51 training questions and 53 test questions. LakeQA: 4,180 tables, 50 training questions and 80 test questions. Four models served as executors, and Opus-4.8 played the evolution roles. They compared against the same agent without a library and against other methods (including ISE, which keeps any tool that doesn't crash with an error), and varied the step limit from 10 to 30. Each measurement was repeated three times.

With a limit of 10–15 steps, every executor gained on both datasets. Sonnet-5 at 15 steps: +9.3 points on KramaBench and +21.7 on LakeQA. In five out of eight cases, the agent with the library at 15 steps was no worse than the baseline at 30. The explanation is simple: one tool call replaces "find, load, join."

The biggest surprise: a tight step limit "trains" better. A library grown at 20 steps and run at 30 scored 68.3, versus 64.2 for one grown at 30 from the start and 59.6 with no library. Under a tight limit, failures are obvious (empty answers, truncated pipelines), and a single saved step changes the outcome. With a generous budget, the agent brute-forces everything, and a useful tool is indistinguishable from a useless one.

Other findings: 50 synthetic questions (TEAL-Q) produce a library comparable to one built from real questions. Rerun-based verification is on par with verification against reference answers. A library grown in OpenHands works unchanged in Google ADK, Codex CLI and Prime Agent (up to +16.3 points).

08

Adaptations and Extrapolations

🔧 Technique: drop the questions, keep only a tight limit → "training" under pressure

Before collecting logs for the Critic, give the executor an explicit constraint:

You have {10–15} steps per question. If you run out, answer with 
what you have and note where you lost time.

Failures become more visible, and the Critic has an easier time finding waste. Then lift the limit: the library keeps working.

Extrapolation: a manual version for Claude Code or Cursor

This isn't the paper's method, it's my simplified version for people working without an orchestrator:

Here is the log of my sessions for the week. Find the stretches where you spent 3+ steps in a row 
doing the same thing without a ready-made script. For each one, propose: 
(a) a script, (b) a line for CLAUDE.md saying "when to call it". 
Don't write anything until you've shown me the list.

Then check by hand: on the same three tasks, does the agent use the script and finish in fewer steps?

09

Resources

  • Paper: Unsupervised Tool Evolution for Coding Agents in Data-Lake Analytics (TEAL, TEAL-Q)
  • Authors: Yuqing Yang, Yurong Liu, Deqing Fu, Manav Garg, Sravan Babu Bodapati, Fatma Ozcan, Alon Y. Halevy, Jiani Zhang
  • Institutions: University of Southern California, Google, New York University
  • Benchmarks: KramaBench (Lai et al., 2026), LakeQA (Wang et al., 2026)
  • Environment: OpenHands — github.com/OpenHands/software-agent-sdk
  • Compared against: ISE (Li et al., 2026), DataCOPE (Qiu et al., 2026), EvoOntology (Chong et al., 2026)

Research digest

Key result

An agent treats every data question as if it were the first one. It wastes steps finding a file among thousands and parsing a messy Excel header, and never reaches the answer. The TEAL method lets the agent build its own tool library and rules file from its own logs, with no reference answers needed. The trick: a new tool is judged not by the answer but by the agent's behavior on a rerun. If the agent doesn't use it, the change is rolled back. A script with no errors can still read the wrong table, so "it ran" proves nothing.

Principle

It's a pipeline of roles. The same model plays each one. 1. The Explorer studies the data without a single question. It builds a file catalog, search, and an Excel loader that detects headers. 2. The Critic reads the logs. It finds where the agent spun its wheels for seven steps in a row. It proposes fixing a tool, promoting a forgotten one, or adding a new one. 3. The Rules Writer records in `CLAUDE.md` when to use which tool. 4. Verification: the agent solves the same questions again. A change stays only if the agent actually called the tool, stayed within the step budget and backed the answer with log output. It's like a probation period for a new hire. You judge them not by the résumé but by what they actually do on the job.

Why it works

The model doesn't accumulate experience between runs, but it reads its own logs well. It sees recurring waste: the same header parsing, a pile of steps spent finding a file. It can also compare two runs and tell where an answer is backed by tool output and where it's merely asserted. A useful tool always leaves a trace: the agent calls it, uses fewer steps and reaches an answer backed by the log. No reference answer is needed for that. The twist: it's better to grow the library under a tight step limit. Failures are crisp there. A library grown under a narrow limit also worked better under a wide one.

When to apply

Data analysis → folders with dozens or hundreds of heterogeneous files (exports, reports, spreadsheets with messy headers) → especially when the agent spends its first steps on searching and cleaning every time and never gets to the analysis. NOT a fit for single-file tasks without repetitive work. Also not a fit when the step budget is generous: the agent copes anyway, and the library may end up worse than the baseline. You also need infrastructure: in the study, five agents were run in code. You can repeat the loop by hand, but it only runs automatically in a purpose-built pipeline.

Mini recipe

1. Run the Explorer: give it the data folder, but no questions or logs. Have it build a catalog in SQLite, a loader and tests. 2. Run a batch of questions: about 5, with a tight step limit, say 20–30. Save the logs and a summary of which tools were used. 3. Call the Critic: hand it the logs, the summary and the tool list. Have it propose only three operations: fix, promote or add. Each one needs a reference to an episode in the log. 4. Update the rules file: general rules ("query the catalog first, then search") and an entry for each tool: when to call it and how. 5. Rerun the same questions: keep the change if the tool was called, there is an answer, and steps are no more than {n} + max(2, 20%). 6. If the answer changed: compare the logs. Which of the two is backed by tool output? Don't assume the old answer is correct. 7. If the tool was ignored: rewrite its wording in the rules and rerun once. The wording is more often to blame than the tool. 8. Rerun the Explorer once every 4 batches. Less often for stable data.

Examples

[BAD]: `I have 60 exports in ./amazon_reports. Find the March returns and calculate the share by category.` The agent searches for the file among 60 again and guesses the header row again. That eats 10 steps of its limit. [GOOD]: `You are an experienced marketplace analyst setting up a workspace for your colleagues. You have not been given any questions. Walk ./amazon_reports. Build a catalog in SQLite: file, sheet, header row number, columns, 3 sample rows, period. Write an Excel loader that finds the header on its own. Write tests and run them. Don't build for a specific question. Don't touch the source files.` Then the Critic gets the logs and finds an episode like "spent seven steps in a row searching for a file via the shell." The Rules Writer adds to `CLAUDE.md`: `Query the catalog first, then open the file with the loader`. Verification reruns the question and checks whether the agent called the catalog. If not, the instruction gets rewritten once.

In plain words

LLM agents suffer from chronic amnesia: they start every new request with a blank slate, completely forgetting everything they dug up a second ago. Faced with a dump of dozens of messy spreadsheets, the model mindlessly burns its step budget hunting for headers and decoding junk file names. The context goes down the drain, and the model never even gets to the real analysis. The TEAL framework breaks this silly loop: it makes the agent build up experience and turn repetitive grunt work into ready-made scripts.

It's like hiring an intern who, every single morning, has to figure out all over again where the restroom is and how to work the coffee machine. Technically the guy is busy, but he's useless while precious work hours go into basic orientation. TEAL makes the poor guy draw a map of the building once, pin it to the wall and never again fumble at the starting line.

The whole trick rests on splitting the model into three specific roles. First, the Explorer quietly digs through the data with no outside hints and writes search scripts. Then the Critic cracks open the run logs and finds the moments where the agent stalled or wasted steps. Finally, the Skill Writer spells out the rules in a system file like CLAUDE.md, and a new workaround is approved only if the agent actually used it in practice.

The mechanism was tested on messy-data analytics, but the principle is universal. Any autonomous agent — whether it's poking at legacy code on GitHub or parsing marketplace reports — quickly hits the step ceiling. If the project is more complex than a single script, the agent has to build its own toolkit, or you're just burning tokens on an endless Groundhog Day.

Bottom line: stop running models in circles — make them evolve on their own. The combo of a critic, an explorer and an instructions file cuts up to 10 steps from every request, freeing up the budget for real work. Whoever adopts this kind of self-organization gets an autonomous specialist, while everyone else keeps paying their agent to read Excel headers forever.

AI lab assistant

Apply this study to your task

Describe what you're working on. AI takes the method and the measured results from this paper and adapts them to your case, or writes a ready prompt built on them.

Based on TEAL: The Agent Builds Its Own Library of Tools and Skills From Its Past Runs arXiv:2610.27327

Sign in to apply this study New accounts get 50 free credits.