@elizaos/python 2.0.0-alpha.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/LICENSE +26 -0
  2. package/README.md +239 -0
  3. package/elizaos/__init__.py +280 -0
  4. package/elizaos/action_docs.py +149 -0
  5. package/elizaos/advanced_capabilities/__init__.py +85 -0
  6. package/elizaos/advanced_capabilities/actions/__init__.py +54 -0
  7. package/elizaos/advanced_capabilities/actions/add_contact.py +139 -0
  8. package/elizaos/advanced_capabilities/actions/follow_room.py +151 -0
  9. package/elizaos/advanced_capabilities/actions/image_generation.py +148 -0
  10. package/elizaos/advanced_capabilities/actions/mute_room.py +164 -0
  11. package/elizaos/advanced_capabilities/actions/remove_contact.py +145 -0
  12. package/elizaos/advanced_capabilities/actions/roles.py +207 -0
  13. package/elizaos/advanced_capabilities/actions/schedule_follow_up.py +154 -0
  14. package/elizaos/advanced_capabilities/actions/search_contacts.py +145 -0
  15. package/elizaos/advanced_capabilities/actions/send_message.py +187 -0
  16. package/elizaos/advanced_capabilities/actions/settings.py +151 -0
  17. package/elizaos/advanced_capabilities/actions/unfollow_room.py +164 -0
  18. package/elizaos/advanced_capabilities/actions/unmute_room.py +164 -0
  19. package/elizaos/advanced_capabilities/actions/update_contact.py +164 -0
  20. package/elizaos/advanced_capabilities/actions/update_entity.py +161 -0
  21. package/elizaos/advanced_capabilities/evaluators/__init__.py +18 -0
  22. package/elizaos/advanced_capabilities/evaluators/reflection.py +134 -0
  23. package/elizaos/advanced_capabilities/evaluators/relationship_extraction.py +203 -0
  24. package/elizaos/advanced_capabilities/providers/__init__.py +36 -0
  25. package/elizaos/advanced_capabilities/providers/agent_settings.py +60 -0
  26. package/elizaos/advanced_capabilities/providers/contacts.py +77 -0
  27. package/elizaos/advanced_capabilities/providers/facts.py +82 -0
  28. package/elizaos/advanced_capabilities/providers/follow_ups.py +113 -0
  29. package/elizaos/advanced_capabilities/providers/knowledge.py +83 -0
  30. package/elizaos/advanced_capabilities/providers/relationships.py +112 -0
  31. package/elizaos/advanced_capabilities/providers/roles.py +97 -0
  32. package/elizaos/advanced_capabilities/providers/settings.py +51 -0
  33. package/elizaos/advanced_capabilities/services/__init__.py +18 -0
  34. package/elizaos/advanced_capabilities/services/follow_up.py +138 -0
  35. package/elizaos/advanced_capabilities/services/rolodex.py +244 -0
  36. package/elizaos/advanced_memory/__init__.py +3 -0
  37. package/elizaos/advanced_memory/evaluators.py +97 -0
  38. package/elizaos/advanced_memory/memory_service.py +556 -0
  39. package/elizaos/advanced_memory/plugin.py +30 -0
  40. package/elizaos/advanced_memory/prompts.py +12 -0
  41. package/elizaos/advanced_memory/providers.py +90 -0
  42. package/elizaos/advanced_memory/types.py +65 -0
  43. package/elizaos/advanced_planning/__init__.py +10 -0
  44. package/elizaos/advanced_planning/actions.py +145 -0
  45. package/elizaos/advanced_planning/message_classifier.py +127 -0
  46. package/elizaos/advanced_planning/planning_service.py +712 -0
  47. package/elizaos/advanced_planning/plugin.py +40 -0
  48. package/elizaos/advanced_planning/prompts.py +4 -0
  49. package/elizaos/basic_capabilities/__init__.py +66 -0
  50. package/elizaos/basic_capabilities/actions/__init__.py +24 -0
  51. package/elizaos/basic_capabilities/actions/choice.py +140 -0
  52. package/elizaos/basic_capabilities/actions/ignore.py +66 -0
  53. package/elizaos/basic_capabilities/actions/none.py +56 -0
  54. package/elizaos/basic_capabilities/actions/reply.py +120 -0
  55. package/elizaos/basic_capabilities/providers/__init__.py +54 -0
  56. package/elizaos/basic_capabilities/providers/action_state.py +113 -0
  57. package/elizaos/basic_capabilities/providers/actions.py +263 -0
  58. package/elizaos/basic_capabilities/providers/attachments.py +76 -0
  59. package/elizaos/basic_capabilities/providers/capabilities.py +62 -0
  60. package/elizaos/basic_capabilities/providers/character.py +113 -0
  61. package/elizaos/basic_capabilities/providers/choice.py +73 -0
  62. package/elizaos/basic_capabilities/providers/context_bench.py +44 -0
  63. package/elizaos/basic_capabilities/providers/current_time.py +58 -0
  64. package/elizaos/basic_capabilities/providers/entities.py +99 -0
  65. package/elizaos/basic_capabilities/providers/evaluators.py +54 -0
  66. package/elizaos/basic_capabilities/providers/providers_list.py +55 -0
  67. package/elizaos/basic_capabilities/providers/recent_messages.py +85 -0
  68. package/elizaos/basic_capabilities/providers/time.py +45 -0
  69. package/elizaos/basic_capabilities/providers/world.py +93 -0
  70. package/elizaos/basic_capabilities/services/__init__.py +18 -0
  71. package/elizaos/basic_capabilities/services/embedding.py +122 -0
  72. package/elizaos/basic_capabilities/services/task.py +178 -0
  73. package/elizaos/bootstrap/__init__.py +12 -0
  74. package/elizaos/bootstrap/actions/__init__.py +68 -0
  75. package/elizaos/bootstrap/actions/add_contact.py +149 -0
  76. package/elizaos/bootstrap/actions/choice.py +147 -0
  77. package/elizaos/bootstrap/actions/follow_room.py +151 -0
  78. package/elizaos/bootstrap/actions/ignore.py +80 -0
  79. package/elizaos/bootstrap/actions/image_generation.py +135 -0
  80. package/elizaos/bootstrap/actions/mute_room.py +151 -0
  81. package/elizaos/bootstrap/actions/none.py +71 -0
  82. package/elizaos/bootstrap/actions/remove_contact.py +159 -0
  83. package/elizaos/bootstrap/actions/reply.py +140 -0
  84. package/elizaos/bootstrap/actions/roles.py +193 -0
  85. package/elizaos/bootstrap/actions/schedule_follow_up.py +164 -0
  86. package/elizaos/bootstrap/actions/search_contacts.py +159 -0
  87. package/elizaos/bootstrap/actions/send_message.py +173 -0
  88. package/elizaos/bootstrap/actions/settings.py +165 -0
  89. package/elizaos/bootstrap/actions/unfollow_room.py +151 -0
  90. package/elizaos/bootstrap/actions/unmute_room.py +151 -0
  91. package/elizaos/bootstrap/actions/update_contact.py +178 -0
  92. package/elizaos/bootstrap/actions/update_entity.py +175 -0
  93. package/elizaos/bootstrap/autonomy/__init__.py +18 -0
  94. package/elizaos/bootstrap/autonomy/action.py +197 -0
  95. package/elizaos/bootstrap/autonomy/providers.py +165 -0
  96. package/elizaos/bootstrap/autonomy/routes.py +171 -0
  97. package/elizaos/bootstrap/autonomy/service.py +562 -0
  98. package/elizaos/bootstrap/autonomy/types.py +18 -0
  99. package/elizaos/bootstrap/evaluators/__init__.py +19 -0
  100. package/elizaos/bootstrap/evaluators/reflection.py +118 -0
  101. package/elizaos/bootstrap/evaluators/relationship_extraction.py +192 -0
  102. package/elizaos/bootstrap/plugin.py +140 -0
  103. package/elizaos/bootstrap/providers/__init__.py +80 -0
  104. package/elizaos/bootstrap/providers/action_state.py +71 -0
  105. package/elizaos/bootstrap/providers/actions.py +256 -0
  106. package/elizaos/bootstrap/providers/agent_settings.py +63 -0
  107. package/elizaos/bootstrap/providers/attachments.py +76 -0
  108. package/elizaos/bootstrap/providers/capabilities.py +66 -0
  109. package/elizaos/bootstrap/providers/character.py +128 -0
  110. package/elizaos/bootstrap/providers/choice.py +77 -0
  111. package/elizaos/bootstrap/providers/contacts.py +78 -0
  112. package/elizaos/bootstrap/providers/context_bench.py +49 -0
  113. package/elizaos/bootstrap/providers/current_time.py +56 -0
  114. package/elizaos/bootstrap/providers/entities.py +99 -0
  115. package/elizaos/bootstrap/providers/evaluators.py +58 -0
  116. package/elizaos/bootstrap/providers/facts.py +86 -0
  117. package/elizaos/bootstrap/providers/follow_ups.py +116 -0
  118. package/elizaos/bootstrap/providers/knowledge.py +73 -0
  119. package/elizaos/bootstrap/providers/providers_list.py +59 -0
  120. package/elizaos/bootstrap/providers/recent_messages.py +85 -0
  121. package/elizaos/bootstrap/providers/relationships.py +106 -0
  122. package/elizaos/bootstrap/providers/roles.py +95 -0
  123. package/elizaos/bootstrap/providers/settings.py +55 -0
  124. package/elizaos/bootstrap/providers/time.py +45 -0
  125. package/elizaos/bootstrap/providers/world.py +97 -0
  126. package/elizaos/bootstrap/services/__init__.py +26 -0
  127. package/elizaos/bootstrap/services/embedding.py +122 -0
  128. package/elizaos/bootstrap/services/follow_up.py +138 -0
  129. package/elizaos/bootstrap/services/rolodex.py +244 -0
  130. package/elizaos/bootstrap/services/task.py +585 -0
  131. package/elizaos/bootstrap/types.py +54 -0
  132. package/elizaos/bootstrap/utils/__init__.py +7 -0
  133. package/elizaos/bootstrap/utils/xml.py +69 -0
  134. package/elizaos/character.py +149 -0
  135. package/elizaos/logger.py +179 -0
  136. package/elizaos/media/__init__.py +45 -0
  137. package/elizaos/media/mime.py +315 -0
  138. package/elizaos/media/search.py +161 -0
  139. package/elizaos/media/tests/__init__.py +1 -0
  140. package/elizaos/media/tests/test_mime.py +117 -0
  141. package/elizaos/media/tests/test_search.py +156 -0
  142. package/elizaos/plugin.py +191 -0
  143. package/elizaos/prompts.py +1071 -0
  144. package/elizaos/py.typed +0 -0
  145. package/elizaos/runtime.py +2572 -0
  146. package/elizaos/services/__init__.py +49 -0
  147. package/elizaos/services/hook_service.py +511 -0
  148. package/elizaos/services/message_service.py +1248 -0
  149. package/elizaos/settings.py +182 -0
  150. package/elizaos/streaming_context.py +159 -0
  151. package/elizaos/trajectory_context.py +18 -0
  152. package/elizaos/types/__init__.py +512 -0
  153. package/elizaos/types/agent.py +31 -0
  154. package/elizaos/types/components.py +208 -0
  155. package/elizaos/types/database.py +64 -0
  156. package/elizaos/types/environment.py +46 -0
  157. package/elizaos/types/events.py +47 -0
  158. package/elizaos/types/memory.py +45 -0
  159. package/elizaos/types/model.py +393 -0
  160. package/elizaos/types/plugin.py +188 -0
  161. package/elizaos/types/primitives.py +100 -0
  162. package/elizaos/types/runtime.py +460 -0
  163. package/elizaos/types/service.py +113 -0
  164. package/elizaos/types/service_interfaces.py +244 -0
  165. package/elizaos/types/state.py +188 -0
  166. package/elizaos/types/task.py +29 -0
  167. package/elizaos/utils/__init__.py +108 -0
  168. package/elizaos/utils/spec_examples.py +48 -0
  169. package/elizaos/utils/streaming.py +426 -0
  170. package/elizaos_atropos_shared/__init__.py +1 -0
  171. package/elizaos_atropos_shared/canonical_eliza.py +282 -0
  172. package/package.json +19 -0
  173. package/pyproject.toml +143 -0
  174. package/requirements-dev.in +11 -0
  175. package/requirements-dev.lock +134 -0
  176. package/requirements.in +9 -0
  177. package/requirements.lock +64 -0
  178. package/tests/__init__.py +0 -0
  179. package/tests/test_action_parameters.py +154 -0
  180. package/tests/test_actions_provider_examples.py +39 -0
  181. package/tests/test_advanced_memory_behavior.py +96 -0
  182. package/tests/test_advanced_memory_flag.py +30 -0
  183. package/tests/test_advanced_planning_behavior.py +225 -0
  184. package/tests/test_advanced_planning_flag.py +26 -0
  185. package/tests/test_autonomy.py +445 -0
  186. package/tests/test_bootstrap_initialize.py +37 -0
  187. package/tests/test_character.py +163 -0
  188. package/tests/test_character_provider.py +231 -0
  189. package/tests/test_dynamic_prompt_exec.py +561 -0
  190. package/tests/test_logger_redaction.py +43 -0
  191. package/tests/test_plugin.py +117 -0
  192. package/tests/test_runtime.py +422 -0
  193. package/tests/test_salt_production_enforcement.py +22 -0
  194. package/tests/test_settings_crypto.py +118 -0
  195. package/tests/test_streaming.py +295 -0
  196. package/tests/test_types.py +221 -0
  197. package/tests/test_uuid_parity.py +46 -0
@@ -0,0 +1,1071 @@
1
+ from __future__ import annotations
2
+
3
+ REPLY_TEMPLATE = """# Task: Generate dialog for the character {{agentName}}.
4
+
5
+ {{providers}}
6
+
7
+ # Instructions: Write the next message for {{agentName}}.
8
+ "thought" should be a short description of what the agent is thinking about and planning.
9
+ "text" should be the next message for {{agentName}} which they will send to the conversation.
10
+
11
+ IMPORTANT CODE BLOCK FORMATTING RULES:
12
+ - If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with ``` fenced code blocks (specify the language if known, e.g., ```python).
13
+ - ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.
14
+ - If including inline code (short single words or function names), use single backticks (`) as appropriate.
15
+ - This ensures the user sees clearly formatted and copyable code when relevant.
16
+
17
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
18
+ Go directly to the XML response format without any preamble or explanation.
19
+
20
+ Respond using XML format like this:
21
+ <response>
22
+ <thought>Your thought here</thought>
23
+ <text>Your message here</text>
24
+ </response>
25
+
26
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>."""
27
+
28
+ CHOOSE_OPTION_TEMPLATE = """# Task: Choose an option from the available choices.
29
+
30
+ {{providers}}
31
+
32
+ # Available Options:
33
+ {{options}}
34
+
35
+ # Instructions:
36
+ Analyze the options and select the most appropriate one based on the current context.
37
+ Provide your reasoning and the selected option ID.
38
+
39
+ Respond using XML format like this:
40
+ <response>
41
+ <thought>Your reasoning for the selection</thought>
42
+ <selected_id>The ID of the selected option</selected_id>
43
+ </response>
44
+
45
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
46
+
47
+ IMAGE_GENERATION_TEMPLATE = """# Task: Generate an image prompt for {{agentName}}.
48
+
49
+ {{providers}}
50
+
51
+ # Instructions:
52
+ Based on the conversation, create a detailed prompt for image generation.
53
+ The prompt should be specific, descriptive, and suitable for AI image generation.
54
+
55
+ # Recent conversation:
56
+ {{recentMessages}}
57
+
58
+ Respond using XML format like this:
59
+ <response>
60
+ <thought>Your reasoning for the image prompt</thought>
61
+ <prompt>Detailed image generation prompt</prompt>
62
+ </response>
63
+
64
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
65
+
66
+ REFLECTION_TEMPLATE = """# Task: Reflect on recent agent behavior and interactions.
67
+
68
+ {{providers}}
69
+
70
+ # Recent Interactions:
71
+ {{recentInteractions}}
72
+
73
+ # Instructions:
74
+ Analyze the agent's recent behavior and interactions. Consider:
75
+ 1. Was the communication clear and helpful?
76
+ 2. Were responses appropriate for the context?
77
+ 3. Were any mistakes made?
78
+ 4. What could be improved?
79
+
80
+ Respond using XML format like this:
81
+ <response>
82
+ <thought>Your detailed analysis</thought>
83
+ <quality_score>Score 0-100 for overall quality</quality_score>
84
+ <strengths>What went well</strengths>
85
+ <improvements>What could be improved</improvements>
86
+ <learnings>Key takeaways for future interactions</learnings>
87
+ </response>
88
+
89
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
90
+
91
+ UPDATE_SETTINGS_TEMPLATE = """# Task: Update settings based on the request.
92
+
93
+ {{providers}}
94
+
95
+ # Current Settings:
96
+ {{settings}}
97
+
98
+ # Instructions:
99
+ Based on the request, determine which settings to update.
100
+ Only update settings that the user has explicitly requested.
101
+
102
+ Respond using XML format like this:
103
+ <response>
104
+ <thought>Your reasoning for the settings changes</thought>
105
+ <updates>
106
+ <update>
107
+ <key>setting_key</key>
108
+ <value>new_value</value>
109
+ </update>
110
+ </updates>
111
+ </response>
112
+
113
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
114
+
115
+ UPDATE_ENTITY_TEMPLATE = """# Task: Update entity information.
116
+
117
+ {{providers}}
118
+
119
+ # Current Entity Information:
120
+ {{entityInfo}}
121
+
122
+ # Instructions:
123
+ Based on the request, determine what information about the entity should be updated.
124
+ Only update fields that the user has explicitly requested to change.
125
+
126
+ Respond using XML format like this:
127
+ <response>
128
+ <thought>Your reasoning for the entity update</thought>
129
+ <entity_id>The entity ID to update</entity_id>
130
+ <updates>
131
+ <field>
132
+ <name>field_name</name>
133
+ <value>new_value</value>
134
+ </field>
135
+ </updates>
136
+ </response>
137
+
138
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
139
+
140
+ SHOULD_RESPOND_TEMPLATE = """<task>Decide on behalf of {{agentName}} whether they should respond to the message, ignore it or stop the conversation.</task>
141
+
142
+ <providers>
143
+ {{providers}}
144
+ </providers>
145
+
146
+ <instructions>Decide if {{agentName}} should respond to or interact with the conversation.
147
+
148
+ IMPORTANT RULES FOR RESPONDING:
149
+ - If YOUR name ({{agentName}}) is directly mentioned → RESPOND
150
+ - If someone uses a DIFFERENT name (not {{agentName}}) → IGNORE (they're talking to someone else)
151
+ - If you're actively participating in a conversation and the message continues that thread → RESPOND
152
+ - If someone tells you to stop or be quiet → STOP
153
+ - Otherwise → IGNORE
154
+
155
+ The key distinction is:
156
+ - "Talking TO {{agentName}}" (your name mentioned, replies to you, continuing your conversation) → RESPOND
157
+ - "Talking ABOUT {{agentName}}" or to someone else → IGNORE
158
+ </instructions>
159
+
160
+ <output>
161
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
162
+ Go directly to the XML response format without any preamble or explanation.
163
+
164
+ Respond using XML format like this:
165
+ <response>
166
+ <name>{{agentName}}</name>
167
+ <reasoning>Your reasoning here</reasoning>
168
+ <action>RESPOND | IGNORE | STOP</action>
169
+ </response>
170
+
171
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.
172
+ </output>"""
173
+
174
+ MESSAGE_HANDLER_TEMPLATE = """<task>Generate dialog and actions for the character {{agentName}}.</task>
175
+
176
+ <providers>
177
+ {{providers}}
178
+ </providers>
179
+
180
+ <instructions>
181
+ Write a thought and plan for {{agentName}} and decide what actions to take. Also include the providers that {{agentName}} will use to have the right context for responding and acting, if any.
182
+
183
+ IMPORTANT ACTION ORDERING RULES:
184
+ - Actions are executed in the ORDER you list them - the order MATTERS!
185
+ - REPLY should come FIRST to acknowledge the user's request before executing other actions
186
+ - Common patterns:
187
+ - For requests requiring tool use: REPLY,CALL_MCP_TOOL (acknowledge first, then gather info)
188
+ - For task execution: REPLY,SEND_MESSAGE or REPLY,EVM_SWAP_TOKENS (acknowledge first, then do the task)
189
+ - For multi-step operations: REPLY,ACTION1,ACTION2 (acknowledge first, then complete all steps)
190
+ - REPLY is used to acknowledge and inform the user about what you're going to do
191
+ - Follow-up actions execute the actual tasks after acknowledgment
192
+ - Use IGNORE only when you should not respond at all
193
+ - If you use IGNORE, do not include any other actions. IGNORE should be used alone when you should not respond or take any actions.
194
+
195
+ IMPORTANT ACTION PARAMETERS:
196
+ - Some actions accept input parameters that you should extract from the conversation
197
+ - When an action has parameters listed in its description, include a <params> block for that action
198
+ - Extract parameter values from the user's message and conversation context
199
+ - Required parameters MUST be provided; optional parameters can be omitted if not mentioned
200
+ - If you cannot determine a required parameter value, ask the user for clarification in your <text>
201
+
202
+ EXAMPLE (action parameters):
203
+ User message: "Send a message to @dev_guru on telegram saying Hello!"
204
+ Actions: REPLY,SEND_MESSAGE
205
+ Params:
206
+ <params>
207
+ <SEND_MESSAGE>
208
+ <targetType>user</targetType>
209
+ <source>telegram</source>
210
+ <target>dev_guru</target>
211
+ <text>Hello!</text>
212
+ </SEND_MESSAGE>
213
+ </params>
214
+
215
+ IMPORTANT PROVIDER SELECTION RULES:
216
+ - Only include providers if they are needed to respond accurately.
217
+ - If the message mentions images, photos, pictures, attachments, or visual content, OR if you see "(Attachments:" in the conversation, you MUST include "ATTACHMENTS" in your providers list
218
+ - If the message asks about or references specific people, include "ENTITIES" in your providers list
219
+ - If the message asks about relationships or connections between people, include "RELATIONSHIPS" in your providers list
220
+ - If the message asks about facts or specific information, include "FACTS" in your providers list
221
+ - If the message asks about the environment or world context, include "WORLD" in your providers list
222
+ - If no additional context is needed, you may leave the providers list empty.
223
+
224
+ IMPORTANT CODE BLOCK FORMATTING RULES:
225
+ - If {{agentName}} includes code examples, snippets, or multi-line code in the response, ALWAYS wrap the code with ``` fenced code blocks (specify the language if known, e.g., ```python).
226
+ - ONLY use fenced code blocks for actual code. Do NOT wrap non-code text, instructions, or single words in fenced code blocks.
227
+ - If including inline code (short single words or function names), use single backticks (`) as appropriate.
228
+ - This ensures the user sees clearly formatted and copyable code when relevant.
229
+
230
+ First, think about what you want to do next and plan your actions. Then, write the next message and include the actions you plan to take.
231
+ </instructions>
232
+
233
+ <keys>
234
+ "thought" should be a short description of what the agent is thinking about and planning.
235
+ "actions" should be a comma-separated list of the actions {{agentName}} plans to take based on the thought, IN THE ORDER THEY SHOULD BE EXECUTED (if none, use IGNORE, if simply responding with text, use REPLY)
236
+ "providers" should be a comma-separated list of the providers that {{agentName}} will use to have the right context for responding and acting (NEVER use "IGNORE" as a provider - use specific provider names like ATTACHMENTS, ENTITIES, FACTS, KNOWLEDGE, etc.)
237
+ "text" should be the text of the next message for {{agentName}} which they will send to the conversation.
238
+ "params" (optional) should contain action parameters when actions require input. Format as nested XML with action name as wrapper.
239
+ </keys>
240
+
241
+ <output>
242
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
243
+ Go directly to the XML response format without any preamble or explanation.
244
+
245
+ Respond using XML format like this:
246
+ <response>
247
+ <thought>Your thought here</thought>
248
+ <actions>ACTION1,ACTION2</actions>
249
+ <providers>PROVIDER1,PROVIDER2</providers>
250
+ <text>Your response text here</text>
251
+ <params>
252
+ <ACTION1>
253
+ <paramName1>value1</paramName1>
254
+ <paramName2>value2</paramName2>
255
+ </ACTION1>
256
+ <ACTION2>
257
+ <paramName1>value1</paramName1>
258
+ </ACTION2>
259
+ </params>
260
+ </response>
261
+
262
+ Note: The <params> block is optional and should only be included when actions require input parameters.
263
+ If an action has no parameters or you're only using REPLY/IGNORE, omit the <params> block entirely.
264
+
265
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above. Do not include any text, thinking, or reasoning before or after this XML block. Start your response immediately with <response> and end with </response>.
266
+ </output>"""
267
+
268
+ MULTI_STEP_DECISION_TEMPLATE = """<task>
269
+ Determine the next step the assistant should take in this conversation to help the user reach their goal.
270
+ </task>
271
+
272
+ {{recentMessages}}
273
+
274
+ # Multi-Step Workflow
275
+
276
+ In each step, decide:
277
+
278
+ 1. **Which providers (if any)** should be called to gather necessary data.
279
+ 2. **Which action (if any)** should be executed after providers return.
280
+ 3. Decide whether the task is complete. If so, set `isFinish: true`. Do not select the `REPLY` action; replies are handled separately after task completion.
281
+
282
+ You can select **multiple providers** and at most **one action** per step.
283
+
284
+ If the task is fully resolved and no further steps are needed, mark the step as `isFinish: true`.
285
+
286
+ ---
287
+
288
+ {{actionsWithDescriptions}}
289
+
290
+ {{providersWithDescriptions}}
291
+
292
+ These are the actions or data provider calls that have already been used in this run. Use this to avoid redundancy and guide your next move.
293
+
294
+ {{actionResults}}
295
+
296
+ <keys>
297
+ "thought" Clearly explain your reasoning for the selected providers and/or action, and how this step contributes to resolving the user's request.
298
+ "action" Name of the action to execute after providers return (can be empty if no action is needed).
299
+ "providers" List of provider names to call in this step (can be empty if none are needed).
300
+ "isFinish" Set to true only if the task is fully complete.
301
+ </keys>
302
+
303
+ ⚠️ IMPORTANT: Do **not** mark the task as `isFinish: true` immediately after calling an action. Wait for the action to complete before deciding the task is finished.
304
+
305
+ <output>
306
+ <response>
307
+ <thought>Your thought here</thought>
308
+ <action>ACTION</action>
309
+ <providers>PROVIDER1,PROVIDER2</providers>
310
+ <isFinish>true | false</isFinish>
311
+ </response>
312
+ </output>"""
313
+
314
+ MULTI_STEP_SUMMARY_TEMPLATE = """<task>
315
+ Summarize what the assistant has done so far and provide a final response to the user based on the completed steps.
316
+ </task>
317
+
318
+ # Context Information
319
+ {{bio}}
320
+
321
+ ---
322
+
323
+ {{system}}
324
+
325
+ ---
326
+
327
+ {{messageDirections}}
328
+
329
+ # Conversation Summary
330
+ Below is the user's original request and conversation so far:
331
+ {{recentMessages}}
332
+
333
+ # Execution Trace
334
+ Here are the actions taken by the assistant to fulfill the request:
335
+ {{actionResults}}
336
+
337
+ # Assistant's Last Reasoning Step
338
+ {{recentMessage}}
339
+
340
+ # Instructions
341
+
342
+ - Review the execution trace and last reasoning step carefully
343
+
344
+ - Your final output MUST be in this XML format:
345
+ <output>
346
+ <response>
347
+ <thought>Your thought here</thought>
348
+ <text>Your final message to the user</text>
349
+ </response>
350
+ </output>
351
+ """
352
+
353
+ AUTONOMY_CONTINUOUS_FIRST_TEMPLATE = """You are running in AUTONOMOUS CONTINUOUS MODE.
354
+
355
+ Your job: reflect on context, decide what you want to do next, and act if appropriate.
356
+ - Use available actions/tools when they can advance the goal.
357
+ - If you cannot act, state the missing info and the safest next step to obtain it.
358
+ - Keep the response concise, focused on the next action.
359
+
360
+ USER CONTEXT (most recent last):
361
+ {{targetRoomContext}}
362
+
363
+ Think briefly, then state what you want to do next and take action if needed.
364
+ """
365
+
366
+ AUTONOMY_CONTINUOUS_CONTINUE_TEMPLATE = """You are running in AUTONOMOUS CONTINUOUS MODE.
367
+
368
+ Your job: reflect on context, decide what you want to do next, and act if appropriate.
369
+ - Use available actions/tools when they can advance the goal.
370
+ - If you cannot act, state the missing info and the safest next step to obtain it.
371
+ - Keep the response concise, focused on the next action.
372
+
373
+ USER CONTEXT (most recent last):
374
+ {{targetRoomContext}}
375
+
376
+ Your last autonomous note: "{{lastThought}}"
377
+
378
+ Continue from that note. Decide the next step and act if needed.
379
+ """
380
+
381
+ AUTONOMY_TASK_FIRST_TEMPLATE = """You are running in AUTONOMOUS TASK MODE.
382
+
383
+ Your job: continue helping the user and make progress toward the task.
384
+ - Use available actions/tools to gather information or execute steps.
385
+ - If you need UI control, use ComputerUse actions.
386
+ - In MCP mode, selector-based actions require a process scope (pass process=... or prefix selector with "process:<name> >> ...").
387
+ - Prefer safe, incremental steps; if unsure, gather more UI context before acting.
388
+
389
+ USER CHAT CONTEXT (most recent last):
390
+ {{targetRoomContext}}
391
+
392
+ Decide what to do next. Think briefly, then take the most useful action.
393
+ """
394
+
395
+ AUTONOMY_TASK_CONTINUE_TEMPLATE = """You are running in AUTONOMOUS TASK MODE.
396
+
397
+ Your job: continue helping the user and make progress toward the task.
398
+ - Use available actions/tools to gather information or execute steps.
399
+ - If you need UI control, use ComputerUse actions.
400
+ - In MCP mode, selector-based actions require a process scope (pass process=... or prefix selector with "process:<name> >> ...").
401
+ - Prefer safe, incremental steps; if unsure, gather more UI context before acting.
402
+
403
+ USER CHAT CONTEXT (most recent last):
404
+ {{targetRoomContext}}
405
+
406
+ Your last autonomous note: "{{lastThought}}"
407
+
408
+ Continue the task. Decide the next step and take action now.
409
+ """
410
+
411
+ BOOLEAN_FOOTER = "Respond with only a YES or a NO."
412
+
413
+ UPDATE_ROLE_TEMPLATE = """# Task: Update entity role in the world.
414
+
415
+ {{providers}}
416
+
417
+ # Current Role Assignments:
418
+ {{roles}}
419
+
420
+ # Instructions:
421
+ Based on the request, determine the role assignment to make.
422
+ Valid roles are: OWNER, ADMIN, MEMBER, GUEST, NONE
423
+
424
+ Respond using XML format like this:
425
+ <response>
426
+ <thought>Your reasoning for the role change</thought>
427
+ <entity_id>The entity ID to update</entity_id>
428
+ <new_role>The new role to assign (OWNER, ADMIN, MEMBER, GUEST, or NONE)</new_role>
429
+ </response>
430
+
431
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
432
+
433
+ SCHEDULE_FOLLOW_UP_TEMPLATE = """# Task: Schedule a follow-up reminder.
434
+
435
+ {{providers}}
436
+
437
+ # Current Message Context:
438
+ {{message}}
439
+ Sender: {{senderName}} ({{senderId}})
440
+ Current Time: {{currentDateTime}}
441
+
442
+ # Instructions:
443
+ Extract follow-up details from the conversation. Determine:
444
+ 1. When the follow-up should occur
445
+ 2. The reason for following up
446
+ 3. An optional message to include
447
+
448
+ Respond using XML format like this:
449
+ <response>
450
+ <thought>Your reasoning for the follow-up</thought>
451
+ <entity_id>Entity ID to follow up with</entity_id>
452
+ <scheduled_for>ISO 8601 datetime for follow-up</scheduled_for>
453
+ <reason>Reason for follow-up</reason>
454
+ <message>Optional message to include</message>
455
+ </response>
456
+
457
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
458
+
459
+ ADD_CONTACT_TEMPLATE = """# Task: Add a contact to the rolodex.
460
+
461
+ {{providers}}
462
+
463
+ # Current Message Context:
464
+ {{message}}
465
+ Sender: {{senderName}} ({{senderId}})
466
+
467
+ # Instructions:
468
+ Extract contact information from the conversation. Look for:
469
+ 1. Name or identifier
470
+ 2. Category/relationship type
471
+ 3. Any notes or context
472
+
473
+ Respond using XML format like this:
474
+ <response>
475
+ <thought>Your reasoning for adding this contact</thought>
476
+ <name>Contact name</name>
477
+ <category>Contact category</category>
478
+ <notes>Additional notes</notes>
479
+ </response>
480
+
481
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
482
+
483
+ SEARCH_CONTACTS_TEMPLATE = """# Task: Search for contacts in the rolodex.
484
+
485
+ {{providers}}
486
+
487
+ # Current Message Context:
488
+ {{message}}
489
+ Sender: {{senderName}} ({{senderId}})
490
+
491
+ # Instructions:
492
+ Determine what the user is searching for in their contacts.
493
+ Extract search criteria from the conversation.
494
+
495
+ Respond using XML format like this:
496
+ <response>
497
+ <thought>Your understanding of the search request</thought>
498
+ <query>Search query or criteria</query>
499
+ <category>Optional category filter</category>
500
+ </response>
501
+
502
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
503
+
504
+ REMOVE_CONTACT_TEMPLATE = """# Task: Remove a contact from the rolodex.
505
+
506
+ {{providers}}
507
+
508
+ # Current Message Context:
509
+ {{message}}
510
+ Sender: {{senderName}} ({{senderId}})
511
+
512
+ # Instructions:
513
+ Determine which contact should be removed based on the conversation.
514
+
515
+ Respond using XML format like this:
516
+ <response>
517
+ <thought>Your reasoning for removing this contact</thought>
518
+ <entity_id>Entity ID to remove</entity_id>
519
+ </response>
520
+
521
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
522
+
523
+ UPDATE_CONTACT_TEMPLATE = """# Task: Update contact information.
524
+
525
+ {{providers}}
526
+
527
+ # Current Message Context:
528
+ {{message}}
529
+ Sender: {{senderName}} ({{senderId}})
530
+
531
+ # Instructions:
532
+ Determine what contact information should be updated based on the conversation.
533
+
534
+ Respond using XML format like this:
535
+ <response>
536
+ <thought>Your reasoning for the update</thought>
537
+ <entity_id>Entity ID to update</entity_id>
538
+ <updates>
539
+ <field>
540
+ <name>field_name</name>
541
+ <value>new_value</value>
542
+ </field>
543
+ </updates>
544
+ </response>
545
+
546
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
547
+
548
+ MESSAGE_CLASSIFIER_TEMPLATE = """Analyze this user request and classify it for planning purposes:
549
+
550
+ "{text}"
551
+
552
+ Classify the request across these dimensions:
553
+
554
+ 1. COMPLEXITY LEVEL:
555
+ - simple: Direct actions that don't require planning
556
+ - medium: Multi-step tasks requiring coordination
557
+ - complex: Strategic initiatives with multiple stakeholders
558
+ - enterprise: Large-scale transformations with full complexity
559
+
560
+ 2. PLANNING TYPE:
561
+ - direct_action: Single action, no planning needed
562
+ - sequential_planning: Multiple steps in sequence
563
+ - strategic_planning: Complex coordination with stakeholders
564
+
565
+ 3. REQUIRED CAPABILITIES:
566
+ - List specific capabilities needed (analysis, communication, project_management, etc.)
567
+
568
+ 4. STAKEHOLDERS:
569
+ - List types of people/groups involved
570
+
571
+ 5. CONSTRAINTS:
572
+ - List limitations or requirements mentioned
573
+
574
+ 6. DEPENDENCIES:
575
+ - List dependencies between tasks or external factors
576
+
577
+ Respond in this exact format:
578
+ COMPLEXITY: [simple|medium|complex|enterprise]
579
+ PLANNING: [direct_action|sequential_planning|strategic_planning]
580
+ CAPABILITIES: [comma-separated list]
581
+ STAKEHOLDERS: [comma-separated list]
582
+ CONSTRAINTS: [comma-separated list]
583
+ DEPENDENCIES: [comma-separated list]
584
+ CONFIDENCE: [0.0-1.0]
585
+ """
586
+
587
+ INITIAL_SUMMARIZATION_TEMPLATE = """# Task: Summarize Conversation
588
+
589
+ You are analyzing a conversation to create a concise summary that captures the key points, topics, and important details.
590
+
591
+ # Recent Messages
592
+ {recent_messages}
593
+
594
+ # Instructions
595
+ Generate a summary that:
596
+ 1. Captures the main topics discussed
597
+ 2. Highlights key information shared
598
+ 3. Notes any decisions made or questions asked
599
+ 4. Maintains context for future reference
600
+ 5. Is concise but comprehensive
601
+
602
+ **IMPORTANT**: Keep the summary under 2500 tokens. Be comprehensive but concise.
603
+
604
+ Also extract:
605
+ - **Topics**: List of main topics discussed (comma-separated)
606
+ - **Key Points**: Important facts or decisions (bullet points)
607
+
608
+ Respond in this XML format:
609
+ <summary>
610
+ <text>Your comprehensive summary here</text>
611
+ <topics>topic1, topic2, topic3</topics>
612
+ <keyPoints>
613
+ <point>First key point</point>
614
+ <point>Second key point</point>
615
+ </keyPoints>
616
+ </summary>"""
617
+
618
+ UPDATE_SUMMARIZATION_TEMPLATE = """# Task: Update and Condense Conversation Summary
619
+
620
+ You are updating an existing conversation summary with new messages, while keeping the total summary concise.
621
+
622
+ # Existing Summary
623
+ {existing_summary}
624
+
625
+ # Existing Topics
626
+ {existing_topics}
627
+
628
+ # New Messages Since Last Summary
629
+ {new_messages}
630
+
631
+ # Instructions
632
+ Update the summary by:
633
+ 1. Merging the existing summary with insights from the new messages
634
+ 2. Removing redundant or less important details to stay under the token limit
635
+ 3. Keeping the most important context and decisions
636
+ 4. Adding new topics if they emerge
637
+ 5. **CRITICAL**: Keep the ENTIRE updated summary under 2500 tokens
638
+
639
+ The goal is a rolling summary that captures the essence of the conversation without growing indefinitely.
640
+
641
+ Respond in this XML format:
642
+ <summary>
643
+ <text>Your updated and condensed summary here</text>
644
+ <topics>topic1, topic2, topic3</topics>
645
+ <keyPoints>
646
+ <point>First key point</point>
647
+ <point>Second key point</point>
648
+ </keyPoints>
649
+ </summary>"""
650
+
651
+ LONG_TERM_EXTRACTION_TEMPLATE = """# Task: Extract Long-Term Memory (Strict Criteria)
652
+
653
+ You are analyzing a conversation to extract ONLY the most critical, persistent information about the user using cognitive science memory categories.
654
+
655
+ # Recent Messages
656
+ {recent_messages}
657
+
658
+ # Current Long-Term Memories
659
+ {existing_memories}
660
+
661
+ # ULTRA-STRICT EXTRACTION CRITERIA
662
+
663
+ Default to NOT extracting. Confidence must be >= 0.85.
664
+ If there are no qualifying facts, respond with <memories></memories>
665
+
666
+ # Response Format
667
+
668
+ <memories>
669
+ <memory>
670
+ <category>semantic</category>
671
+ <content>User is a senior TypeScript developer with 8 years of backend experience</content>
672
+ <confidence>0.95</confidence>
673
+ </memory>
674
+ </memories>"""
675
+
676
+ # Room action templates
677
+ SHOULD_FOLLOW_ROOM_TEMPLATE = """# Task: Decide if {{agentName}} should start following this room, i.e. eagerly participating without explicit mentions.
678
+
679
+ {{recentMessages}}
680
+
681
+ Should {{agentName}} start following this room, eagerly participating without explicit mentions?
682
+ Respond with YES if:
683
+ - The user has directly asked {{agentName}} to follow the conversation or participate more actively
684
+ - The conversation topic is highly engaging and {{agentName}}'s input would add significant value
685
+ - {{agentName}} has unique insights to contribute and the users seem receptive
686
+
687
+ Otherwise, respond with NO.
688
+ Respond with only a YES or a NO."""
689
+
690
+ SHOULD_UNFOLLOW_ROOM_TEMPLATE = """# Task: Decide if {{agentName}} should stop closely following this previously followed room and only respond when mentioned.
691
+
692
+ {{recentMessages}}
693
+
694
+ Should {{agentName}} stop closely following this previously followed room and only respond when mentioned?
695
+ Respond with YES if:
696
+ - The user has suggested that {{agentName}} is over-participating or being disruptive
697
+ - {{agentName}}'s eagerness to contribute is not well-received by the users
698
+ - The conversation has shifted to a topic where {{agentName}} has less to add
699
+
700
+ Otherwise, respond with NO.
701
+ Respond with only a YES or a NO."""
702
+
703
+ SHOULD_MUTE_ROOM_TEMPLATE = """# Task: Decide if {{agentName}} should mute this room and stop responding unless explicitly mentioned.
704
+
705
+ {{recentMessages}}
706
+
707
+ Should {{agentName}} mute this room and stop responding unless explicitly mentioned?
708
+
709
+ Respond with YES if:
710
+ - The user is being aggressive, rude, or inappropriate
711
+ - The user has directly asked {{agentName}} to stop responding or be quiet
712
+ - {{agentName}}'s responses are not well-received or are annoying the user(s)
713
+
714
+ Otherwise, respond with NO.
715
+ Respond with only a YES or a NO."""
716
+
717
+ SHOULD_UNMUTE_ROOM_TEMPLATE = """# Task: Decide if {{agentName}} should unmute this previously muted room and start considering it for responses again.
718
+
719
+ {{recentMessages}}
720
+
721
+ Should {{agentName}} unmute this previously muted room and start considering it for responses again?
722
+ Respond with YES if:
723
+ - The user has explicitly asked {{agentName}} to start responding again
724
+ - The user seems to want to re-engage with {{agentName}} in a respectful manner
725
+ - The tone of the conversation has improved and {{agentName}}'s input would be welcome
726
+
727
+ Otherwise, respond with NO.
728
+ Respond with only a YES or a NO."""
729
+
730
+ TARGET_EXTRACTION_TEMPLATE = """# Task: Extract Target and Source Information
731
+
732
+ # Recent Messages:
733
+ {{recentMessages}}
734
+
735
+ # Instructions:
736
+ Analyze the conversation to identify:
737
+ 1. The target type (user or room)
738
+ 2. The target platform/source (e.g. telegram, discord, etc)
739
+ 3. Any identifying information about the target
740
+ 4. The message text to send
741
+
742
+ Return an XML response with:
743
+ <response>
744
+ <targetType>user|room</targetType>
745
+ <source>platform-name</source>
746
+ <messageText>text_to_send</messageText>
747
+ <identifiers>
748
+ <username>username_if_applicable</username>
749
+ <roomName>room_name_if_applicable</roomName>
750
+ </identifiers>
751
+ </response>"""
752
+
753
+ ENTITY_RESOLUTION_TEMPLATE = """# Task: Resolve Entity Name
754
+ Message Sender: {{senderName}} (ID: {{senderId}})
755
+ Agent: {{agentName}} (ID: {{agentId}})
756
+
757
+ # Entities in Room:
758
+ {{#if entitiesInRoom}}
759
+ {{entitiesInRoom}}
760
+ {{/if}}
761
+
762
+ {{recentMessages}}
763
+
764
+ # Instructions:
765
+ 1. Analyze the context to identify which entity is being referenced
766
+ 2. Consider special references like "me" (the message sender) or "you" (agent the message is directed to)
767
+ 3. Look for usernames/handles in standard formats (e.g. @username, user#1234)
768
+ 4. Consider context from recent messages for pronouns and references
769
+ 5. If multiple matches exist, use context to disambiguate
770
+ 6. Consider recent interactions and relationship strength when resolving ambiguity
771
+
772
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
773
+ Go directly to the XML response format without any preamble or explanation.
774
+
775
+ Return an XML response with:
776
+ <response>
777
+ <entityId>exact-id-if-known-otherwise-null</entityId>
778
+ <type>EXACT_MATCH | USERNAME_MATCH | NAME_MATCH | RELATIONSHIP_MATCH | AMBIGUOUS | UNKNOWN</type>
779
+ <matches>
780
+ <match>
781
+ <name>matched-name</name>
782
+ <reason>why this entity matches</reason>
783
+ </match>
784
+ </matches>
785
+ </response>
786
+
787
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
788
+
789
+ COMPONENT_TEMPLATE = """# Task: Extract Source and Update Component Data
790
+
791
+ {{recentMessages}}
792
+
793
+ {{#if existingData}}
794
+ # Existing Component Data:
795
+ {{existingData}}
796
+ {{/if}}
797
+
798
+ # Instructions:
799
+ 1. Analyze the conversation to identify:
800
+ - The source/platform being referenced (e.g. telegram, x, discord)
801
+ - Any specific component data being shared
802
+
803
+ 2. Generate updated component data that:
804
+ - Is specific to the identified platform/source
805
+ - Preserves existing data when appropriate
806
+ - Includes the new information from the conversation
807
+ - Contains only valid data for this component type
808
+
809
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
810
+ Go directly to the XML response format without any preamble or explanation.
811
+
812
+ Return an XML response with the following structure:
813
+ <response>
814
+ <source>platform-name</source>
815
+ <data>
816
+ <username>username_value</username>
817
+ <displayName>display_name_value</displayName>
818
+ </data>
819
+ </response>
820
+
821
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
822
+
823
+ SETTINGS_SUCCESS_TEMPLATE = """# Task: Generate a response for successful setting updates
824
+ {{providers}}
825
+
826
+ # Update Information:
827
+ - Updated Settings: {{updateMessages}}
828
+ - Next Required Setting: {{nextSetting.name}}
829
+ - Remaining Required Settings: {{remainingRequired}}
830
+
831
+ # Instructions:
832
+ 1. Acknowledge the successful update of settings
833
+ 2. Maintain {{agentName}}'s personality and tone
834
+ 3. Provide clear guidance on the next setting that needs to be configured
835
+ 4. Explain what the next setting is for and how to set it
836
+ 5. If appropriate, mention how many required settings remain
837
+
838
+ Write a natural, conversational response that {{agentName}} would send about the successful update and next steps.
839
+ Include the actions array ["SETTING_UPDATED"] in your response."""
840
+
841
+ SETTINGS_FAILURE_TEMPLATE = """# Task: Generate a response for failed setting updates
842
+
843
+ # About {{agentName}}:
844
+ {{bio}}
845
+
846
+ # Current Settings Status:
847
+ {{settingsStatus}}
848
+
849
+ # Next Required Setting:
850
+ - Name: {{nextSetting.name}}
851
+ - Description: {{nextSetting.description}}
852
+ - Required: Yes
853
+ - Remaining Required Settings: {{remainingRequired}}
854
+
855
+ # Recent Conversation:
856
+ {{recentMessages}}
857
+
858
+ # Instructions:
859
+ 1. Express that you couldn't understand or process the setting update
860
+ 2. Maintain {{agentName}}'s personality and tone
861
+ 3. Provide clear guidance on what setting needs to be configured next
862
+ 4. Explain what the setting is for and how to set it properly
863
+ 5. Use a helpful, patient tone
864
+
865
+ Write a natural, conversational response that {{agentName}} would send about the failed update and how to proceed.
866
+ Include the actions array ["SETTING_UPDATE_FAILED"] in your response."""
867
+
868
+ SETTINGS_ERROR_TEMPLATE = """# Task: Generate a response for an error during setting updates
869
+
870
+ # About {{agentName}}:
871
+ {{bio}}
872
+
873
+ # Recent Conversation:
874
+ {{recentMessages}}
875
+
876
+ # Instructions:
877
+ 1. Apologize for the technical difficulty
878
+ 2. Maintain {{agentName}}'s personality and tone
879
+ 3. Suggest trying again or contacting support if the issue persists
880
+ 4. Keep the message concise and helpful
881
+
882
+ Write a natural, conversational response that {{agentName}} would send about the error.
883
+ Include the actions array ["SETTING_UPDATE_ERROR"] in your response."""
884
+
885
+ SETTINGS_COMPLETION_TEMPLATE = """# Task: Generate a response for settings completion
886
+
887
+ # About {{agentName}}:
888
+ {{bio}}
889
+
890
+ # Settings Status:
891
+ {{settingsStatus}}
892
+
893
+ # Recent Conversation:
894
+ {{recentMessages}}
895
+
896
+ # Instructions:
897
+ 1. Congratulate the user on completing the settings process
898
+ 2. Maintain {{agentName}}'s personality and tone
899
+ 3. Summarize the key settings that have been configured
900
+ 4. Explain what functionality is now available
901
+ 5. Provide guidance on what the user can do next
902
+ 6. Express enthusiasm about working together
903
+
904
+ Write a natural, conversational response that {{agentName}} would send about the successful completion of settings.
905
+ Include the actions array ["ONBOARDING_COMPLETE"] in your response."""
906
+
907
+ POST_CREATION_TEMPLATE = """# Task: Create a post in the voice and style and perspective of {{agentName}} @{{xUserName}}.
908
+
909
+ {{providers}}
910
+
911
+ Write a post that is {{adjective}} about {{topic}} (without mentioning {{topic}} directly), from the perspective of {{agentName}}. Do not add commentary or acknowledge this request, just write the post.
912
+ Your response should be 1, 2, or 3 sentences (choose the length at random).
913
+ Your response should not contain any questions. Brief, concise statements only. The total character count MUST be less than 280. No emojis. Use \\n\\n (double spaces) between statements if there are multiple statements in your response.
914
+
915
+ Your output should be formatted in XML like this:
916
+ <response>
917
+ <thought>Your thought here</thought>
918
+ <post>Your post text here</post>
919
+ <imagePrompt>Optional image prompt here</imagePrompt>
920
+ </response>
921
+
922
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
923
+
924
+ IMAGE_DESCRIPTION_TEMPLATE = """<task>Analyze the provided image and generate a comprehensive description with multiple levels of detail.</task>
925
+
926
+ <instructions>
927
+ Carefully examine the image and provide:
928
+ 1. A concise, descriptive title that captures the main subject or scene
929
+ 2. A brief summary description (1-2 sentences) highlighting the key elements
930
+ 3. An extensive, detailed description that covers all visible elements, composition, lighting, colors, mood, and any other relevant details
931
+
932
+ Be objective and descriptive. Focus on what you can actually see in the image rather than making assumptions about context or meaning.
933
+ </instructions>
934
+
935
+ <output>
936
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
937
+ Go directly to the XML response format without any preamble or explanation.
938
+
939
+ Respond using XML format like this:
940
+ <response>
941
+ <title>A concise, descriptive title for the image</title>
942
+ <description>A brief 1-2 sentence summary of the key elements in the image</description>
943
+ <text>An extensive, detailed description covering all visible elements, composition, lighting, colors, mood, setting, objects, people, activities, and any other relevant details you can observe in the image</text>
944
+ </response>
945
+
946
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above.
947
+ </output>"""
948
+
949
+ OPTION_EXTRACTION_TEMPLATE = """# Task: Extract selected task and option from user message
950
+
951
+ # Available Tasks:
952
+ {{tasks}}
953
+
954
+ # Recent Messages:
955
+ {{recentMessages}}
956
+
957
+ # Instructions:
958
+ 1. Review the user's message and identify which task and option they are selecting
959
+ 2. Match against the available tasks and their options, including ABORT
960
+ 3. Return the task ID (shortened UUID) and selected option name exactly as listed above
961
+ 4. If no clear selection is made, return null for both fields
962
+
963
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
964
+ Go directly to the XML response format without any preamble or explanation.
965
+
966
+ Return in XML format:
967
+ <response>
968
+ <taskId>string_or_null</taskId>
969
+ <selectedOption>OPTION_NAME_or_null</selectedOption>
970
+ </response>
971
+
972
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
973
+
974
+ REFLECTION_EVALUATOR_TEMPLATE = """# Task: Generate Agent Reflection, Extract Facts and Relationships
975
+
976
+ {{providers}}
977
+
978
+ # Examples:
979
+ {{evaluationExamples}}
980
+
981
+ # Entities in Room
982
+ {{entitiesInRoom}}
983
+
984
+ # Existing Relationships
985
+ {{existingRelationships}}
986
+
987
+ # Current Context:
988
+ Agent Name: {{agentName}}
989
+ Room Type: {{roomType}}
990
+ Message Sender: {{senderName}} (ID: {{senderId}})
991
+
992
+ {{recentMessages}}
993
+
994
+ # Known Facts:
995
+ {{knownFacts}}
996
+
997
+ # Instructions:
998
+ 1. Generate a self-reflective thought on the conversation about your performance and interaction quality.
999
+ 2. Extract new facts from the conversation.
1000
+ 3. Identify and describe relationships between entities.
1001
+ - The sourceEntityId is the UUID of the entity initiating the interaction.
1002
+ - The targetEntityId is the UUID of the entity being interacted with.
1003
+ - Relationships are one-direction, so a friendship would be two entity relationships where each entity is both the source and the target of the other.
1004
+
1005
+ Do NOT include any thinking, reasoning, or <think> sections in your response.
1006
+ Go directly to the XML response format without any preamble or explanation.
1007
+
1008
+ Generate a response in the following format:
1009
+ <response>
1010
+ <thought>a self-reflective thought on the conversation</thought>
1011
+ <facts>
1012
+ <fact>
1013
+ <claim>factual statement</claim>
1014
+ <type>fact|opinion|status</type>
1015
+ <in_bio>false</in_bio>
1016
+ <already_known>false</already_known>
1017
+ </fact>
1018
+ </facts>
1019
+ <relationships>
1020
+ <relationship>
1021
+ <sourceEntityId>entity_initiating_interaction</sourceEntityId>
1022
+ <targetEntityId>entity_being_interacted_with</targetEntityId>
1023
+ <tags>group_interaction,voice_interaction,dm_interaction,additional_tag1,additional_tag2</tags>
1024
+ </relationship>
1025
+ </relationships>
1026
+ </response>
1027
+
1028
+ IMPORTANT: Your response must ONLY contain the <response></response> XML block above."""
1029
+
1030
+ __all__ = [
1031
+ "REPLY_TEMPLATE",
1032
+ "CHOOSE_OPTION_TEMPLATE",
1033
+ "IMAGE_GENERATION_TEMPLATE",
1034
+ "REFLECTION_TEMPLATE",
1035
+ "UPDATE_SETTINGS_TEMPLATE",
1036
+ "UPDATE_ENTITY_TEMPLATE",
1037
+ "SHOULD_RESPOND_TEMPLATE",
1038
+ "MESSAGE_HANDLER_TEMPLATE",
1039
+ "MULTI_STEP_DECISION_TEMPLATE",
1040
+ "MULTI_STEP_SUMMARY_TEMPLATE",
1041
+ "AUTONOMY_CONTINUOUS_FIRST_TEMPLATE",
1042
+ "AUTONOMY_CONTINUOUS_CONTINUE_TEMPLATE",
1043
+ "AUTONOMY_TASK_FIRST_TEMPLATE",
1044
+ "AUTONOMY_TASK_CONTINUE_TEMPLATE",
1045
+ "BOOLEAN_FOOTER",
1046
+ "UPDATE_ROLE_TEMPLATE",
1047
+ "SCHEDULE_FOLLOW_UP_TEMPLATE",
1048
+ "ADD_CONTACT_TEMPLATE",
1049
+ "SEARCH_CONTACTS_TEMPLATE",
1050
+ "REMOVE_CONTACT_TEMPLATE",
1051
+ "UPDATE_CONTACT_TEMPLATE",
1052
+ "MESSAGE_CLASSIFIER_TEMPLATE",
1053
+ "INITIAL_SUMMARIZATION_TEMPLATE",
1054
+ "UPDATE_SUMMARIZATION_TEMPLATE",
1055
+ "LONG_TERM_EXTRACTION_TEMPLATE",
1056
+ "SHOULD_FOLLOW_ROOM_TEMPLATE",
1057
+ "SHOULD_UNFOLLOW_ROOM_TEMPLATE",
1058
+ "SHOULD_MUTE_ROOM_TEMPLATE",
1059
+ "SHOULD_UNMUTE_ROOM_TEMPLATE",
1060
+ "TARGET_EXTRACTION_TEMPLATE",
1061
+ "ENTITY_RESOLUTION_TEMPLATE",
1062
+ "COMPONENT_TEMPLATE",
1063
+ "SETTINGS_SUCCESS_TEMPLATE",
1064
+ "SETTINGS_FAILURE_TEMPLATE",
1065
+ "SETTINGS_ERROR_TEMPLATE",
1066
+ "SETTINGS_COMPLETION_TEMPLATE",
1067
+ "POST_CREATION_TEMPLATE",
1068
+ "IMAGE_DESCRIPTION_TEMPLATE",
1069
+ "OPTION_EXTRACTION_TEMPLATE",
1070
+ "REFLECTION_EVALUATOR_TEMPLATE",
1071
+ ]