Hi Support Team
I have a team agent that call two agents (RAG and custom tool). The problem I am facing is that when the team agent transfer the call to the RAG agent, then the RAG agent does using the instructions given fully.
This is the prompt of my RAG agent:
generalQuestions_agent_prompt = “”"
“You only answer with information from your RAG database.
You don’t use your internal knowledge.
If the customer has a problem with a previous service rendered always empatheticly ask them to contact the dedicated phone number 27113128472. to resolve your issue promtply.
Summarise the answer in about 2 sentences.
If you can’t answer with the database, simple return ‘I don’t know’.
At the end of each response add the phrase ‘Type * for Main Menu’ in italic text”
“”"
What I am noticing is that when I call the RAG agent directly it adheres to the instruction given, in particular the part that says: “At the end of each response add the phrase ‘Type * for Main Menu’ in italic text”. Meaning it does add the phrase at the end of the response
However when I call the team agent, the team agent successfully transfer to the RAG agent but doesn’t adhere to the part At the end of each response add the phrase ‘Type * for Main Menu’ in italic text". Meaning that it doesn’t add the phrase at the end of the response:
Here is a snippet of my code:
generalQuestions_agent_prompt = “”"
“You only answer with information from your RAG database.
You don’t use your internal knowledge.
If the customer has a problem with a previous service rendered always empatheticly ask them to contact the dedicated phone number 27113128472. to resolve your issue promtply.
Summarise the answer in about 2 sentences.
If you can’t answer with the database, simple return ‘I don’t know’.
At the end of each response add the phrase ‘Type * for Main Menu’ in italic text”
“”"
generalQuestions_agent = Agent(
name=“General Questions Agent”,
model=Gemini(id=“gemini-2.0-flash-exp”),
role=“Answer questions from the knowledgebase”,
session_id=userMobileNumber,
# Add the knowledge base to the agent
knowledge=knowledge_base,
show_tool_calls=False,
markdown=True,
search_knowledge=True,
add_datetime_to_instructions=True,
# Set add_history_to_messages=true to add the previous chat history to the messages sent to the Model.
add_history_to_messages=True,
# Number of historical responses/messages to add to the messages.
num_history_responses=5,
# Store agent sessions in a database
storage=SqliteAgentStorage(table_name=“agent_knowledgebase_updated”, db_file=“tmp/agent_storage.db”),
description=[“You are a customer service representative for a surface cleaning company called, SurfaceCure Pressure Cleaning”],
instructions=[generalQuestions_agent_prompt]
)
quotation_agent = Agent(
name=“Quotation Agent”,
model=Gemini(id=“gemini-2.0-flash-exp”),
session_id=userMobileNumber,
tools=[sendQuoteConfirmation],
show_tool_calls=True,
markdown=True,
instructions=[
“Only use the sendQuoteConfirmation tool.”,
“Use the Quotation Agent if the customer ask for a quotation/quote or the price for a service.”,
“Under no circumstances should you ask for additional information.”
]
)
team_agent = Agent(
name=“Agent Team”,
model=Gemini(id=“gemini-2.0-flash-exp”),
session_id=userMobileNumber,
team=[generalQuestions_agent, quotation_agent],
show_tool_calls=True,
markdown=True,
instructions=[
“First, use the General Questions Agent”,
“If the customer request a quotation or a quote or the price for a cleaning service then use the Quotation Agent”,
“If the customer say give me a quotation or a quote or the price for a cleaning service then use the Quotation Agent”
],
add_datetime_to_instructions=True,
# Set add_history_to_messages=true to add the previous chat history to the messages sent to the Model.
add_history_to_messages=True,
# Number of historical responses/messages to add to the messages.
num_history_responses=10,
# Store agent sessions in a database
#storage=SqliteAgentStorage(table_name=“agent_teamagent”, db_file=“tmp/agent_storage.db”),
)
team_agent.print_response(“What is the name of the company?”)
team_agent.cli_app(stream=True)