agent-experience / README.md
zhenwenxing's picture
Update README.md
6b14b2d verified
|
Raw History Blame Contribute Delete
5.84 kB
metadata
license: apache-2.0
task_categories:
  - reinforcement-learning
language:
  - en
tags:
  - agent_data
  - agent_trajectory
  - experience_dataset
pretty_name: ai experience
size_categories:
  - n>1T

Agent Experience

From Tasks, Reasoning, and Tool Use to Reflection and Memory


1. What Is Experience?

Traditional language model datasets typically focus on input and output:

Input → Output

The behavior of an Agent in real-world tasks is much more complex. An Agent may need to understand the task, develop a plan, use tools, observe changes in the environment, detect errors, adjust its strategy, retry actions, and finally verify whether the task has been completed.

Therefore, preserving only the final answer loses a significant amount of valuable execution information.

Agent Experience focuses on:

How an Agent understands a problem, develops a plan, takes actions, receives feedback, adjusts its strategy, and ultimately completes a task within a specific task and environment.

A raw Agent Runtime typically produces an execution trajectory. Experience goes one step further by structuring and adding semantic meaning to the execution process:

Raw Trajectory
      ↓
Semantic Structuring
      ↓
Agent Experience

2. Why Not Just Store Question / Answer?

Consider the following two Agents.

Agent A:

Question
↓
Many Ineffective Actions
↓
Errors
↓
Repeated Attempts
↓
Eventually Reaches the Correct Result

Agent B:

Question
↓
Correctly Understands the Task
↓
Develops a Plan
↓
Selects the Appropriate Tool
↓
Executes
↓
Verifies
↓
Answer

If only the Question and Answer are stored, these two samples may appear almost identical.

If the Experience is preserved, however, we can further study:

  • How the Agent solves the problem
  • Whether Tool Use is appropriate
  • How Observations influence subsequent decisions
  • How the Agent recovers from errors
  • Whether Reflection is effective
  • Whether the final result has been verified
  • Which experiences are worth preserving as Memory

This is the main reason for preserving the execution process as Experience rather than storing only the final answer.


3. From Trajectory to Experience

An Agent Runtime can typically record an execution trajectory.

For example:

User Request
↓
Browser Open
↓
Snapshot
↓
Click
↓
Observation
↓
Type
↓
Observation
↓
Submit
↓
Final Answer

These Trajectories are extremely valuable because they record what the Agent actually did.

However, a raw Trajectory is closer to answering:

What happened?

In other words, it is a Runtime Log.

Experience aims to go one step further and express:

What did this execution mean?

For example:

browser.open

may indicate that the Agent is entering the task environment.

browser.snapshot

may indicate that the Agent is obtaining the current state of the page.

A:

browser.click

may be a normal action in the Agent's plan, or it may be an incorrect attempt.

A subsequent sequence such as:

Observation
↓
Reflection
↓
Retry

may indicate that the Agent recognized a problem and changed its execution strategy.

Experience is not merely about storing logs. It attempts to represent the execution experience formed while an Agent completes a task.


4. Experience and Training Data

Agent Experience is not itself equivalent to any particular model training format.

Experience first preserves the execution experience produced while an Agent completes a task:

Agent Experience
        │
        ├── SFT Dataset
        ├── Tool-Use Dataset
        ├── Reasoning Dataset
        ├── Preference Dataset
        ├── Reward / RL Dataset
        └── Agent Evaluation Dataset

For example:

Tool-Use Training

The following can be extracted:

Context
↓
Action
↓
Observation

Error-Recovery Training

The following can be extracted:

Failed Action
↓
Error Observation
↓
Reflection
↓
Retry
↓
Successful Action

Different training objectives can extract different data representations from the same Experience.

Therefore:

Experience can be considered an upstream data asset, while a Training Dataset is a downstream representation generated for a specific training objective.


5. Schema Example

A simplified Experience can be represented as:

{
  "schema_version": "experience-v1.0",

  "sample_id": "browser-exp-000001",

  "question": {},

  "thinking": {},

  "plan": {},

  "tool_use": [],

  "observation": [],

  "reflection": {},

  "retry": {},

  "memory_update": {},

  "self_evaluation": {},

  "answer": {},

  "raw_trajectory": {}
}

Not every field is required.

A simple Experience may contain only:

Question
↓
Open
↓
Snapshot
↓
Observation
↓
Answer

A more complex Experience may contain multiple loops:

Action
↓
Observation
↓
Reflection
↓
Retry

6. Loading the Data

import json

with open("xxx-xxx.jsonl", "r", encoding="utf-8") as f:
    for line in f:
        experience = json.loads(line)

        print(experience["question"])
        print(experience["thinking"])
        print(experience["tool_use"])
        print(experience["observation"])
        print(experience["reflection"])
        print(experience["answer"])

7. Generation Environment

  • Task Environment: Controlled Browser / Web / Workspace / ......

  • Task Types:

    • Filesystem
    • Browser
    • Code
    • ......
  • Agent Behavior:

    • Thinking
    • Planning
    • Observation
    • ......
  • Tool Use: Relevant tools

  • Difficulty Levels: Custom-defined

  • Generation Model: Based on MiniMax-M3