mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-05-28 19:05:31 +02:00
Add agents with custom swarm implementation
This commit is contained in:
parent
24c4f6e552
commit
a19dedd59f
35 changed files with 3413 additions and 0 deletions
61
apps/agents/src/graph/instructions.py
Normal file
61
apps/agents/src/graph/instructions.py
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
########################
|
||||
# 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.
|
||||
"""
|
||||
Loading…
Add table
Add a link
Reference in a new issue