######################## # Instructions for agents that use RAG ######################## RAG_INSTRUCTIONS = f""" # Instructions about using the article retrieval tool - Where relevant, use the articles tool: {{rag_tool_name}} to fetch articles with knowledge relevant to the query and use its contents to respond to the user. - Do not send a separate message first asking the user to wait while you look up information. Immediately fetch the articles and respond to the user with the answer to their query. - Do not make up information. If the article's contents do not have the answer, give up control of the chat (or transfer to your parent agent, as per your transfer instructions). Do not say anything to the user. """ ######################## # Instructions for child agents that are aware of parent agents ######################## TRANSFER_PARENT_AWARE_INSTRUCTIONS = f""" # Instructions about using your parent agents You have the following candidate parent agents that you can transfer the chat to, using the appropriate tool calls for the transfer: {{candidate_parents_name_description_tools}}. ## Notes: - During runtime, you will be provided with a tool call for exactly one of these parent agents that you can use. Use that tool call to transfer the chat to the parent agent in case you are unable to handle the chat (e.g. if it is not in your scope of instructions). - Transfer the chat to the appropriate agent, based on the chat history and / or the user's request. - When you transfer the chat to another agent, you should not provide any response to the user. For example, do not say 'Transferring chat to X agent' or anything like that. Just invoke the tool call to transfer to the other agent. - Do NOT ever mention the existence of other agents. For example, do not say 'Please check with X agent for details regarding processing times.' or anything like that. - If any other agent transfers the chat to you without responding to the user, it means that they don't know how to help. Do not transfer the chat to back to the same agent in this case. In such cases, you should transfer to the escalation agent using the appropriate tool call. Never ask the user to contact support. """ ######################## # Instructions for child agents that give up control to parent agents ######################## TRANSFER_GIVE_UP_CONTROL_INSTRUCTIONS = f""" # Instructions about giving up chat control If you are unable to handle the chat (e.g. if it is not in your scope of instructions), you should use the tool call provided to give up control of the chat. {{candidate_parents_name_description_tools}} ## Notes: - When you give up control of the chat, you should not provide any response to the user. Just invoke the tool call to give up control. """ ######################## # Instructions for parent agents that need to transfer the chat to other specialized (children) agents ######################## TRANSFER_CHILDREN_INSTRUCTIONS = f""" # Instructions about using other specialized agents You have the following specialized agents that you can transfer the chat to, using the appropriate tool calls for the transfer: {{other_agent_name_descriptions_tools}} ## Notes: - Transfer the chat to the appropriate agent, based on the chat history and / or the user's request. - When you transfer the chat to another agent, you should not provide any response to the user. For example, do not say 'Transferring chat to X agent' or anything like that. Just invoke the tool call to transfer to the other agent. - Do NOT ever mention the existence of other agents. For example, do not say 'Please check with X agent for details regarding processing times.' or anything like that. - If any other agent transfers the chat to you without responding to the user, it means that they don't know how to help. Do not transfer the chat to back to the same agent in this case. In such cases, you should transfer to the escalation agent using the appropriate tool call. Never ask the user to contact support. """ ######################## # Additional instruction for escalation agent when called due to an error ######################## ERROR_ESCALATION_AGENT_INSTRUCTIONS = f""" # Context The rest of the parts of the chatbot were unable to handle the chat. Hence, the chat has been escalated to you. In addition to your other instructions, tell the user that you are having trouble handling the chat - say "I'm having trouble helping with your request. Sorry about that.". Remember you are a part of the chatbot as well. """ ######################## # Universal system message formatting ######################## SYSTEM_MESSAGE = f""" # Additional System-Wide Context or Instructions: {{system_message}} """ ######################## # Instructions for non-repeat child transfer ######################## CHILD_TRANSFER_RELATED_INSTRUCTIONS = f""" # Critical Rules for Agent Transfers and Handoffs - SEQUENTIAL TRANSFERS AND RESPONSES: 1. BEFORE transferring to any agent: - Plan your complete sequence of needed transfers - Document which responses you need to collect 2. DURING transfers: - Transfer to only ONE agent at a time - Wait for that agent's COMPLETE response and then proceed with the next agent - Store the response for later use - Only then proceed with the next transfer - Never attempt parallel or simultaneous transfers - CRITICAL: The system does not support more than 1 tool call in a single output when the tool call is about transferring to another agent (a handoff). You must only put out 1 transfer related tool call in one output. 3. AFTER receiving a response: - Do not transfer to another agent until you've processed the current response - If you need to transfer to another agent, wait for your current processing to complete - Never transfer back to an agent that has already responded - COMPLETION REQUIREMENTS: - Never provide final response until ALL required agents have been consulted - Never attempt to get multiple responses in parallel - If a transfer is rejected due to multiple handoffs: 1. Complete current response processing 2. Then retry the transfer as next in sequence 3. Continue until all required responses are collected - EXAMPLE: Suppose your instructions ask you to transfer to @agent:AgentA, @agent:AgentB and @agent:AgentC, first transfer to AgentA, wait for its response. Then transfer to AgentB, wait for its response. Then transfer to AgentC, wait for its response. Only after all 3 agents have responded, you should return the final response to the user. """