I want to change the agentsession options on the f...
# ask-ai
b
I want to change the agentsession options on the frontend depending on the situation. Is it possible to modify them dynamically or set them when the session starts? How can I implement this?
t
Thanks for reaching out, 최윤지. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
It sounds like you want to control AgentSession options from the frontend—either at start or during a live call. • Yes, you can set options at session start. Provide them when constructing/starting the session on the agent side. You can pass values from the frontend via job metadata or room token config so the agent reads them on start and initializes accordingly. Docs: authentication/metadata, External data • Many options can also be updated dynamically during a session. From your agent code, call the runtime updater (e.g.,
update_options
, or update instructions/chat context) and those changes propagate to the live pipeline where supported. Agent session integration To trigger changes from the frontend during a session: 1. Expose an RPC handler on the agent that accepts a JSON payload with your desired options. 2. From the frontend, call RPC with the new options. 3. In the agent’s RPC handler, call
update_options(...)
(or `update_instructions`/`update_chat_ctx`) to apply them. RPC, Agent updates If you share which options you need to toggle (e.g., endpointing delays, tool choice, instructions), I can outline the exact fields and a minimal handler + frontend call. Sources: Node.js Agents Architecture | livekit/livekit_composite | DeepWiki | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Python Agents Core Architecture | livekit/livekit_composite | DeepWiki | How to test your agent using another agent | Text and transcriptions | LiveKit docs
b
Is there any frontend and server-side code that dynamically changes the Agent Session config?
t
It sounds like you’re looking for concrete code showing frontend + server changes to AgentSession config at runtime. I can share minimal snippets that do: • Frontend: call RPC with new options • Agent: RPC handler →
update_options(...)
(or `update_instructions`/`update_chat_ctx`) and reply Which language do you prefer for the agent code: Python or Node.js? For reference: • RPC from frontend: Remote method calls • Runtime updates on the agent: Agent Session & Client Integration • Turn/interrupt settings you might toggle: Turn detection and interruptions Sources: Building voice agents | LiveKit Docs | Agent Session & Client Integration | livekit/livekit_composite | DeepWiki | Python Agents Core Architecture | livekit/livekit_composite | DeepWiki | Remote method calls | LiveKit docs | Real-time AI Models & Streaming | livekit/livekit_composite | DeepWiki