Closed as not planned
Description
I want to implement a handoff agent, but in this agent I have dynamic data in the system prompt.
i was thinking to do smth like that
def run_rate_negotiator(ctx: RunContextWrapper[Any]):
conversation = ctx.context["conversation_history"]
query = ctx.context["text_query"]
conversation.append({"role": "user", "content": query})
rate_negotiator = Agent(
name="rate_negotiator",
instructions=get_rate_negotiator_instructions(ctx.context["company_info"], ctx.context["load_context"]),
model=OpenAIChatCompletionsModel(model=openai_deployment_name, openai_client=azure_client),
tools=[...]
)
try:
result = Runner.run(rate_negotiator, input=conversation, context=ctx.context)
return result
except Exception as e:
print(f"Error in run_rate_negotiator: {str(e)}")
error_json = '{"error": "Failed to process rate negotiation: ' + str(e) + '"}'
return error_json
To pass handoff agent to a main agent, I need the following
Can anyone help me with this?