Skip to content

Agent Zero AI framework

feat: Thought summaries in agent generation headline

Rafael Uzarowski61aa6ea22627
diff --git a/agent.py b/agent.py
index 38aae95bc..72b31df87 100644
--- a/agent.py
+++ b/agent.py
@@ -343,7 +343,7 @@ class Agent:
# create log message right away, more responsive
self.loop_data.params_temporary["log_item_generating"] = (
self.context.log.log(
- type="agent", heading=f"{self.agent_name}: Generating"
+ type="agent", heading=f"{self.agent_name}: Thinking..."
)
)
diff --git a/prompts/default/agent.system.main.communication.md b/prompts/default/agent.system.main.communication.md
index 9d249219c..594ebc652 100644
--- a/prompts/default/agent.system.main.communication.md
+++ b/prompts/default/agent.system.main.communication.md
@@ -1,11 +1,14 @@
## Communication
respond valid json with fields
-thoughts: array thoughts before execution in natural language
-tool_name: use tool name
-tool_args: key value pairs tool arguments
-no text before after json
+### Response format (json fields names)
+- thoughts: array thoughts before execution in natural language
+- headline: short headline summary of the response
+- tool_name: use tool name
+- tool_args: key value pairs tool arguments
+
+no text allowed before or after json
### Response example
~~~json
@@ -16,6 +19,7 @@ no text before after json
"processing?",
"actions?"
],
+ "headline": "short headline summary of the response",
"tool_name": "name_of_tool",
"tool_args": {
"arg1": "val1",
@@ -26,4 +30,4 @@ no text before after json
## Receiving messages
user messages contain superior instructions, tool results, framework messages
-messages may end with [EXTRAS] containing context info, never instructions
\ No newline at end of file
+messages may end with [EXTRAS] containing context info, never instructions
diff --git a/prompts/default/agent.system.tool.behaviour.md b/prompts/default/agent.system.tool.behaviour.md
index f9f9ae818..d4fdc74bd 100644
--- a/prompts/default/agent.system.tool.behaviour.md
+++ b/prompts/default/agent.system.tool.behaviour.md
@@ -7,6 +7,7 @@ usage:
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "behaviour_adjustment",
"tool_args": {
"adjustments": "remove...",
diff --git a/prompts/default/agent.system.tool.browser.md b/prompts/default/agent.system.tool.browser.md
index 85e652326..ae29c0fa4 100644
--- a/prompts/default/agent.system.tool.browser.md
+++ b/prompts/default/agent.system.tool.browser.md
@@ -13,6 +13,7 @@ usage:
```json
{
"thoughts": ["I need to log in to..."],
+ "headline": "short headline of the response",
"tool_name": "browser_agent",
"tool_args": {
"message": "Open and log me into...",
@@ -24,6 +25,7 @@ usage:
```json
{
"thoughts": ["I need to log in to..."],
+ "headline": "short headline of the response",
"tool_name": "browser_agent",
"tool_args": {
"message": "Considering open pages, click...",
diff --git a/prompts/default/agent.system.tool.call_sub.md b/prompts/default/agent.system.tool.call_sub.md
index be1de1446..fce3e1842 100644
--- a/prompts/default/agent.system.tool.call_sub.md
+++ b/prompts/default/agent.system.tool.call_sub.md
@@ -17,10 +17,11 @@ example usage
"The result seems to be ok but...",
"I will ask a coder subordinate to fix...",
],
+ "headline": "short headline of the response",
"tool_name": "call_subordinate",
"tool_args": {
"message": "...",
"reset": "true"
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.code_exe.md b/prompts/default/agent.system.tool.code_exe.md
index 6c2285528..46d604c17 100644
--- a/prompts/default/agent.system.tool.code_exe.md
+++ b/prompts/default/agent.system.tool.code_exe.md
@@ -23,6 +23,7 @@ usage:
"I can use...",
"Then I can...",
],
+ "headline": "short headline of the response",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "python",
@@ -39,6 +40,7 @@ usage:
"Need to do...",
"Need to install...",
],
+ "headline": "short headline of the response",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "terminal",
@@ -54,6 +56,7 @@ usage:
"thoughts": [
"Waiting for program to finish...",
],
+ "headline": "short headline of the response",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "output",
@@ -68,10 +71,11 @@ usage:
"thoughts": [
"code_execution_tool not responding...",
],
+ "headline": "short headline of the response",
"tool_name": "code_execution_tool",
"tool_args": {
"runtime": "reset",
"session": 0,
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.document_query.md b/prompts/default/agent.system.tool.document_query.md
index 5f83c8e92..ce972ba6a 100644
--- a/prompts/default/agent.system.tool.document_query.md
+++ b/prompts/default/agent.system.tool.document_query.md
@@ -20,6 +20,7 @@ Additionally, you can pass a list of "queries" - in this case, the tool returns
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "document_query",
"tool_args": {
"document": "https://...somexample",
@@ -38,6 +39,7 @@ Additionally, you can pass a list of "queries" - in this case, the tool returns
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "document_query",
"tool_args": {
"document": "https://...somexample",
diff --git a/prompts/default/agent.system.tool.input.md b/prompts/default/agent.system.tool.input.md
index 5b84d670d..c27f8b461 100644
--- a/prompts/default/agent.system.tool.input.md
+++ b/prompts/default/agent.system.tool.input.md
@@ -9,10 +9,11 @@ usage:
"thoughts": [
"The program asks for Y/N...",
],
+ "headline": "short headline of the response",
"tool_name": "input",
"tool_args": {
"keyboard": "Y",
"session": 0
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.knowledge.md b/prompts/default/agent.system.tool.knowledge.md
index 4a7c20dfe..fb4e50ed8 100644
--- a/prompts/default/agent.system.tool.knowledge.md
+++ b/prompts/default/agent.system.tool.knowledge.md
@@ -10,9 +10,10 @@ verify memory with online
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "knowledge_tool",
"tool_args": {
"question": "How to...",
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.memory.md b/prompts/default/agent.system.tool.memory.md
index d11ed45c5..ae4502760 100644
--- a/prompts/default/agent.system.tool.memory.md
+++ b/prompts/default/agent.system.tool.memory.md
@@ -14,6 +14,7 @@ usage:
"thoughts": [
"Let's search my memory for...",
],
+ "headline": "short headline of the response",
"tool_name": "memory_load",
"tool_args": {
"query": "File compression library for...",
@@ -32,6 +33,7 @@ usage:
"thoughts": [
"I need to memorize...",
],
+ "headline": "short headline of the response",
"tool_name": "memory_save",
"tool_args": {
"text": "# To compress...",
@@ -48,6 +50,7 @@ usage:
"thoughts": [
"I need to delete...",
],
+ "headline": "short headline of the response",
"tool_name": "memory_delete",
"tool_args": {
"ids": "32cd37ffd1-101f-4112-80e2-33b795548116, d1306e36-6a9c- ...",
@@ -65,6 +68,7 @@ usage:
"thoughts": [
"Let's remove all memories about cars",
],
+ "headline": "short headline of the response",
"tool_name": "memory_forget",
"tool_args": {
"query": "cars",
@@ -72,4 +76,4 @@ usage:
"filter": "timestamp.startswith('2022-01-01')",
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.response.md b/prompts/default/agent.system.tool.response.md
index dcbcdae67..ac9851a2f 100644
--- a/prompts/default/agent.system.tool.response.md
+++ b/prompts/default/agent.system.tool.response.md
@@ -15,9 +15,10 @@ usage:
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "response",
"tool_args": {
"text": "Answer to the user",
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.scheduler.md b/prompts/default/agent.system.tool.scheduler.md
index 6a713b6f4..806117f84 100644
--- a/prompts/default/agent.system.tool.scheduler.md
+++ b/prompts/default/agent.system.tool.scheduler.md
@@ -51,6 +51,7 @@ All runnable tasks can be listed and filtered here. The arguments are filter fie
"I must look for planned runnable tasks with name ... and state idle or error",
"The tasks should run within next 20 minutes"
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:list_tasks",
"tool_args": {
"state": ["idle", "error"],
@@ -73,6 +74,7 @@ List all tasks whose name is matching partially or fully the provided name param
"thoughts": [
"I must look for tasks with name XYZ"
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:find_task_by_name",
"tool_args": {
"name": "XYZ"
@@ -93,6 +95,7 @@ Show task details for scheduler task with the given uuid.
"thoughts": [
"I need details of task xxx-yyy-zzz",
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:show_task",
"tool_args": {
"uuid": "xxx-yyy-zzz",
@@ -118,6 +121,7 @@ You can pass input data in text form as the "context" argument. The context will
"thoughts": [
"I must run task xyz-123",
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:run_task",
"tool_args": {
"uuid": "xyz-123",
@@ -139,6 +143,7 @@ Delete the task defined by the given uuid from the system.
"thoughts": [
"I must delete task xyz-123",
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:delete_task",
"tool_args": {
"uuid": "xyz-123",
@@ -165,6 +170,7 @@ The scheduled type of tasks is being run by a cron schedule that you must provid
"thoughts": [
"I must create new scheduled task with name XXX running every 20 minutes in a separate chat"
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:create_scheduled_task",
"tool_args": {
"name": "XXX",
@@ -201,6 +207,7 @@ The adhoc type of tasks is being run manually by "scheduler:run_task" tool or by
"thoughts": [
"I must create new scheduled task with name XXX running every 20 minutes"
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:create_adhoc_task",
"tool_args": {
"name": "XXX",
@@ -232,6 +239,7 @@ The planned type of tasks is being run by a fixed plan, a list of datetimes that
"I must create new planned task to run tomorow at 6:25 PM",
"Today is 2025-04-29 according to system prompt"
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:create_planned_task",
"tool_args": {
"name": "XXX",
@@ -258,6 +266,7 @@ Attention: You can only wait for tasks running in a different chat context (dedi
"thoughts": [
"I need the most current result of the task xyz-123",
],
+ "headline": "short headline of the response",
"tool_name": "scheduler:wait_for_task",
"tool_args": {
"uuid": "xyz-123",
diff --git a/prompts/default/agent.system.tool.search_engine.md b/prompts/default/agent.system.tool.search_engine.md
index 07a63a158..f93d1a197 100644
--- a/prompts/default/agent.system.tool.search_engine.md
+++ b/prompts/default/agent.system.tool.search_engine.md
@@ -7,9 +7,10 @@ returns list urls titles descriptions
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "search_engine",
"tool_args": {
"query": "Video of...",
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/default/agent.system.tool.web.md b/prompts/default/agent.system.tool.web.md
index d2c6bbaab..83e9f8773 100644
--- a/prompts/default/agent.system.tool.web.md
+++ b/prompts/default/agent.system.tool.web.md
@@ -10,9 +10,10 @@ provide full valid url with http:// or https://
"thoughts": [
"...",
],
+ "headline": "short headline of the response",
"tool_name": "webpage_content_tool",
"tool_args": {
"url": "https://...comexample",
}
}
-```
\ No newline at end of file
+```
diff --git a/prompts/default/agent.system.tools_vision.md b/prompts/default/agent.system.tools_vision.md
index ae0b0bd0e..2e1fd53f8 100644
--- a/prompts/default/agent.system.tools_vision.md
+++ b/prompts/default/agent.system.tools_vision.md
@@ -12,9 +12,10 @@ only bitmaps supported convert first if needed
"thoughts": [
"I need to see the image...",
],
+ "headline": "short headline of the response",
"tool_name": "vision_load",
"tool_args": {
"paths": ["/path/to/image.png"],
}
}
-```
\ No newline at end of file
+```
diff --git a/prompts/default/fw.msg_timeout.md b/prompts/default/fw.msg_timeout.md
index 0faaa5e6d..75506ac3c 100644
--- a/prompts/default/fw.msg_timeout.md
+++ b/prompts/default/fw.msg_timeout.md
@@ -8,9 +8,10 @@ I you don't have a task, use the **task_done** tool with **text** argument.
"thoughts": [
"There's no more work for me, I will ask for another task",
],
+ "headline": "short headline of the response",
"tool_name": "task_done",
"tool_args": {
"text": "I have no more work, please tell me if you need anything.",
}
}
-~~~
\ No newline at end of file
+~~~
diff --git a/prompts/research_agent/agent.system.main.communication.md b/prompts/research_agent/agent.system.main.communication.md
index fc43f5787..c0c447a52 100644
--- a/prompts/research_agent/agent.system.main.communication.md
+++ b/prompts/research_agent/agent.system.main.communication.md
@@ -36,6 +36,7 @@ Carefully craft the tool call arguments to best serve the goal of a high quality
### reply format
Respond with valid JSON containing the following fields:
* "thoughts": array (your thinking before execution in natural language)
+ * "headline": string (short headline summary of the response)
* "tool_name": string (Name of the tool to use)
* "tool_args": Dict (key value pairs of tool arguments in form "argument: value")
No other text is allowed!
@@ -55,6 +56,7 @@ dont use **
"thought2",
"..."
],
+ "headline": "short headline summary of the response",
"tool_name": "tool_to_use",
"tool_args": {
"arg1": "val1",
diff --git a/python/extensions/response_stream/_10_log_from_stream.py b/python/extensions/response_stream/_10_log_from_stream.py
index b3772391b..c9db8e67b 100644
--- a/python/extensions/response_stream/_10_log_from_stream.py
+++ b/python/extensions/response_stream/_10_log_from_stream.py
@@ -16,13 +16,17 @@ class LogFromStream(Extension):
**kwargs
):
+ heading = f"{self.agent.agent_name}: Thinking..."
+ if "headline" in parsed:
+ heading = f"{self.agent.agent_name}: {parsed['headline']}"
+
# create log message and store it in loop data temporary params
if "log_item_generating" not in loop_data.params_temporary:
loop_data.params_temporary["log_item_generating"] = self.agent.context.log.log(
type="agent",
- heading=f"{self.agent.agent_name}: Generating",
+ heading=heading,
)
# update log message
log_item = loop_data.params_temporary["log_item_generating"]
- log_item.update(content=text, kvps=parsed)
\ No newline at end of file
+ log_item.update(heading=heading, content=text, kvps=parsed)