straight-jelly-92105
10/13/2025, 10:17 AMtall-airline-16756
10/13/2025, 10:18 AMtall-airline-16756
10/13/2025, 10:18 AMstraight-jelly-92105
10/13/2025, 10:21 AMtall-airline-16756
10/13/2025, 10:22 AMstraight-jelly-92105
10/13/2025, 10:23 AMtall-airline-16756
10/13/2025, 10:24 AMupdate_instructions() that let you update the agent's core instructions in real-time. This means you can easily tailor the agent's behavior based on things like the participant's identity or the context you're working with.
On top of that, you can also swap out the entire chat context on the fly using update_chat_ctx(). This is great for more advanced scenarios, like switching personas or smoothly moving between different phases of a conversation.
If you'd like, I’m here to help with more details or examples on how to set these up—just let me know!
Sources: complex-agents/ivr-agent/README.md | Workflows | LiveKit Docs | Agent Session & Activity Management | livekit/livekit_composite | DeepWiki | livekit-agents/livekit/agents/voice/agent_activity.pystraight-jelly-92105
10/13/2025, 10:29 AMtall-airline-16756
10/13/2025, 10:29 AMself.session.participant to get user-specific details like their ID or other attributes. This helps in tailoring the experience just for them.
2. Update Instructions: With the update_instructions() method, you can easily modify the agent's core instructions on the fly. For instance, checking the user ID and adjusting the prompt to fit their needs.
3. Personalize Chat Context: Using update_chat_ctx(), you can add user-specific details into the chat context—like their name or preferences—to make the interaction feel more personal.
4. Store User Data: Don’t forget to save important user information in session.userdata. This helps keep the conversation consistent and allows the agent to behave in a more informed way.
If you’d like, I’d be more than happy to provide detailed code examples or walk you through the implementation step-by-step. Just let me know!
Sources: pipeline-tts/tts_comparison/README.md | agent/main.pystraight-jelly-92105
10/13/2025, 10:30 AMtall-airline-16756
10/13/2025, 10:30 AMfrom dataclasses import dataclass
@dataclass
class UserData:
first_name: Optional[str] = None
last_name: Optional[str] = None
customer_id: Optional[str] = None
def is_identified(self) -> bool:
return self.first_name is not None and self.last_name is not None
def summarize(self) -> str:
if self.is_identified():
return f"Customer: {self.first_name} {self.last_name} (ID: {self.customer_id})"
return "Customer not yet identified."
class CustomAgent:
async def on_enter(self):
userdata: UserData = self.session.userdata
custom_instructions = self.instructions
if userdata.is_identified():
custom_instructions += f"\n\nYou are speaking with {userdata.first_name} {userdata.last_name}."
chat_ctx = self.chat_ctx.copy()
chat_ctx.add_message(
role="system",
content=f"You are the {self.__class__.__name__}. {userdata.summarize()}"
)
await self.update_chat_ctx(chat_ctx)
self.session.generate_reply()
Here's what's happening in this example:
• We store user-specific data like first name, last name, and customer ID in session.userdata.
• The agent's instructions get updated on the fly, depending on whether we can identify the user.
• The chat context becomes more personalized by adding these details through update_chat_ctx().
If anything feels unclear or if you'd like me to walk you through more examples, just let me know—I'm here to help!straight-jelly-92105
10/14/2025, 1:20 PMtall-airline-16756
10/14/2025, 1:20 PMapi_key: your-api-key
api_secret: your-api-secret
ws_url: ws://host.docker.internal:7880
redis:
address: host.docker.internal:6379
1. Run the Docker Container: You’ll pass your configuration using the LIVEKIT_CONFIG environment variable. Here’s how you can do it:
docker run --rm \
-e LIVEKIT_CONFIG="$(cat config.yaml)" \
--network host \
livekit/livekit-server
1. Use Docker Compose: If your setup is a bit more complex, Docker Compose is a great way to manage services like Redis and TLS smoothly. LiveKit even offers a pre-configured setup to help you get started.
2. Open Required Ports: Don’t forget to make sure ports like 7880 (WebSocket), 7881 (gRPC), and the UDP range (for example, 50000–60000) are open and accessible.
If you’d like to dive deeper, the sample config is a wonderful resource. And of course, I’m here if you have any questions or need a hand with anything else!
Sources: README.md | README.md | Deploy to a VM | LiveKit Docs | Self-hosted SIP server | LiveKit Docs | Deploying LiveKit | LiveKit Docsstraight-jelly-92105
10/14/2025, 1:21 PMbrew cleanup livekit...
Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP=1.
Hide these hints with HOMEBREW_NO_ENV_HINTS=1 (see man brew).
(base) abhiramvarrey@Admins-MacBook-Pro-4 livekit % livekit-server --dev
2025-10-14T170155.505+0530 INFO livekit server/main.go:212 starting in development mode
2025-10-14T170155.506+0530 INFO livekit server/main.go:215 no keys provided, using placeholder keys {"API Key": "devkey", "API Secret": "secret"}
2025-10-14T170155.506+0530 INFO livekit routing/interfaces.go:180 using single-node routing
2025-10-14T170155.508+0530 INFO livekit service/server.go:264 starting LiveKit server {"portHttp": 7880, "nodeID": "ND_7vKA8ma9KpZE", "nodeIP": "192.168.10.19", "version": "1.9.1", "bindAddresses": ["127.0.0.1", "::1"], "rtc.portTCP": 7881, "rtc.portUDP": {"Start":7882,"End":0}}
2025-10-14T170155.508+0530 DEBUG livekit service/signal.go:119 starting relay signal server {"topic": "ND_7vKA8ma9KpZE"}
2025-10-14T180136.536+0530 INFO livekit hwstats/cpu.go:129 high cpu load {"load": 0.9168336673346693}
2025-10-14T183622.250+0530 INFO livekit hwstats/cpu.go:129 high cpu load {"load": 0.9374369323915237}
is my logtall-airline-16756
10/14/2025, 1:21 PMAPI Key: devkey, API Secret: secret), which are perfect for development but you'll want to swap them out for secure keys when you move to production.
• Single-node routing is enabled, which is common for development setups.
• The server is set to run on HTTP port 7880, TCP port 7881, and UDP starting at port 7882.
• There are some high CPU load warnings, which might mean your machine is feeling a bit stretched.
If you’re thinking about moving to production, here are some friendly tips to keep in mind:
1. Switch out those placeholder API keys for secure ones to keep everything safe.
2. Make sure your hardware has enough resources to handle the load you expect.
3. If you need scalability, consider setting up multi-node routing.
4. Don’t forget to open the necessary ports (7880, 7881, and the UDP range) in your firewall so everything can communicate properly.
Please feel free to reach out if you want a hand with any specific settings or if you run into any issues—I’m here to help!straight-jelly-92105
10/14/2025, 1:25 PMtall-airline-16756
10/14/2025, 1:25 PMdocker pull livekit/livekit-server
2. Create a Configuration File: Next, you'll want to create a YAML configuration file (for example, config.yaml) where you’ll specify your API key, API secret, WebSocket URL, and Redis connection details. Here’s a sample to guide you:
api_key: your-api-key
api_secret: your-api-secret
ws_url: ws://host.docker.internal:7880
redis:
address: host.docker.internal:6379
3. Run the Docker Container: Now, start the LiveKit server using your configuration file with this command:
docker run --rm \
-e LIVEKIT_CONFIG="$(cat config.yaml)" \
--network host \
livekit/livekit-server
4. Open Required Ports: To make sure everything works smoothly, please open these ports for external access:
◦ 7880 (WebSocket)
◦ 7881 (gRPC)
◦ UDP range (like 50000–60000 for WebRTC)
1. Test the Setup: Finally, check that your server is up and running by connecting to the WebSocket URL, for example: ws://localhost:7880.
If you run into any questions or need a hand with the setup or tweaking the configuration, please don’t hesitate to reach out. I’m here to help!straight-jelly-92105
10/14/2025, 1:29 PMtall-airline-16756
10/14/2025, 1:30 PMpip install "livekit-agents[openai,silero,deepgram,cartesia]~=1.0"
2. Define the Agent Entry Point: Next, create a function that connects your agent to the LiveKit server and handles jobs. Here's a simple example to get you started:
from livekit import agents
from livekit.agents import JobContext, cli
async def entrypoint(ctx: JobContext):
await ctx.connect()
print(f"Agent connected to room: {ctx.room.name}")
if __name__ == "__main__":
cli.run_app(entrypoint)
3. Configure Worker Options: To tailor your agent's behavior, you can use WorkerOptions for settings like memory limits, permissions, and connection retries. Here's how you might set that up:
from livekit.agents import WorkerOptions
options = WorkerOptions(
load_threshold=0.8,
job_memory_warn_mb=750,
job_memory_limit_mb=2048,
permissions=WorkerPermissions(can_publish=True, can_subscribe=True),
)
cli.run_app(entrypoint, options)
4. Run the Agent: Finally, you can start your agent by running this command:
python your_agent.py
If you have any questions or would like me to provide a more detailed example, please don't hesitate to ask. I'm here to help!
Sources: agent/main.py | Voice AI quickstart | LiveKit Docs | agent.py | README.md | python-agent-example-app/main.pystraight-jelly-92105
10/14/2025, 1:34 PMtall-airline-16756
10/14/2025, 1:35 PMlocalhost with the correct IP address if your server is on a different machine.
2. Set Up Environment Variables: It’s a good idea to store the WebSocket URL, API key, and API secret in a .env file for easy management:
LIVEKIT_API_KEY=your_api_key
LIVEKIT_API_SECRET=your_api_secret
LIVEKIT_URL=ws://localhost:7880
3. Modify the Agent Code: Next, update the WorkerOptions in your Python agent to include the WebSocket URL and your credentials:
from livekit.agents import WorkerOptions
options = WorkerOptions(
ws_url="ws://localhost:7880",
api_key="your_api_key",
api_secret="your_api_secret",
)
cli.run_app(entrypoint, options)
4. Run the Agent: Finally, start your Python agent and make sure it connects smoothly to your Docker-hosted LiveKit server:
python your_agent.py
If you run into any bumps or have questions about specific settings, feel free to reach out—I’m here to help!straight-jelly-92105
10/14/2025, 1:39 PMtall-airline-16756
10/14/2025, 1:42 PMredis:
address: host.docker.internal:6379
2. WebRTC Port Range: Defining a UDP port range for your WebRTC traffic can improve performance:
rtc:
udp_port: 7881
tcp_port: 7882
port_range_start: 50000
port_range_end: 60000
3. Room Settings: Including default room configurations gives you better control over your sessions:
room:
auto_create: true
empty_timeout: 300
max_participants: 50
4. TURN Server: If NAT traversal is something you need, adding TURN server settings will be beneficial:
turn:
enabled: true
domain: your-domain.com
cert_file: /path/to/cert.pem
key_file: /path/to/key.pem
5. Logging: Turning on detailed logging can really help when debugging:
logging:
level: debug
json: true
If you’d like, I’m here to help you add these configurations or tailor them to your specific needs. Just let me know!
Sources: pkg/config/config.go | server-sample.yamlstraight-jelly-92105
10/14/2025, 1:53 PMtall-airline-16756
10/14/2025, 1:53 PMstraight-jelly-92105
10/21/2025, 5:44 AM