[Agent Worker] :x: Error updating instructions: Ty...
# ask-ai
m
[Agent Worker] ❌ Error updating instructions: TypeError: session.updateInstructions is not a function at Room.<anonymous> (/Users/pabloambram/Development/brainlifter/src/agent-worker.ts12036) at Room.emit (nodeevents507:28) at Room.Room.processFfiEvent (/Users/pabloambram/Development/brainlifter/node_modules/@livekit/rtc-node/src/room.ts46616) at FfiClient.Room.onFfiEvent (/Users/pabloambram/Development/brainlifter/node_modules/@livekit/rtc-node/src/room.ts29410) at FfiClient.emit (nodeevents519:35) at <anonymous> (/Users/pabloambram/Development/brainlifter/node_modules/@livekit/rtc-node/src/ffi_client.ts4914)
t
Thanks for reaching out, Pablo. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It looks like the error happens because the
updateInstructions
method isn’t directly available on the
session
object. Instead, you’ll want to call
update_instructions()
on the Agent instance. This way, the instructions get updated correctly by going through the right session layer. For example, in JavaScript/TypeScript, you can try:
Copy code
await this._activity.updateInstructions(instructions);
If you’re working with a custom agent setup or if you’d like some help debugging a specific integration, please don’t hesitate to reach out—I’m here to help! Sources: basics/change_agent_instructions.py | plugins/openai/src/realtime/realtime_model.ts | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real...
m
[Agent Worker] ⚠️ agent.updateInstructions not available
t
I'd love to help you out! Could you please let me know if you're using a custom agent setup or maybe a specific integration like OpenAI or Google Realtime? Also, are you working with the standard LiveKit Agent framework or a version that's been modified? This will help me understand your situation better and assist you more effectively.
m
i’m using google realtime
t
Hi there! To update instructions using Google Realtime, you can use the
update_instructions
method from your Agent instance. This is a great way to make sure your new instructions are smoothly shared throughout the Google Realtime session. Here’s a quick example to help you out:
Copy code
await agent.update_instructions("New system instructions for the agent.")
If you happen to be working directly with the session, you can also try this:
Copy code
await activity.update_instructions("Updated instructions...")
Just a heads-up: when you update instructions in Google Realtime, it will restart the session to apply those changes properly. If you have any questions or need a hand with this, feel free to reach out—I’m here to help! Sources: LLM Integration & Real-time Models | livekit/livekit_composite | DeepWiki | Gemini Live API plugin | LiveKit Docs | Agent Session & Activity Management | livekit/livekit_composite | DeepWiki | livekit-plugins/livekit-plugins-openai/livekit/plugins/openai/realtime/real... | plugins/openai/src/realtime/realtime_model.ts