update_instructions

View as MarkdownOpen in Claude

Update the agent’s system prompt mid-session. The new instructions take effect immediately for subsequent LLM turns.

Parameters

instructions
strRequired

The new system prompt text.

Returns

None

Example

from signalwire.livewire import Agent, AgentSession, AgentServer, JobContext, function_tool, run_app
@function_tool
def escalate() -> str:
"""Escalate to a senior agent."""
return "Escalating now."
server = AgentServer()
@server.rtc_session()
async def entrypoint(ctx: JobContext):
await ctx.connect()
agent = Agent(
instructions="You are a junior support agent. Help with basic questions.",
tools=[escalate],
)
session = AgentSession()
await agent.update_instructions("You are now a senior support agent. Handle complex issues.")
await session.start(agent, room=ctx.room)
run_app(server)