mirror of
https://github.com/agent0ai/agent-zero.git
synced 2026-05-05 15:31:08 +00:00
feat: Support copy&pasting of last tool result into next call
This commit is contained in:
parent
3db799fb2e
commit
f9ca07765a
8 changed files with 162 additions and 7 deletions
|
|
@ -0,0 +1,22 @@
|
|||
from agent import LoopData
|
||||
from python.helpers.extension import Extension
|
||||
|
||||
|
||||
class IncludeLastToolCopyPasteTip(Extension):
|
||||
async def execute(self, loop_data: LoopData = LoopData(), **kwargs):
|
||||
last_call = self.agent.get_data("last_tool_call")
|
||||
if not last_call:
|
||||
return
|
||||
|
||||
tool_name: str = last_call.get("tool_name", "")
|
||||
last_output: str = last_call.get("last_tool_output", "")
|
||||
if not last_output:
|
||||
return
|
||||
|
||||
preview = (last_output[:50] or "").replace("\n", " ").strip()
|
||||
tip = self.agent.read_prompt(
|
||||
"fw.extras.last_tool_copy.md",
|
||||
tool_name=tool_name,
|
||||
last_tool_output_preview=preview,
|
||||
)
|
||||
loop_data.extras_temporary["last_tool_copy_paste"] = tip
|
||||
Loading…
Add table
Add a link
Reference in a new issue