victorious-midnight-79553
10/22/2025, 7:15 AMentrypoint function - first I do: session = AgentSession[ExpenseData](.... and then: session.userdata = ExpenseData(job_context=job_context, participant_name=name) and then I do await session.start(..
is this correct? and then how do I access the participant name later within a tool call?tall-airline-16756
10/22/2025, 7:15 AMtall-airline-16756
10/22/2025, 7:16 AMAgentSession and setting session.userdata. To access the participant_name later in a tool call, you can simply retrieve it from context.userdata within your function tool implementation.
Here’s a friendly example of how you might define a function tool to get the participant name:
@function_tool
async def get_participant_name(self, context: RunContext[ExpenseData]) -> str:
expense_data = context.userdata
return expense_data.participant_name
If you have any questions or want me to walk you through this further, just let me know—I’m here to help!
Sources: rpc/rpc_agent.py | examples/voice_agents/silent_function_call.py | agent.py