dry-leather-74420
12/12/2025, 7:44 PMtall-airline-16756
12/12/2025, 7:44 PMtall-airline-16756
12/12/2025, 7:45 PMupdate_instructions on the session's AgentActivity inside the tool — it updates the LLM system prompt at runtime and takes effect for subsequent responses in the same session.
Example (Python):
@function_tool()
async def update_agent_instructions(context: RunContext, new_instructions: str):
# update instructions immediately
await context.session.update_instructions(new_instructions)
# the agent will use these instructions for its next response
return f"Updated instructions to: {new_instructions}"
If you want the voice agent to apply the instructions for the very next generation during the same tool flow, call await context.session.update_instructions(...) before triggering that next LLM/voice response.
Would you like a version for another language or an example showing a tool call that updates instructions then immediately generates speech output?
Sources: Agents (Python) | livekit/livekit_composite | DeepWiki