Skip to content

Commit 3056fdd

Browse files
committed
fine-tune transfer and adaptive prompt
1 parent 8ca8ac8 commit 3056fdd

File tree

6 files changed

+45
-32
lines changed

6 files changed

+45
-32
lines changed

AgentCrew/modules/agents/local_agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,7 @@ async def process_messages(self, messages: Optional[List[Dict[str, Any]]] = None
422422
"content": [
423423
{
424424
"type": "text",
425-
"text": f"“Always check for and faithfully follow user-provided adaptive behaviors (in ‘when...do...’ format), overriding your default response logic whenever conditions are met. Ask if unsure whether any apply.: \n{adaptive_text}",
425+
"text": f'MANDATORY: Check stored adaptive behaviors before responding. When "when...do..." conditions match, execute those behaviors immediately—they override default logic. Ask for clarification if uncertain which behaviors apply. List of adaptive behaviors: \n{adaptive_text}',
426426
}
427427
],
428428
}

AgentCrew/modules/agents/manager.py

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -328,16 +328,19 @@ def get_transfer_system_prompt(self):
328328
agent_desc = f" <agent>\n <name>{name}</name>\n <description>{agent.description}</description>"
329329
else:
330330
agent_desc = f" <agent>\n <name>{name}</name>"
331-
if isinstance(agent, LocalAgent) and agent.tools and len(agent.tools) > 0:
332-
agent_desc += f"\n <tools>\n <tool>{'</tool>\n <tool>'.join(agent.tools)}</tool>\n </tools>\n </agent>"
333-
else:
334-
agent_desc += "\n </agent>"
331+
# if isinstance(agent, LocalAgent) and agent.tools and len(agent.tools) > 0:
332+
# agent_desc += f"\n <tools>\n <tool>{'</tool>\n <tool>'.join(agent.tools)}</tool>\n </tools>\n </agent>"
333+
# else:
334+
agent_desc += "\n </agent>"
335335
agent_descriptions.append(agent_desc)
336336

337-
transfer_prompt = f"""<Agents>
338-
<Instruction_Overview>
339-
When a task requires specialized expertise beyond your capabilities, immediately transfer it to the appropriate agent using the `transfer` tool. Your success depends on crafting a precise, actionable task description that enables the target agent to execute effectively without additional clarification.
340-
</Instruction_Overview>
337+
transfer_prompt = f"""<Transfering_Agents>
338+
<Instruction>
339+
- You are a specialized agent operating within a multi-agent system
340+
- Before executing any task, evaluate whether another specialist agent would be better suited based on their specific expertise and capabilities.
341+
- When a more appropriate specialist exists, immediately transfer the task using the `transfer` tool.
342+
- Craft precise, actionable task descriptions that enable the target agent to execute effectively without requiring additional clarification
343+
</Instruction>
341344
342345
<Transfer_Protocol>
343346
<Core_Transfer_Principle>
@@ -373,9 +376,9 @@ def get_transfer_system_prompt(self):
373376
</Tool_Usage>
374377
</Transfer_Protocol>
375378
376-
<Available_Agents_List id="Agents">
379+
<Available_Agents>
377380
{"\n".join(agent_descriptions)}
378-
</Available_Agents_List>
379-
</Agents>"""
381+
</Available_Agents>
382+
</Transfering_Agents>"""
380383

381384
return transfer_prompt

AgentCrew/modules/gui/qt_ui.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ def handle_response(self, response, input_tokens, output_tokens):
296296
# self.expecting_response = False
297297
#
298298
# # Re-enable input controls
299-
# self.ui_state_manager.set_input_controls_enabled(True)
299+
self.ui_state_manager.set_input_controls_enabled(True)
300300
QApplication.processEvents() # Ensure UI updates immediately
301301

302302
@Slot(str)

AgentCrew/modules/gui/widgets/message_bubble.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def add_streaming_chunk(self, chunk_queue: list):
314314

315315
# Start the streaming timer if not active
316316
if not self.streaming_timer.isActive():
317-
self.streaming_timer.start(40)
317+
self.streaming_timer.start(60)
318318

319319
# Add characters to queue for smooth rendering
320320
self.character_queue = chunk_queue

AgentCrew/modules/memory/tool.py

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -244,23 +244,33 @@ def handle_adapt(**params) -> str:
244244

245245

246246
def adaptive_instruction_prompt():
247-
return """Use the 'adapt' tool to store behavioral patterns that improve user experience. Call it when you notice:
248-
249-
1. **User Preferences**: Recurring requests or communication styles
250-
2. **Task Patterns**: Specific ways users like information presented
251-
3. **Context Triggers**: Situations requiring special handling
252-
253-
**Format**: Always use "when...do..." structure
254-
**Examples**:
255-
- "when user asks about code, provide complete examples with explanations"
256-
- "when user mentions deadlines, prioritize speed over detailed explanations"
257-
- "when user shares personal info, acknowledge and reference it in future interactions"
258-
259-
**Best Practices**:
260-
- Use descriptive IDs (e.g., "code_explanation_style", "deadline_response")
261-
- Be specific about triggers and actions
262-
- Update existing behaviors rather when behaviors change
263-
- Focus on actionable, consistent improvements"""
247+
return """<Adapting_Behaviors>
248+
<Purpose>
249+
Store behavioral patterns that improve user experience using the 'adapt' tool.
250+
</Purpose>
251+
252+
<Trigger_Conditions>
253+
<User_Preferences>Recurring requests or communication styles</User_Preferences>
254+
<Task_Patterns>Specific ways users like information presented</Task_Patterns>
255+
<Context_Triggers>Situations requiring special handling</Context_Triggers>
256+
</Trigger_Conditions>
257+
258+
<Behavior_Format>
259+
<Structure>Always use "when...do..." format</Structure>
260+
<Examples>
261+
• "when user asks about code, provide complete examples with explanations"
262+
• "when user mentions deadlines, prioritize speed over detailed explanations"
263+
• "when user shares personal info, acknowledge and reference it in future interactions"
264+
</Examples>
265+
</Behavior_Format>
266+
267+
<Implementation_Guidelines>
268+
• Use descriptive IDs (e.g., "code_explanation_style", "deadline_response")
269+
• Be specific about triggers and actions
270+
• Update existing behaviors when behaviors change
271+
• Focus on actionable, consistent improvements
272+
</Implementation_Guidelines>
273+
</Adapting_Behaviors>"""
264274

265275

266276
def register(

AgentCrew/modules/memory/voyageai_ef.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ def __init__(
4040

4141
self.model_name = model_name
4242

43-
self._provider_client = Client(api_key=self.api_key)
43+
self._provider_client = Client(api_key=self.api_key, timeout=60)
4444

4545
def __call__(self, input: Documents) -> Embeddings:
4646
"""

0 commit comments

Comments
 (0)