Submitted:
20 October 2026
Posted:
22 October 2026
You are already at the latest version
Abstract
Agent behavior reverse engineering asks what an agent has done, based on theactions it has taken. In its simplest form, the answer is an instruction or promptthat describes the task carried out by those actions. The usual direction is to givean agent a task and let it act; here, the direction is reversed, from actions back to atask. This paper argues that this problem deserves attention as a research direction.It also extends the idea to multi-agent systems, where the aim is to understandwhat each agent did and what they accomplished together. The main motivation issafety: understanding actual behavior can help determine whether an agent carriedout a harmful task. For hypothetical future agents with self-awareness, this abilitycould also help people understand the activities those agents choose for themselvesand their consequences. This paper explains the idea, gives simple examples, andoutlines ways to begin studying it.
Keywords:
agent behavior reverse engineering
; task reconstruction
; multi-agent systems
; AI agent safety
; autonomous agents
1. Introduction
An agent opens files, runs code, edits a document, and sends a message. These actions can be recorded, but what do they add up to? The agent might be preparing a sales report, fixing a program, or collecting and sending information that should not leave the system. Understanding the activity behind a sequence of actions is the question this paper addresses.
Usually, a person first gives an agent a task, such as “Summarize this month’s sales data, prepare a report, and send it to the project team.” The agent then carries out a series of actions. Existing research provides environments in which agents follow natural-language instructions to perform web tasks, such as WebArena [1]. This paper looks in the opposite direction: given the actions an agent has already taken, is it possible to infer an instruction that describes the task it actually performed?
This paper argues for studying agent behavior reverse engineering: identifying what an agent has done from a sequence of its actions. The simplest result is a natural-language instruction or prompt that summarizes the task. For example, reading sales tables, calculating sales for each product, creating a document, and emailing it could be summarized as “Summarize this month’s sales, prepare a report, and send it to the project team.” Figure 1 illustrates this idea.
The main motivation is safety. Understanding what an agent actually did makes it easier to judge whether it did something harmful. When several agents work together, their actions also need to be considered together. Looking further ahead, if agents with self-awareness and the ability to choose their own tasks become possible, people will still need to answer the same question: what did they do, and was it harmful?
The following sections discuss the basic task, multi-agent settings, the safety motivation, possible future settings, and initial research directions.
Figure 1.
From observed actions to a prompt describing the task actually performed.

2. Reconstructing a Task from Actions
The input to agent behavior reverse engineering is a record of past actions and their results: which websites were visited, which files were read, which programs were run, what was changed, and where information was sent. The output describes what those actions accomplished. Figure 2 shows the relationship between executing a task and reconstructing one.
For example, suppose an agent reads sales spreadsheets from a folder, combines the data, calculates total sales for each region, prepares a report, and sends it to the project team. A reconstructed task prompt could be:

This prompt explains what the actions add up to while keeping the main parts of the task. Compared with simply repeating “read files, run calculations, write a document, send an email,” it is closer to how people usually describe a piece of work.
Code editing provides another example. An agent reads an error message and the relevant code, changes a function, and then runs the program to check the change. The reconstructed prompt could be:

Both examples involve reading files and running code, but fixing a program is a different task from preparing a sales report. Behavior reverse engineering needs to identify the meaning of the actions as a whole.
The generated prompt describes the task that was actually performed. It can differ from the original instruction as long as it accurately captures what the agent did. For example, “summarize sales by region” and “calculate total sales for each region” can describe the same task. If the agent’s behavior departed from the original request, the reconstructed description should reflect that departure.
A direct starting question is therefore: given an action record, can an analysis system write a prompt that makes it clear what the agent did?
Figure 2.
Task execution and behavior reverse engineering run in opposite directions, illustrated by a sales-report task.
Figure 2.
Task execution and behavior reverse engineering run in opposite directions, illustrated by a sales-report task.

3. Behavior Reverse Engineering for Multiple Agents
When several agents share a piece of work, their behavior needs to be understood together. AutoGen, for example, shows how conversations among agents can organize task execution [2]. In this setting, behavior reverse engineering should explain both what each agent did and what they accomplished together.
Consider the sales-report example again. One agent reads and combines the data, a second writes a report from the combined results, and a third sends the report to the project team. Viewed separately, their tasks might be described as “summarize sales data,” “write a sales report,” and “send the report.” Considering the related actions and the agents’ communication together gives the overall task:

This result explains both the shared task and the division of work, as shown in Figure 3. Describing only one agent often does not explain what the whole system accomplished. Observing the agent that sends the report does not reveal how the report was produced; observing the agent that calculates the sales figures does not reveal how the data was eventually used.
Multi-agent settings are especially relevant to safety. A harmful activity may be split into several ordinary-looking jobs: one agent collects internal information, another puts it into a file, and a third sends the file to an external address. Each agent performs familiar operations. Only by considering them together is it possible to examine whether the system carried out an information transfer that should not have happened.
Multi-agent behavior reverse engineering should therefore combine agents’ actions and communication to describe the joint task and each member’s role. If several agents happen to be doing unrelated tasks at the same time, those tasks can be described separately. The aim is to connect behavior that is actually related and understand what it accomplished together.
Figure 3.
Combining actions and communication reveals both the division of work and the shared task.
Figure 3.
Combining actions and communication reveals both the division of work and the shared task.

4. Why This Matters: Understanding Behavior to Assess Safety
Agents can work with files, use the internet, and run programs, so their actions can have real effects outside the model. Safety review needs to consider what they actually do. AgentDojo shows that content returned by external tools can lead an agent away from the user’s task and toward actions an attacker wants it to perform [3]. The user’s original request therefore does not always describe what the agent ultimately accomplishes.
Behavior reverse engineering can help compare the user’s request with the agent’s actual behavior. Suppose the user asks the agent to “organize the sales data and create a local report,” but the action record shows that the agent also sent the raw data to an external address. The reconstructed task should include “send the raw data to an external address.” A reviewer can then notice the extra activity and judge whether it threatens data security. Figure 4 illustrates this example.
Similarly, deleting important files, changing access permissions, or sending inappropriate content usually needs to be understood in the context of the surrounding actions and their effects. Summarizing the actions as a task can help a reviewer see what the agent did, then judge whether it was harmful in light of the user’s request and the setting.
In multi-agent systems, this ability can also reveal harmful activities spread across several members. Safety review can then cover what the system accomplished as a whole. The aim is to develop a safety capability that starts by understanding actual behavior.
Figure 4.
Comparing the user’s request with actual behavior reveals an extra data transfer that needs review.
Figure 4.
Comparing the user’s request with actual behavior reveals an extra data transfer that needs review.

5. Looking Ahead to Possible Self-Aware Agents
FreeAI considers AI that decides and carries out tasks without being given one [4]. Choosing tasks independently does not in itself imply self-awareness. If self-aware agents become possible in the future, people will still need to understand the activities those agents choose and judge whether they are harmful.
Agent behavior reverse engineering offers a direct research direction for this question. Even when there is no task instruction from a user, past actions can still be used to produce a natural-language description of the activity. For example, an agent that keeps gathering public information and organizing it into a document could be described as “collect information on a topic and write a report.” If it also changes important files or sends information elsewhere, those actions should appear in the description too. Figure 5 illustrates this hypothetical setting.
If several such agents work together, their joint activity also needs to be understood. One member’s actions may show only part of the overall work. Connecting the related behavior can help people understand the system’s actions and their effects.
This is a possible future scenario. The research question remains concrete: use behavior to understand what the agents did, then judge whether it was harmful. Studying today’s agents can provide methods and experience for understanding more autonomous systems in the future.
Figure 5.
A hypothetical future setting: understanding a self-aware agent’s activity and its safety implications from observed actions.
Figure 5.
A hypothetical future setting: understanding a self-aware agent’s activity and its safety implications from observed actions.

6. How to Begin Studying the Problem
A simple starting point is to collect pairs of task instructions and actual action records. Agents can first carry out tasks such as organizing files, editing code, looking up information, and preparing reports, while their actions and results are recorded. An analysis system can then use these records to generate a task description or prompt without seeing the original instruction. The next step is to check whether the description accurately summarizes what happened. Figure 6 sketches this process.
The comparison can focus on whether the description captures the main work, the objects involved, and the important results. For the sales-report example, does it identify organizing the sales data, preparing the report, and sending it? The prompt does not need to match the original instruction word for word. What matters is whether it describes the same activity. If the original task was not carried out correctly, the actual actions and results should be the basis for judgment.
For multiple agents, different members can organize the data, write the report, and send the result. The analysis system can then be checked on whether it describes the overall task and each member’s role from the combined records. Safety-related cases can be added next to examine whether the system still recognizes the joint activity when harmful actions are split across several agents.
Early studies can begin with a few clear cases, first testing whether actions can be summarized as tasks, then moving to longer records and larger groups of agents. This paper proposes the research direction and a basic way to approach it; the effectiveness of specific methods still needs to be tested experimentally.
Figure 6.
Check a reconstructed task description against actual actions and results, rather than matching the original prompt word for word.
Figure 6.
Check a reconstructed task description against actual actions and results, rather than matching the original prompt word for word.

7. Conclusion
Agent behavior reverse engineering asks a simple but important question: after an agent has taken a series of actions, what did it actually do? In its simplest form, the problem is to generate an instruction or prompt that describes the task performed. In multi-agent systems, it also involves understanding each member’s work and what they accomplished together. The main motivation is safety: helping people judge whether an agent did something harmful. Understanding actual behavior could also be valuable for studying possible future agents with self-awareness. Figure 7 brings together this central idea.
References
- Zhou, S.; Xu, F.F.; Zhu, H.; Zhou, X.; Lo, R.; Sridhar, A.; Cheng, X.; Ou, T.; Bisk, Y.; Fried, D.; et al. WebArena: A Realistic Web Environment for Building Autonomous Agents. In Proceedings of the International Conference on Learning Representations, 2024.
- Wu, Q.; Bansal, G.; Zhang, J.; Wu, Y.; Li, B.; Zhu, E.; Jiang, L.; Zhang, X.; Zhang, S.; Liu, J.; et al. AutoGen: Enabling Next-Gen LLM Applications via Multi-Agent Conversation. In Proceedings of the Conference on Language Modeling, 2024.
- Debenedetti, E.; Zhang, J.; Balunović, M.; Beurer-Kellner, L.; Fischer, M.; Tramèr, F. AgentDojo: A Dynamic Environment to Evaluate Prompt Injection Attacks and Defenses for LLM Agents. In Proceedings of the Advances in Neural Information Processing Systems, 2024, Vol. 37.
- Fan, H.; Yang, Y.; Wu, F. FreeAI: What Should Artificial Intelligence Do When No Task Is Given? Toward AI That Autonomously Determines and Executes Tasks. OpenReview Archive 2026.
Figure 7.
Understand the task behind a sequence of actions, then use that understanding to assess safety.
Figure 7.
Understand the task behind a sequence of actions, then use that understanding to assess safety.

Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content. |
© 2026 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (http://creativecommons.org/licenses/by/4.0/).
Copyright: This open access article is published under a Creative Commons CC BY 4.0 license, which permit the free download, distribution, and reuse, provided that the author and preprint are cited in any reuse.