Is there any method of the Agent class that's used...
# ask-ai
s
Is there any method of the Agent class that's used to update the system prompt?
t
Thanks for reaching out, Roman. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Absolutely! The
Agent
class in LiveKit has a handy method called
update_instructions()
that lets you update the system prompt whenever you need. It’s a great way to tweak the instructions guiding the agent’s behavior while your session is still running. Here’s a quick example to show you how it works:
Copy code
await agent.update_instructions("Your new system prompt here")
All you need to do is pass in a string with your new instructions, and the method will update the agent’s internal state for you. Easy, right? Sources: Vision Agent Quickstart | LiveKit Docs | Vision Agent Quickstart | LiveKit Docs | Vision Agent Quickstart | LiveKit Docs | tools/server/public_simplechat/readme.md | livekit-agents/livekit/agents/voice/agent.py