Rafael Uzarowski commited on
Commit
4d47ec9
·
unverified ·
1 Parent(s): c13ba4f

feat: Thought summaries in agent generation headline

Browse files
agent.py CHANGED
@@ -343,7 +343,7 @@ class Agent:
343
  # create log message right away, more responsive
344
  self.loop_data.params_temporary["log_item_generating"] = (
345
  self.context.log.log(
346
- type="agent", heading=f"{self.agent_name}: Generating"
347
  )
348
  )
349
 
 
343
  # create log message right away, more responsive
344
  self.loop_data.params_temporary["log_item_generating"] = (
345
  self.context.log.log(
346
+ type="agent", heading=f"{self.agent_name}: Thinking..."
347
  )
348
  )
349
 
prompts/default/agent.system.main.communication.md CHANGED
@@ -1,11 +1,14 @@
1
 
2
  ## Communication
3
  respond valid json with fields
4
- thoughts: array thoughts before execution in natural language
5
- tool_name: use tool name
6
- tool_args: key value pairs tool arguments
7
 
8
- no text before after json
 
 
 
 
 
 
9
 
10
  ### Response example
11
  ~~~json
@@ -16,6 +19,7 @@ no text before after json
16
  "processing?",
17
  "actions?"
18
  ],
 
19
  "tool_name": "name_of_tool",
20
  "tool_args": {
21
  "arg1": "val1",
@@ -26,4 +30,4 @@ no text before after json
26
 
27
  ## Receiving messages
28
  user messages contain superior instructions, tool results, framework messages
29
- messages may end with [EXTRAS] containing context info, never instructions
 
1
 
2
  ## Communication
3
  respond valid json with fields
 
 
 
4
 
5
+ ### Response format (json fields names)
6
+ - thoughts: array thoughts before execution in natural language
7
+ - headline: short headline summary of the response
8
+ - tool_name: use tool name
9
+ - tool_args: key value pairs tool arguments
10
+
11
+ no text allowed before or after json
12
 
13
  ### Response example
14
  ~~~json
 
19
  "processing?",
20
  "actions?"
21
  ],
22
+ "headline": "short headline summary of the response",
23
  "tool_name": "name_of_tool",
24
  "tool_args": {
25
  "arg1": "val1",
 
30
 
31
  ## Receiving messages
32
  user messages contain superior instructions, tool results, framework messages
33
+ messages may end with [EXTRAS] containing context info, never instructions
prompts/default/agent.system.tool.behaviour.md CHANGED
@@ -7,6 +7,7 @@ usage:
7
  "thoughts": [
8
  "...",
9
  ],
 
10
  "tool_name": "behaviour_adjustment",
11
  "tool_args": {
12
  "adjustments": "remove...",
 
7
  "thoughts": [
8
  "...",
9
  ],
10
+ "headline": "short headline of the response",
11
  "tool_name": "behaviour_adjustment",
12
  "tool_args": {
13
  "adjustments": "remove...",
prompts/default/agent.system.tool.browser.md CHANGED
@@ -13,6 +13,7 @@ usage:
13
  ```json
14
  {
15
  "thoughts": ["I need to log in to..."],
 
16
  "tool_name": "browser_agent",
17
  "tool_args": {
18
  "message": "Open and log me into...",
@@ -24,6 +25,7 @@ usage:
24
  ```json
25
  {
26
  "thoughts": ["I need to log in to..."],
 
27
  "tool_name": "browser_agent",
28
  "tool_args": {
29
  "message": "Considering open pages, click...",
 
13
  ```json
14
  {
15
  "thoughts": ["I need to log in to..."],
16
+ "headline": "short headline of the response",
17
  "tool_name": "browser_agent",
18
  "tool_args": {
19
  "message": "Open and log me into...",
 
25
  ```json
26
  {
27
  "thoughts": ["I need to log in to..."],
28
+ "headline": "short headline of the response",
29
  "tool_name": "browser_agent",
30
  "tool_args": {
31
  "message": "Considering open pages, click...",
prompts/default/agent.system.tool.call_sub.md CHANGED
@@ -17,10 +17,11 @@ example usage
17
  "The result seems to be ok but...",
18
  "I will ask a coder subordinate to fix...",
19
  ],
 
20
  "tool_name": "call_subordinate",
21
  "tool_args": {
22
  "message": "...",
23
  "reset": "true"
24
  }
25
  }
26
- ~~~
 
17
  "The result seems to be ok but...",
18
  "I will ask a coder subordinate to fix...",
19
  ],
20
+ "headline": "short headline of the response",
21
  "tool_name": "call_subordinate",
22
  "tool_args": {
23
  "message": "...",
24
  "reset": "true"
25
  }
26
  }
27
+ ~~~
prompts/default/agent.system.tool.code_exe.md CHANGED
@@ -23,6 +23,7 @@ usage:
23
  "I can use...",
24
  "Then I can...",
25
  ],
 
26
  "tool_name": "code_execution_tool",
27
  "tool_args": {
28
  "runtime": "python",
@@ -39,6 +40,7 @@ usage:
39
  "Need to do...",
40
  "Need to install...",
41
  ],
 
42
  "tool_name": "code_execution_tool",
43
  "tool_args": {
44
  "runtime": "terminal",
@@ -54,6 +56,7 @@ usage:
54
  "thoughts": [
55
  "Waiting for program to finish...",
56
  ],
 
57
  "tool_name": "code_execution_tool",
58
  "tool_args": {
59
  "runtime": "output",
@@ -68,10 +71,11 @@ usage:
68
  "thoughts": [
69
  "code_execution_tool not responding...",
70
  ],
 
71
  "tool_name": "code_execution_tool",
72
  "tool_args": {
73
  "runtime": "reset",
74
  "session": 0,
75
  }
76
  }
77
- ~~~
 
23
  "I can use...",
24
  "Then I can...",
25
  ],
26
+ "headline": "short headline of the response",
27
  "tool_name": "code_execution_tool",
28
  "tool_args": {
29
  "runtime": "python",
 
40
  "Need to do...",
41
  "Need to install...",
42
  ],
43
+ "headline": "short headline of the response",
44
  "tool_name": "code_execution_tool",
45
  "tool_args": {
46
  "runtime": "terminal",
 
56
  "thoughts": [
57
  "Waiting for program to finish...",
58
  ],
59
+ "headline": "short headline of the response",
60
  "tool_name": "code_execution_tool",
61
  "tool_args": {
62
  "runtime": "output",
 
71
  "thoughts": [
72
  "code_execution_tool not responding...",
73
  ],
74
+ "headline": "short headline of the response",
75
  "tool_name": "code_execution_tool",
76
  "tool_args": {
77
  "runtime": "reset",
78
  "session": 0,
79
  }
80
  }
81
+ ~~~
prompts/default/agent.system.tool.document_query.md CHANGED
@@ -20,6 +20,7 @@ Additionally, you can pass a list of "queries" - in this case, the tool returns
20
  "thoughts": [
21
  "...",
22
  ],
 
23
  "tool_name": "document_query",
24
  "tool_args": {
25
  "document": "https://...somexample",
@@ -38,6 +39,7 @@ Additionally, you can pass a list of "queries" - in this case, the tool returns
38
  "thoughts": [
39
  "...",
40
  ],
 
41
  "tool_name": "document_query",
42
  "tool_args": {
43
  "document": "https://...somexample",
 
20
  "thoughts": [
21
  "...",
22
  ],
23
+ "headline": "short headline of the response",
24
  "tool_name": "document_query",
25
  "tool_args": {
26
  "document": "https://...somexample",
 
39
  "thoughts": [
40
  "...",
41
  ],
42
+ "headline": "short headline of the response",
43
  "tool_name": "document_query",
44
  "tool_args": {
45
  "document": "https://...somexample",
prompts/default/agent.system.tool.input.md CHANGED
@@ -9,10 +9,11 @@ usage:
9
  "thoughts": [
10
  "The program asks for Y/N...",
11
  ],
 
12
  "tool_name": "input",
13
  "tool_args": {
14
  "keyboard": "Y",
15
  "session": 0
16
  }
17
  }
18
- ~~~
 
9
  "thoughts": [
10
  "The program asks for Y/N...",
11
  ],
12
+ "headline": "short headline of the response",
13
  "tool_name": "input",
14
  "tool_args": {
15
  "keyboard": "Y",
16
  "session": 0
17
  }
18
  }
19
+ ~~~
prompts/default/agent.system.tool.knowledge.md CHANGED
@@ -10,9 +10,10 @@ verify memory with online
10
  "thoughts": [
11
  "...",
12
  ],
 
13
  "tool_name": "knowledge_tool",
14
  "tool_args": {
15
  "question": "How to...",
16
  }
17
  }
18
- ~~~
 
10
  "thoughts": [
11
  "...",
12
  ],
13
+ "headline": "short headline of the response",
14
  "tool_name": "knowledge_tool",
15
  "tool_args": {
16
  "question": "How to...",
17
  }
18
  }
19
+ ~~~
prompts/default/agent.system.tool.memory.md CHANGED
@@ -14,6 +14,7 @@ usage:
14
  "thoughts": [
15
  "Let's search my memory for...",
16
  ],
 
17
  "tool_name": "memory_load",
18
  "tool_args": {
19
  "query": "File compression library for...",
@@ -32,6 +33,7 @@ usage:
32
  "thoughts": [
33
  "I need to memorize...",
34
  ],
 
35
  "tool_name": "memory_save",
36
  "tool_args": {
37
  "text": "# To compress...",
@@ -48,6 +50,7 @@ usage:
48
  "thoughts": [
49
  "I need to delete...",
50
  ],
 
51
  "tool_name": "memory_delete",
52
  "tool_args": {
53
  "ids": "32cd37ffd1-101f-4112-80e2-33b795548116, d1306e36-6a9c- ...",
@@ -65,6 +68,7 @@ usage:
65
  "thoughts": [
66
  "Let's remove all memories about cars",
67
  ],
 
68
  "tool_name": "memory_forget",
69
  "tool_args": {
70
  "query": "cars",
@@ -72,4 +76,4 @@ usage:
72
  "filter": "timestamp.startswith('2022-01-01')",
73
  }
74
  }
75
- ~~~
 
14
  "thoughts": [
15
  "Let's search my memory for...",
16
  ],
17
+ "headline": "short headline of the response",
18
  "tool_name": "memory_load",
19
  "tool_args": {
20
  "query": "File compression library for...",
 
33
  "thoughts": [
34
  "I need to memorize...",
35
  ],
36
+ "headline": "short headline of the response",
37
  "tool_name": "memory_save",
38
  "tool_args": {
39
  "text": "# To compress...",
 
50
  "thoughts": [
51
  "I need to delete...",
52
  ],
53
+ "headline": "short headline of the response",
54
  "tool_name": "memory_delete",
55
  "tool_args": {
56
  "ids": "32cd37ffd1-101f-4112-80e2-33b795548116, d1306e36-6a9c- ...",
 
68
  "thoughts": [
69
  "Let's remove all memories about cars",
70
  ],
71
+ "headline": "short headline of the response",
72
  "tool_name": "memory_forget",
73
  "tool_args": {
74
  "query": "cars",
 
76
  "filter": "timestamp.startswith('2022-01-01')",
77
  }
78
  }
79
+ ~~~
prompts/default/agent.system.tool.response.md CHANGED
@@ -15,9 +15,10 @@ usage:
15
  "thoughts": [
16
  "...",
17
  ],
 
18
  "tool_name": "response",
19
  "tool_args": {
20
  "text": "Answer to the user",
21
  }
22
  }
23
- ~~~
 
15
  "thoughts": [
16
  "...",
17
  ],
18
+ "headline": "short headline of the response",
19
  "tool_name": "response",
20
  "tool_args": {
21
  "text": "Answer to the user",
22
  }
23
  }
24
+ ~~~
prompts/default/agent.system.tool.scheduler.md CHANGED
@@ -51,6 +51,7 @@ All runnable tasks can be listed and filtered here. The arguments are filter fie
51
  "I must look for planned runnable tasks with name ... and state idle or error",
52
  "The tasks should run within next 20 minutes"
53
  ],
 
54
  "tool_name": "scheduler:list_tasks",
55
  "tool_args": {
56
  "state": ["idle", "error"],
@@ -73,6 +74,7 @@ List all tasks whose name is matching partially or fully the provided name param
73
  "thoughts": [
74
  "I must look for tasks with name XYZ"
75
  ],
 
76
  "tool_name": "scheduler:find_task_by_name",
77
  "tool_args": {
78
  "name": "XYZ"
@@ -93,6 +95,7 @@ Show task details for scheduler task with the given uuid.
93
  "thoughts": [
94
  "I need details of task xxx-yyy-zzz",
95
  ],
 
96
  "tool_name": "scheduler:show_task",
97
  "tool_args": {
98
  "uuid": "xxx-yyy-zzz",
@@ -118,6 +121,7 @@ You can pass input data in text form as the "context" argument. The context will
118
  "thoughts": [
119
  "I must run task xyz-123",
120
  ],
 
121
  "tool_name": "scheduler:run_task",
122
  "tool_args": {
123
  "uuid": "xyz-123",
@@ -139,6 +143,7 @@ Delete the task defined by the given uuid from the system.
139
  "thoughts": [
140
  "I must delete task xyz-123",
141
  ],
 
142
  "tool_name": "scheduler:delete_task",
143
  "tool_args": {
144
  "uuid": "xyz-123",
@@ -165,6 +170,7 @@ The scheduled type of tasks is being run by a cron schedule that you must provid
165
  "thoughts": [
166
  "I must create new scheduled task with name XXX running every 20 minutes in a separate chat"
167
  ],
 
168
  "tool_name": "scheduler:create_scheduled_task",
169
  "tool_args": {
170
  "name": "XXX",
@@ -201,6 +207,7 @@ The adhoc type of tasks is being run manually by "scheduler:run_task" tool or by
201
  "thoughts": [
202
  "I must create new scheduled task with name XXX running every 20 minutes"
203
  ],
 
204
  "tool_name": "scheduler:create_adhoc_task",
205
  "tool_args": {
206
  "name": "XXX",
@@ -232,6 +239,7 @@ The planned type of tasks is being run by a fixed plan, a list of datetimes that
232
  "I must create new planned task to run tomorow at 6:25 PM",
233
  "Today is 2025-04-29 according to system prompt"
234
  ],
 
235
  "tool_name": "scheduler:create_planned_task",
236
  "tool_args": {
237
  "name": "XXX",
@@ -258,6 +266,7 @@ Attention: You can only wait for tasks running in a different chat context (dedi
258
  "thoughts": [
259
  "I need the most current result of the task xyz-123",
260
  ],
 
261
  "tool_name": "scheduler:wait_for_task",
262
  "tool_args": {
263
  "uuid": "xyz-123",
 
51
  "I must look for planned runnable tasks with name ... and state idle or error",
52
  "The tasks should run within next 20 minutes"
53
  ],
54
+ "headline": "short headline of the response",
55
  "tool_name": "scheduler:list_tasks",
56
  "tool_args": {
57
  "state": ["idle", "error"],
 
74
  "thoughts": [
75
  "I must look for tasks with name XYZ"
76
  ],
77
+ "headline": "short headline of the response",
78
  "tool_name": "scheduler:find_task_by_name",
79
  "tool_args": {
80
  "name": "XYZ"
 
95
  "thoughts": [
96
  "I need details of task xxx-yyy-zzz",
97
  ],
98
+ "headline": "short headline of the response",
99
  "tool_name": "scheduler:show_task",
100
  "tool_args": {
101
  "uuid": "xxx-yyy-zzz",
 
121
  "thoughts": [
122
  "I must run task xyz-123",
123
  ],
124
+ "headline": "short headline of the response",
125
  "tool_name": "scheduler:run_task",
126
  "tool_args": {
127
  "uuid": "xyz-123",
 
143
  "thoughts": [
144
  "I must delete task xyz-123",
145
  ],
146
+ "headline": "short headline of the response",
147
  "tool_name": "scheduler:delete_task",
148
  "tool_args": {
149
  "uuid": "xyz-123",
 
170
  "thoughts": [
171
  "I must create new scheduled task with name XXX running every 20 minutes in a separate chat"
172
  ],
173
+ "headline": "short headline of the response",
174
  "tool_name": "scheduler:create_scheduled_task",
175
  "tool_args": {
176
  "name": "XXX",
 
207
  "thoughts": [
208
  "I must create new scheduled task with name XXX running every 20 minutes"
209
  ],
210
+ "headline": "short headline of the response",
211
  "tool_name": "scheduler:create_adhoc_task",
212
  "tool_args": {
213
  "name": "XXX",
 
239
  "I must create new planned task to run tomorow at 6:25 PM",
240
  "Today is 2025-04-29 according to system prompt"
241
  ],
242
+ "headline": "short headline of the response",
243
  "tool_name": "scheduler:create_planned_task",
244
  "tool_args": {
245
  "name": "XXX",
 
266
  "thoughts": [
267
  "I need the most current result of the task xyz-123",
268
  ],
269
+ "headline": "short headline of the response",
270
  "tool_name": "scheduler:wait_for_task",
271
  "tool_args": {
272
  "uuid": "xyz-123",
prompts/default/agent.system.tool.search_engine.md CHANGED
@@ -7,9 +7,10 @@ returns list urls titles descriptions
7
  "thoughts": [
8
  "...",
9
  ],
 
10
  "tool_name": "search_engine",
11
  "tool_args": {
12
  "query": "Video of...",
13
  }
14
  }
15
- ~~~
 
7
  "thoughts": [
8
  "...",
9
  ],
10
+ "headline": "short headline of the response",
11
  "tool_name": "search_engine",
12
  "tool_args": {
13
  "query": "Video of...",
14
  }
15
  }
16
+ ~~~
prompts/default/agent.system.tool.web.md CHANGED
@@ -10,9 +10,10 @@ provide full valid url with http:// or https://
10
  "thoughts": [
11
  "...",
12
  ],
 
13
  "tool_name": "webpage_content_tool",
14
  "tool_args": {
15
  "url": "https://...comexample",
16
  }
17
  }
18
- ```
 
10
  "thoughts": [
11
  "...",
12
  ],
13
+ "headline": "short headline of the response",
14
  "tool_name": "webpage_content_tool",
15
  "tool_args": {
16
  "url": "https://...comexample",
17
  }
18
  }
19
+ ```
prompts/default/agent.system.tools_vision.md CHANGED
@@ -12,9 +12,10 @@ only bitmaps supported convert first if needed
12
  "thoughts": [
13
  "I need to see the image...",
14
  ],
 
15
  "tool_name": "vision_load",
16
  "tool_args": {
17
  "paths": ["/path/to/image.png"],
18
  }
19
  }
20
- ```
 
12
  "thoughts": [
13
  "I need to see the image...",
14
  ],
15
+ "headline": "short headline of the response",
16
  "tool_name": "vision_load",
17
  "tool_args": {
18
  "paths": ["/path/to/image.png"],
19
  }
20
  }
21
+ ```
prompts/default/fw.msg_timeout.md CHANGED
@@ -8,9 +8,10 @@ I you don't have a task, use the **task_done** tool with **text** argument.
8
  "thoughts": [
9
  "There's no more work for me, I will ask for another task",
10
  ],
 
11
  "tool_name": "task_done",
12
  "tool_args": {
13
  "text": "I have no more work, please tell me if you need anything.",
14
  }
15
  }
16
- ~~~
 
8
  "thoughts": [
9
  "There's no more work for me, I will ask for another task",
10
  ],
11
+ "headline": "short headline of the response",
12
  "tool_name": "task_done",
13
  "tool_args": {
14
  "text": "I have no more work, please tell me if you need anything.",
15
  }
16
  }
17
+ ~~~
prompts/research_agent/agent.system.main.communication.md CHANGED
@@ -36,6 +36,7 @@ Carefully craft the tool call arguments to best serve the goal of a high quality
36
  ### reply format
37
  Respond with valid JSON containing the following fields:
38
  * "thoughts": array (your thinking before execution in natural language)
 
39
  * "tool_name": string (Name of the tool to use)
40
  * "tool_args": Dict (key value pairs of tool arguments in form "argument: value")
41
  No other text is allowed!
@@ -55,6 +56,7 @@ dont use **
55
  "thought2",
56
  "..."
57
  ],
 
58
  "tool_name": "tool_to_use",
59
  "tool_args": {
60
  "arg1": "val1",
 
36
  ### reply format
37
  Respond with valid JSON containing the following fields:
38
  * "thoughts": array (your thinking before execution in natural language)
39
+ * "headline": string (short headline summary of the response)
40
  * "tool_name": string (Name of the tool to use)
41
  * "tool_args": Dict (key value pairs of tool arguments in form "argument: value")
42
  No other text is allowed!
 
56
  "thought2",
57
  "..."
58
  ],
59
+ "headline": "short headline summary of the response",
60
  "tool_name": "tool_to_use",
61
  "tool_args": {
62
  "arg1": "val1",
python/extensions/response_stream/_10_log_from_stream.py CHANGED
@@ -16,13 +16,17 @@ class LogFromStream(Extension):
16
  **kwargs
17
  ):
18
 
 
 
 
 
19
  # create log message and store it in loop data temporary params
20
  if "log_item_generating" not in loop_data.params_temporary:
21
  loop_data.params_temporary["log_item_generating"] = self.agent.context.log.log(
22
  type="agent",
23
- heading=f"{self.agent.agent_name}: Generating",
24
  )
25
 
26
  # update log message
27
  log_item = loop_data.params_temporary["log_item_generating"]
28
- log_item.update(content=text, kvps=parsed)
 
16
  **kwargs
17
  ):
18
 
19
+ heading = f"{self.agent.agent_name}: Thinking..."
20
+ if "headline" in parsed:
21
+ heading = f"{self.agent.agent_name}: {parsed['headline']}"
22
+
23
  # create log message and store it in loop data temporary params
24
  if "log_item_generating" not in loop_data.params_temporary:
25
  loop_data.params_temporary["log_item_generating"] = self.agent.context.log.log(
26
  type="agent",
27
+ heading=heading,
28
  )
29
 
30
  # update log message
31
  log_item = loop_data.params_temporary["log_item_generating"]
32
+ log_item.update(heading=heading, content=text, kvps=parsed)