Apply to my task
arXiv:2507.18993 ★ 71 Jul 25, 2025

Agent0 — three agents found the structure of the ideal prompt that engineers spend years assembling by hand

Key result

Three agents replaced years of trial and error: the Agent0 system automatically discovered the structure of the ideal prompt — and it turned out to be exactly the elements experienced engineers assemble by hand. The method lets you extract structured data from any text — reviews, contracts, articles — with a predictable, clean result. The focus: the prompt is built like a spec, not like a question — the executor's role, search priorities, strict formatting rules, handling of empty cases — and that's exactly what separates "sort of works" from "always works".

Agent0: LeveragingLLMAgents to Discover Multi-value Features from Text for Enhanced Recommendations

Key Aspects of the Research:

The study presents Agent0, a system of LLM agents that automatically creates and refines prompts for extracting valuable information from text. The system runs a feedback loop: one agent (the "Architect") generates prompts, another (the "Guardian") applies them, and a third component (the "Oracle") scores the quality of the result, which lets the Architect improve the prompt iteratively.

Key Result: The automated system can "discover" an extremely effective, sophisticated prompt that includes task prioritization, strict formatting rules, and exception handling — far outperforming simple human-written requests.


The Core of the Method, Explained:

For everyday users, the method comes down to imitating Agent0's process by hand. Instead of a complex three-agent system, you play all three roles yourself in a loop that improves your prompt:

  1. You're the Architect (first version): You write an initial, simple version of the prompt. For example: "Extract the key topics from this text."

  2. You're the Guardian (execution): You send this prompt to an LLM (e.g., ChatGPT) and get an answer.

  3. You're the Oracle (evaluation): You analyze the answer. Too generic? Awkward format? Did the model miss something or "make things up"? You decide exactly what needs improving.

  4. You're the Architect (second version): Based on your evaluation, you rewrite the prompt. You add:

    • A specific role: "You are an experienced marketing analyst."
    • Clear instructions and priorities: "Extract 5-7 tags. First look for product names, then customer problems, and only after that general themes."
    • Strict formatting rules: "Each tag must be no longer than 3 words, lowercase. Don't use quotation marks."
    • Output format requirements: "Output the tags as a comma-separated list on a single line."
    • Edge-case handling: "If there's nothing relevant in the text, write 'not found'."

You repeat this loop until you get a result you're fully happy with. The study shows that exactly this kind of structured, iterative approach produces high-quality prompts.


Practical Applicability Analysis:

  • Direct applicability: Very high. You can take the prompt structure from Figure 1 as a ready-made template for any information extraction and structuring task. Just swap in your own details (tag types, rules) while keeping the overall logic: role, task, priorities, rules, output format, delimiters.

  • Conceptual value: The key idea is the prompt as a program. The study teaches you not just to ask a question but to write a clear spec for the LLM. It shows the model works better when it's left no room for ambiguity. The "Oracle" (evaluator) concept helps you see that feedback and iterative refinement aren't a bug but a feature of working effectively with LLMs.

  • Adaptation potential: The method adapts easily. Instead of extracting tags, you can use the same structure for:

    • Summarizing text against set criteria (e.g., "first state the problem, then the solution, then the result").
    • Building JSON objects from unstructured text.
    • Scoring text on a scale (e.g., "rate the toxicity of this comment from 1 to 5, following these rules..."). The adaptation mechanism is simple: define your goal, break it down into clear, unambiguous instructions, and pack them into the proposed structure.

A Practical Example:

### Role:
You are an experienced social media manager analyzing customer reviews of a new fitness app.

### Task:
Extract 3-5 key entities from the review below that will help the product team understand the app's strengths and weaknesses.

### Categories to extract (in priority order):
1.  **Specific app feature:** A mention of a specific tool (e.g., "calorie tracker," "workout plans").
2.  **User experience (UX/UI):** Comments about convenience, design, navigation (e.g., "confusing menu," "beautiful interface").
3.  **Customer problem or pain point:** What exactly kept the user from reaching their goal (e.g., "progress resets," "few vegan recipes").
4.  **Positive impression:** General praise or a positive emotion.

### Formatting rules:
1.  Each entity is no more than 4 words.
2.  Everything in lowercase.
3.  Strip filler words ("very," "a bit"); keep only the substance.
4.  If several entities are synonyms, keep the most specific one.

### Output format (strict):
Output the result as a markdown list where each line has the format: `* [Category]: extracted entity`
If the review contains no useful information, output only: `irrelevant review`.

### Source review text:

Overall the app isn't bad, and the design is easy on the eyes. But I never figured out how to add my own workout — the menu is kind of a maze. Also the calorie tracker keeps glitching and doesn't save data after a restart! That kills the whole point. But the trainer-made workout plans are just awesome.

Why This Works:

This prompt works because it turns the vague task "analyze the review" into a clear algorithm for the LLM:

  • The role sets the context and activates the model's relevant knowledge.
  • Prioritized categories steer the LLM's "attention," making it look for the most important things first (specific features and problems) rather than general phrases.
  • Strict formatting rules standardize the output, making it predictable, clean, and easy to process further. That lowers the odds of a "creative" but useless answer.
  • The <begin_raw_text> and <end_raw_text> delimiters cleanly separate instructions from data, which is critical for preventing mix-ups and confusion.
  • The output format leaves the model no choice in how to present the information, ensuring 100% consistency.

Another Practical Example

### Role:
You are a paralegal preparing a short summary of a lease agreement for a client.

### Task:
Extract the key financial and timing terms from the lease excerpt.

### Terms to extract (in priority order):
1.  **Lease term:** The full duration of the agreement.
2.  **Rent:** The exact monthly payment amount and currency.
3.  **Deposit:** The security deposit amount.
4.  **Penalties:** The amount or percentage of the late-payment fee.
5.  **Termination terms:** How much notice is required for early termination.

### Formatting rules:
1.  Extract only exact numbers and facts.
2.  Don't add any "fluff" or interpretation.
3.  If a piece of information is missing from the text, put "not specified" for that item.

### Output format (strict):
Provide the answer as JSON with the keys: `term_months`, `rent_amount`, `deposit_amount`, `late_fee`, `termination_notice_days`.

### Lease excerpt:

3.1. This Agreement is entered into for a term of 11 (eleven) months.
4.1. The monthly rent is $2,500 (two thousand five hundred dollars).
4.3. As security for the performance of its obligations, the Tenant shall pay a security deposit of $2,500.
5.2. In the event of late payment of rent, the Tenant shall pay a penalty of 0.5% of the amount owed for each day of delay.

Why This Example Works, Mechanically.

This prompt works for the same fundamental reasons as the previous one, adapted to a different task and output format:

  • A specific role ("paralegal") tunes the model toward precision, attention to detail, and a formal style.
  • The prioritized list ensures the model focuses on the terms that matter most to the client (duration, money), even if they're scattered through the text.
  • Requiring JSON output is the highest form of structuring. It forces the model not just to extract the data but to classify it and pack it into a machine-readable format, ideal for further automation.
  • The "not specified" rule teaches the model to handle missing information correctly instead of hallucinating or dodging the question. That makes the result more reliable and trustworthy.

Usefulness Score: 92

02

Main Evaluation Criteria

  • A. Relevance to prompting techniques: Very high. The study presents a concrete, highly effective prompt (Fig. 1) "discovered" by the system. That prompt is a model of structure, containing a role, a goal, priorities, rules, and an output format.
  • B. Better conversational answers: High. The methodology aims at prompts that extract information with high precision and relevance, which directly improves answer quality for data extraction and structuring tasks.
  • C. Direct practical applicability: Very high. You can take the structure and principles of the Fig. 1 prompt and apply them to your own tasks immediately, without any code or special tools.
  • D. Conceptual value: High. The study clearly demonstrates the power of an iterative approach to prompt building (the "Architect-Guardian-Oracle" loop). It helps you see that writing a prompt isn't a one-off act but a process of improvement driven by feedback (even if you play the "Oracle" yourself, judging the result).
  • E. New useful practice (clustering): The paper falls into several key clusters at once:
    • 1. Prompt phrasing techniques: Demonstrates advanced role modeling and instruction structuring.
    • 3. Prompt structure optimization: A vivid example of using formatting, markers (tags), and instruction prioritization.
    • 5. Extraction and structuring: The study's main goal is automating the extraction of structured data (tags) from text.
    • 7. Reliability and stability: The strict formatting rules and edge-case handling in the prompt ("output exactly: unspecified") directly improve answer consistency and reliability.
  • Practicality checklist: Provides ready-made constructions, explains how to structure requests, and offers ways to improve accuracy. (+15 points).
03

Numeric Usefulness Score

The study scores high because it delivers not just theory but a concrete artifact — a prompt that's a near-perfect template for information extraction tasks. It clearly shows how combining role-play, clear instructions, rules, priorities, and output-format specs dramatically raises the quality of the result.

Counterarguments (why the score could be lower): * The paper's main focus is building an automated agent system (Agent0), which may be too complex for an everyday user. It takes some "translation" from the language of system architecture into the language of practical prompting. * The study is narrowly focused on extracting tags for recommender systems, and you have to adapt the approach to your own needs yourself.

Counterarguments (why the score could be higher): * The Figure 1 prompt is practically a ready-made "gold standard" for extraction tasks. Its value for teaching users is hard to overstate. * The "hypothesis -> test -> improve" loop (Architect -> Guardian -> Oracle) is fundamental to prompt engineering, and this paper illustrates it brilliantly.


Research digest

Key result

Three agents replaced years of trial and error: the Agent0 system automatically discovered the structure of the ideal prompt — and it turned out to be exactly the elements experienced engineers assemble by hand. The method lets you extract structured data from any text — reviews, contracts, articles — with a predictable, clean result. The focus: the prompt is built like a spec, not like a question — the executor's role, search priorities, strict formatting rules, handling of empty cases — and that's exactly what separates "sort of works" from "always works".

Principle

The loop is simple: write a prompt → run it → see what came out wrong → rewrite it with specific improvements. Repeat. Each iteration adds one or two structural elements until the result becomes predictable. The three agents in the system do exactly the same thing: the Architect writes, the Guardian applies, the Oracle evaluates — and the loop starts over. You can play all three roles yourself. It's not magic — it's method.

Why it works

An LLM can't set priorities on its own. Ask it to "extract topics" and you'll get anything, usually the most superficial stuff. When priorities are spelled out ("look for X first, then Y"), the model focuses right there instead of smearing itself across the whole text. Strict formatting rules remove ambiguity: the model doesn't decide how to present the answer, it just follows the instruction. Edge-case handling ("if there's no data, write 'not found'") cuts off hallucinations exactly where they show up most often — in the void.

When to apply

Ideal for extracting data from text — especially when you need a consistent result structure. Review analysis, structuring contracts, building JSON from unstructured text, sorting comments into categories. Works anywhere the result must be machine-readable and reproducible. Not suited to creative tasks — there, a rigid prompt structure kills the variety you need.

Mini recipe

1. Write version 1: a simple request — what you want back, no frills 2. Run it and judge honestly: is the result too generic? awkward format? did the model make something up? 3. Add a role: experienced customer review analyst 4. Spell out priorities: first specific features, then problems, then general impressions 5. Set a strict format: entity length, case, delimiters, line structure 6. Add an exception: if the needed information is missing, write irrelevant text — don't make anything up 7. Repeat the loop — usually 2-3 iterations turn a fuzzy result into a clean, predictable one

Examples

[BAD]: `Extract the key topics from the customer review` [GOOD]: `You are a product analyst. Extract 3-5 entities from the review in priority order: 1. a specific app feature, 2. a customer problem or pain point, 3. an overall impression. Each entity is no longer than 3 words, lowercase. Format of each line: * [Category]: entity. If the review contains nothing useful, output only: irrelevant review.`

In plain words

Today's recommender systems work like old-school librarians: they see you checked out a book about robots and hand you another one about robots. That's a one-dimensional approach that misses the nuance. The Agent0 study shows that models can pull not just tags out of text but multi-value features. The point is that a single review holds a bunch of layers — from a specific feature to a customer pain point — and if you feed them to the algorithm properly, recommendation accuracy shoots up, because the system finally understands context instead of just matching words.

It's like walking into a bar and saying: "I want something cold and sour, but no sugar, because I'm on a diet." A regular search just brings you ice, because it's cold. Agent0 works like a seasoned bartender who breaks your order down into atoms: temperature, flavor, dietary restrictions. He gets that cold and sugar-free are separate parameters that have to come together in one glass, not just a random string of letters.

The method is built on LLM agents that gut the text along clear categories. Instead of guessing, the model uses structured extraction: it looks for specific features (say, a calorie tracker), evaluates UX/UI (say, a confusing menu), and records user pain points. The key trick is prioritization and filtering. The agent cuts out junk like "very" or "a bit", leaving a dry residue that turns a chaotic review into a data vector a machine can understand.

The experiment used fitness app reviews, but the principle is universal. You can stretch it over any field: from matching hotels to picky comments to analyzing legal documents or support tickets. Any business sitting on a mountain of unstructured text can turn that "digital noise" into a gold mine for analytics. We're moving from simple keyword search to a deep understanding of what a person actually needs right now.

Bottom line: the era of dumb recommendations is ending, because we've taught AI to pull layers of meaning out of text. If you're still just counting brand mentions, you're losing. You need an agent-based approach that turns every review into a set of clear instructions for the product. Whoever learns to squeeze specifics out of text will be the one offering users exactly what they'll buy, not yet another useless piece of junk.

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 Agent0 — three agents found the structure of the ideal prompt that engineers spend years assembling by hand arXiv:2507.18993

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

Get the week’s best papers by email

One email on Sundays with the highest-rated new techniques. Unsubscribe with one click.