breezy-knife-25008
11/25/2025, 3:59 PMuv run python src/agent.py dev the logs don't work locally, only in lk cloud. Do I have to use multiple numbers and dispatch rules?
I'd rather just test using the console uv run python src/agent.py console but with egress enabled the console run fails with an error (I posted it in the egress channel)
livekit.api.twirp_client.TwirpError: TwirpError(code=not_found, message=requested room does not exist, status=404) (tall-airline-16756
11/25/2025, 3:59 PMtall-airline-16756
11/25/2025, 4:00 PMTwirpError: requested room does not exist you saw when running console with egress.
Short answers
• Use dev mode (uv run python src/agent.py dev) to test locally with your real phone number, inbound trunk, and existing dispatch rules. You do not need extra numbers or dispatch rules.
• Do not use console mode when egress is enabled. console runs entirely locally and does not connect to a LiveKit room, so egress calls fail with the 404 TwirpError because no room exists.
What to do next
1. Run in dev mode so your local agent connects to the LiveKit Cloud room created by your dispatch rule:
◦ Command: uv run python src/agent.py dev
◦ Add --log-level=DEBUG if you need more verbose logs.
1. Verify room lifecycle before starting egress:
◦ Confirm the dispatch rule is creating/joining a room when a call arrives.
◦ Ensure your agent has joined that exact room name/ID before initiating egress. The 404 means egress tried to operate on a room that wasn’t present.
1. If you want to test interactively without egress:
◦ You can use console mode for logic/flow testing that doesn’t call egress or require a LiveKit room.
If you’d like, tell me:
• Which mode you want to use (dev or console),
• The exact egress call you’re making (code snippet or command), and
• Whether your agent logs show it successfully joining the room when a call arrives.
I’ll give the smallest targeted troubleshooting steps based on that.
Sources: Voice AI quickstart | LiveKit docs | Deploying to production | LiveKit Docs | Observability data hooks | LiveKit docs | Agent server options | LiveKit docsbreezy-knife-25008
11/27/2025, 5:04 PMuv run python src/agent.py dev --log-level=DEBUG
I get this in the terminal
Auto-reload is not supported on the iTerm2 terminal, disabling...
09:01:06 DEBUG asyncio Using selector: KqueueSelector
INFO livekit.agents starting worker {"version": "1.3.3", "rtc-version": "1.0.19"}
INFO livekit.agents registered worker {"agent_name": "hvac-service-agent", "id": "AW_nbC8C2gQXoRX", "url":
"wss://hvac-agent-hello-67gp4wqp.livekit.cloud", "region": "US West B", "protocol": 16}
I call the number and the agent answers, but it's happening all in cloud, the live logs are logging, but not local. Claude says I need multiple dispatch rules. You're saying this should just log in my local terminal ?tall-airline-16756
11/27/2025, 5:04 PMuv run python src/agent.py dev connects your local agent to LiveKit Cloud; that makes most session-level logs (transcripts, egress, full agent traces) appear in LiveKit Cloud rather than your local terminal.
• Local terminal will show connection events and any stdout/stderr your code emits, but not the full cloud-side session observability.
To troubleshoot and make the right logs visible locally, please share the following so I can give targeted steps:
1. Which logs you expect locally vs what you actually see (examples: transcript text, request/response payloads, audio I/O, handler debug prints).
2. Full agent startup command and the complete terminal output around the time a call arrives and the agent joins the room.
3. A short snippet showing where your agent logs inside call/room handlers (your print/log statements).
4. Any logger/observability config or env vars that could forward logs to cloud (mask secrets).
5. Whether you use the LiveKit CLI (lk) and if you run lk agent logs during tests.
6. The dispatch rule config (what it routes to — agent name or room template) and the basic call steps you perform.
What I’ll do once you share that:
• Explain exactly which events are local vs cloud and why.
• Show minimal changes to emit more local logs (logger config or adding local debug prints).
• If you want transcripts/egress artifacts locally, provide steps to fetch them or run egress only after the agent is in the room.
Send the details you can and I’ll give concise, step-by-step changes you can apply.
Sources: Voice AI quickstart | LiveKit docs | Agents telephony integration | LiveKit Docs | Agent insights in LiveKit Cloud | LiveKit docsbreezy-knife-25008
11/27/2025, 5:08 PMtall-airline-16756
11/27/2025, 5:09 PMdev used the company ID from secrets.env and why logs are showing in the cloud.
Short answer
• You do not need multiple dispatch rules.
• Your uv run python src/agent.py dev is connecting to LiveKit Cloud, so the agent is running as a cloud-connected instance and cloud-managed secrets (from secrets.env) are being used rather than your local .env.local.
• Cloud-managed sessions produce full session logs in the LiveKit dashboard; your local terminal only shows the local process stdout/stderr and connection events.
What to do to use your .env.local and see local behavior
1. Confirm you are running an un-deployed local process (not a cloud-managed agent):
◦ Do not run lk agent deploy or use an agent that is registered/managed in the cloud.
◦ If you previously created a cloud agent, check lk agent list to see if it’s registered.
1. Ensure .env.local is loaded by your code:
◦ Add/verify from dotenv import load_dotenv; load_dotenv('.env.local') (or equivalent) early in startup so COMPANY_ID and LiveKit creds come from .env.local.
1. Run locally (uses local env values):
◦ For pure local testing (no egress): uv run python src/agent.py console
◦ For local process connecting to LiveKit cloud (allows egress while using local creds): run your script directly without deploying to cloud, e.g. uv run python src/agent.py dev but ensure your code loads .env.local and you haven’t uploaded secrets.env for that agent name.
1. If egress must run, keep this workflow:
◦ Run the agent locally (so it uses .env.local) but let it connect to LiveKit Cloud to join a real room. Egress will work because the room exists in cloud while credentials come from .env.local.
If you want, paste:
• The top of your agent startup code (how env vars are loaded),
• The exact uv command you run,
and I’ll point out the minimal change so your local .env.local COMPANY_ID is used and which logs you’ll see locally vs in the dashboard.
Sources: Secrets management | LiveKit Docs | Voice AI quickstart | LiveKit docs | Agent server options | LiveKit docs | Log collection | LiveKit Docs | Agent deployment CLI reference | LiveKit docsbreezy-knife-25008
11/27/2025, 5:12 PMuv run python src/agent.py dev but ensure your code loads .env.local and you haven’t uploaded secrets.env for that agent name.tall-airline-16756
11/27/2025, 5:12 PM.env.local while the cloud-deployed agent still exists.
Why this happens (short)
• A deployed agent uses secrets uploaded to LiveKit Cloud (secrets.env) for its runtime. That is why the cloud-managed instance uses the company ID from secrets.env.
• Running uv run ... dev can either start a local process or be used in workflows that register/manage an agent in the cloud. If your local process connects with the same agent name/registration as the deployed one, the cloud-managed config/secrets and cloud observability will dominate the session and logs.
What you want: run locally, use .env.local, and still allow egress via LiveKit Cloud
1. Ensure your local code explicitly loads .env.local at startup:
◦ Add/verify:
from dotenv import load_dotenv
load_dotenv('.env.local')
• Do this before any LiveKit client/agent initialization so credentials and COMPANY_ID are read from .env.local.
1. Run a true local instance that does not impersonate the deployed cloud agent:
◦ Use a different agent name/ID than the deployed agent (change AGENT_NAME or equivalent in .env.local) so LiveKit treats your local process as a separate participant instead of the cloud-managed agent.
◦ Start locally: uv run python src/agent.py dev --log-level=DEBUG
◦ Confirm in startup logs you see your .env.local values (or add a debug print for COMPANY_ID).
1. Allow egress while local:
◦ Keep the LiveKit project credentials in .env.local so your local process connects to the same LiveKit project.
◦ Because the room/egress runs in LiveKit Cloud, egress will work while your agent is local (the room lives in the cloud, your local agent joins it).
1. See local logs
◦ With a different agent name and local run that loads .env.local, your terminal will show connection events, your handler prints, and debug logs.
◦ Full session observability (transcripts, stored traces) will still be available in the LiveKit dashboard, but your local stdout/stderr will contain the runtime logs you add.
If you prefer minimal risk:
• Use a local-only agent name (e.g., append -local) in .env.local so you can run tests without touching the deployed agent or its secrets.
If you want, paste:
• The top of your startup file (how envs are loaded) and
• The `AGENT_NAME`/identifier you use,
and I’ll point out the exact minimal edits so your local run uses .env.local and produces local logs while still enabling egress.breezy-knife-25008
11/27/2025, 5:15 PMif __name__ == "__main__":
cli.run_app(
WorkerOptions(entrypoint_fnc=entrypoint, agent_name="agent-name")
)tall-airline-16756
11/27/2025, 5:15 PM.env.local values and avoid colliding with the deployed agent (so cloud-managed secrets and logs won’t override your local run).
Use an env var and load it before starting the worker. Example:
import os
from dotenv import load_dotenv
from livekit.agents import cli, WorkerOptions
load_dotenv(".env.local")
agent_name = os.getenv("AGENT_NAME", "agent-name-local")
if __name__ == "__main__":
cli.run_app(
WorkerOptions(entrypoint_fnc=entrypoint, agent_name=agent_name)
)
Notes:
• Set AGENT_NAME in .env.local to a distinct value (e.g., append -local) so the cloud-deployed agent and your local agent are separate.
• Ensure you load .env.local before any LiveKit client/agent initialization so COMPANY_ID and credentials come from your local file.
• With a different agent name your terminal will show your local stdout/stderr and debug logs; egress still works because the room runs in LiveKit Cloud while your agent joins it.breezy-knife-25008
11/27/2025, 5:16 PMtall-airline-16756
11/27/2025, 5:16 PMAGENT_NAME value from .env.local
• A short snippet showing where you load envs (or confirm you used the example)
Happy to review and help adjust any remaining bits.breezy-knife-25008
11/29/2025, 8:29 PMuv run python src/agent.py dev --log-level=DEBUG
But now since my agent is deployed to livekit cloud this has stopped working. The call logs livekit cloud. Not my local logs. So I am either misunderstanding something, or it no longer works like it did before.
I certainly would need teh abilility to run a call with uv run python src/agent.py dev --log-level=DEBUG and test the operations of the call (like egress and reporting) without deleting the agent in production. I am on 1.3.3.
here is my code:
``````tall-airline-16756
11/29/2025, 8:30 PMload_dotenv).
2. Confirm agent_name differs from prod and you see that name in startup logs.
3. Add explicit debug logs at session start and key handlers:
◦ log at session entry: ctx.room.name, ctx.worker_id
◦ log before/after egress start
1. Confirm the room your test call creates does NOT match a production dispatch rule.
2. If you want to trigger egress locally, either:
◦ Manually start egress for the test room (CLI/API) after local agent joins, or
◦ Ensure no cloud-side egress rule is already running for that room.
What I need if you want a precise next step
• The active dispatch rule(s) (room prefix or matching config).
• How you’re initiating test calls (SIP inbound number, Agents Playground, or frontend).
• The session-start logging snippet or confirm you added a log in your entrypoint.
If you send those three items I’ll tell you the exact minimal change so your local agent receives jobs and prints the call-level logs you expect.
Sources: Agent server | LiveKit docs | Agents playground | LiveKit Docs | Job lifecycle | LiveKit docs | Agents telephony integration | LiveKit docsbreezy-knife-25008
11/29/2025, 8:33 PMuv run python src/agent.py dev --log-level=DEBUG
I still see no logs running locally when I use a different local agent name at the entry point.
I know I saw real stats happening here before like participants entering room, etc.. in my local terminal. Now that I agent is deployed to livekit I only see those logs in livekit cloud
if __name__ == "__main__":
cli.run_app(
WorkerOptions(entrypoint_fnc=entrypoint, agent_name=os.getenv("AGENT_NAME", "hvac-service-agent"))
)tall-airline-16756
11/29/2025, 8:33 PMAGENT_NAME.
Short answer
• The deployed cloud agent is still claiming the jobs via dispatch, so your local worker never receives the per-call work. Seeing only the registration log is expected when dispatch routes calls to the cloud agent.
To diagnose quickly, please share these three things (small snippets/values only):
1. The active dispatch rule(s) config (roomPrefix or matching criteria).
2. How you trigger the test call (SIP inbound number, Agents Playground, or a custom client).
3. The room name created when you make the test call (copy it from the LiveKit dashboard or logs).
With those I will:
• Tell you the minimal change so the test room won’t be claimed by production (one-line dispatch change or room name pattern).
• Show the exact steps to run a local job that will produce full call logs and allow egress without deleting the production agent.breezy-knife-25008
11/29/2025, 8:37 PM{
"dispatch_rule": {
"rule": {
"dispatchRuleIndividual": {
"roomPrefix": "call-"
}
},
"name": "My dispatch rule",
"roomConfig": {
"agents": [
{
"agentName": "service-agent",
"metadata": "dispatch metadata"
}
]
}
}
}
I trigger it with a google voice call to my sip inbound number. here's the trunk
{
"trunk": {
"name": "My trunk",
"numbers": [
"+snip"
],
"krispEnabled": true
}
}
here's the last room that was created:
call-_anonymous_ZWwb7zXAkXzq
My google voice comes in anonymous, but that should matter for thistall-airline-16756
11/29/2025, 8:38 PMhvac-service-agent. When a SIP call creates room call_anonymous_..., the cloud dispatch rule assigns that job to the deployed cloud agent. Your local worker (even with a different name) only registers — it never receives that job — so you see only the registration log locally and full call activity in the LiveKit Cloud logs.
What to change so your local run receives the job (pick one)
1) Use a test room prefix (recommended, no prod changes)
• Make the test call create a room with a different prefix, e.g. testcall-... instead of call-.
• Join that testcall-... room from a client (Agents Playground or test client).
• Run your local agent (unique agent_name) — it will get the job because the prod dispatch rule doesn't match.
2) Scope dispatch rules to exclude test rooms
• Change production dispatch rule to only match prod-call- (or similar).
• Use call- → prod-call- for production calls.
• Use test-call- locally. This prevents production agent from claiming test sessions.
3) Manually create a job that targets your local agent
• Use the Agents Playground or an API/CLI to create a job that specifically targets your local agent_name (no dispatch rule involved).
• Start your local agent; it will accept the job and print full logs.
4) Temporarily disable the production dispatch rule (if safe)
• Turn off or rename the rule while you run tests, then re-enable it after.
• This makes incoming SIP calls eligible for your local agent.
Quick verification checklist (do these now)
• Confirm production dispatch rule remains as shown (matches call-).
• Make a test room name that does NOT start with call- (e.g., testcall-local-1) and join it.
• Start local agent with distinct AGENT_NAME and DEBUG logging.
• Observe local terminal — you should now see session start, participant events, egress start/finish, etc.
One minimal concrete step to try immediately
• Place a test call that results in a room name NOT starting with "call-". Or manually create/join testcall-local-1 in the Agents Playground. Then run:
uv run python src/agent.py dev --log-level=DEBUG You should see session logs when the local agent gets the job.
If that still doesn’t produce local call logs, paste:
• The exact test room name you used,
• The local agent_name shown in startup logs,
• The first 20 lines of terminal logs after the test join.
I’ll pinpoint the next minimal change.breezy-knife-25008
11/29/2025, 8:42 PMtall-airline-16756
11/29/2025, 8:42 PMtestcall-local-1 and join as a participant.
• Start your local agent (with a unique AGENT_NAME) — your agent will receive the job for that room if no dispatch rule matches it.
2) LiveKit CLI (manual job/egress)
• Create or join the room via CLI:
◦ Create a participant or start a session that connects to testcall-local-1 (use the playground/your test client to join the room).
• Optionally run egress for that room with the CLI after the local agent joins.
3) Use your SDK or a tiny script (most flexible)
• Run a short script in JS/Python to connect a test participant to `testcall-local-1`:
◦ Ensure the script uses the same LiveKit project credentials as your local agent.
◦ Join the room; once the room exists and your local agent is running, it will be assigned the job.
Checklist to ensure the local agent gets the job
• Room name must NOT start with "call-" (e.g., testcall-local-1).
• Local agent runs with a distinct AGENT_NAME and has .env.local loaded.
• No dispatch rule in cloud matches testcall-local-1.
• Start your local agent before or immediately after joining the test room.
• Add debug logs at session entry to confirm assignment.
If you want, I can give:
• A one‑file Python snippet you can run to join testcall-local-1, or
• Exact Agents Playground instructions (link and UI steps). Which do you prefer?breezy-knife-25008
11/29/2025, 8:51 PMtall-airline-16756
11/29/2025, 8:52 PMhvac-service-agent-local).
1. Open the Agents Playground
• Go to: https://agents-playground.livekit.io/
1. Enter room and identity
• In the Playground UI, set:
◦ Room Name: testcall-local-1
◦ Identity: caller-test (or any string)
1. Connect as the caller
• Click Connect (or Join). Allow microphone access when the browser prompts.
1. Confirm the local agent receives the job
• In your local terminal you should see session-start logs (room name, participant joins) and any debug logs your agent emits.
• If you only see the registration log and no session logs, the room name likely matches a production dispatch rule — ensure it does NOT start with "call-".
1. (Optional) Use your Telnyx number as caller
• To test with a real PSTN caller, have Telnyx/SIP inbound create or join the same room name testcall-local-1. Ensure your production dispatch rules do not match that room name so the cloud agent won’t claim it.
1. Troubleshooting
• If no session logs appear:
◦ Verify AGENT_NAME printed at startup equals your local agent name.
◦ Verify the room name in the LiveKit dashboard matches testcall-local-1.
◦ Ensure no dispatch rule matches testcall-local-1.
◦ Add an explicit debug log at session entry (e.g., log ctx.room.name) to confirm assignment.
Do you want a tiny JS/Python snippet to programmatically join testcall-local-1 instead of using the browser?breezy-knife-25008
11/29/2025, 8:57 PMtall-airline-16756
11/29/2025, 8:57 PMtestcall-local-1 and an identity (e.g., caller-test). Example CLI (if you have lk auth configured):
◦ Create a token via your own helper script or SDK that signs a token for room testcall-local-1 (I can paste a one-line example if you want).
1. Open Agents Playground → choose Manual
• For WebSocket URL use your project WSS URL (e.g., wss://<your-project>.livekit.cloud).
• For Room Token paste the token you generated.
• For Room Name enter testcall-local-1 (must match token).
• Identity: caller-test.
1. Connect from Manual mode
• Click Connect. This will join the exact room testcall-local-1 instead of the auto-playground room.
1. Ensure local agent receives the job
• Start your local agent with unique AGENT_NAME and DEBUG logging before or right after connecting:
uv run python src/agent.py dev --log-level=DEBUG
• Confirm your local agent startup shows that agent_name.
• Because testcall-local-1 does not start with call-, the production dispatch rule will not claim it. Your local agent should be assigned the session and you’ll see session logs (participant joins, egress start, etc.) in your terminal.
1. If you need to test with your Telnyx PSTN caller
• Make sure the inbound SIP/Trunk flow or your test script creates/joins the same testcall-local-1 room (or a non-call- prefixed test room). If the SIP inbound automatically names rooms with call-..., it will trigger the production dispatch rule and be claimed by the deployed agent.
If you want, I’ll provide:
• A one-file Python script to mint a room token for testcall-local-1, or
• Exact CLI/SDK commands for your environment to generate the token.
Which would you like?breezy-knife-25008
11/29/2025, 9:00 PMtall-airline-16756
11/29/2025, 9:00 PMuv run python src/agent.py dev --log-level=DEBUG produces call-level logs locally without touching production.
Summary (one-sentence)
• Create test rooms that do NOT match your production dispatch rule (avoid the "call-" prefix) and run your local agent under a unique agent name; then make calls that land in those test rooms so the cloud won’t assign them to the deployed agent.
Minimal step-by-step (do this exactly)
1. Make your local agent use a distinct agent name
• In .env.local set:
AGENT_NAME=hvac-service-agent-local
• Ensure you load .env.local before initialization (you already did).
1. Start your local agent
• Run:
uv run python src/agent.py dev --log-level=DEBUG
• Confirm startup shows agent_name=hvac-service-agent-local.
1. Use a test room prefix (no prod dispatch)
• Pick a room name that does NOT start with "call-" (example): testcall-local-1
1. Create/join that test room (easy, no token gymnastics)
• Open Agents Playground → Manual.
• For WSS URL use your project WSS (same project as prod).
• For Room Token use the Playground’s built-in token generator (Manual mode will prompt or let you paste a token; if it requires you to generate one, use a tiny helper below).
• Room name: testcall-local-1
• Identity: caller-test
• Connect — this creates the exact room name in the cloud.
1. Make sure production dispatch cannot claim it
• Confirm your production dispatch rule only matches rooms starting with call-. Because testcall-local-1 doesn’t match, the cloud agent won’t claim it.
1. Observe local logs
• After the Playground joins testcall-local-1, your local terminal should show session start logs (room join, participant events, egress starts). Add an explicit debug log at the start of your entrypoint if you want guaranteed visibility:
logger.debug("session started for room=%s worker=%s", ctx.room.name, ctx.worker_id)
Optional: Quick token helper (if Playground prompts for a token)
• Use a tiny server/script to mint a room-scoped token for testcall-local-1 with your project API key/secret. I can paste a one‑file Python example if you want it.
Why this is the common workflow
• Production dispatch rules assign matching rooms to the deployed agent. Using test rooms isolates local runs without changing or disabling production.
• Running locally while joining a non-matching room lets the local worker receive the job and produce full logs while egress and recording still happen in the cloud.
If this still doesn’t show local logs, paste these three small things and I’ll give the exact one-line fix:
• The Agent startup line you see (first 5 lines).
• The exact room name you used (e.g., testcall-local-1).
• A one-line snippet where you log session start (or I’ll show where to add it).
I’ll then give the single command or tiny code line to make it work.breezy-knife-25008
11/29/2025, 9:01 PMtall-airline-16756
11/29/2025, 9:02 PMuv run python src/agent.py dev --log-level=DEBUG gives you full call logs locally without disturbing production. Here’s the simplest, battle-tested setup and the exact doc pages that cover each piece.
Minimal, reliable developer workflow (do these steps)
1) Use a distinct local agent name
• In .env.local set:
AGENT_NAME=hvac-service-agent-local
• Load .env.local before any LiveKit init (use python-dotenv or equivalent).
2) Avoid production dispatch matching
• Keep your production dispatch rule matching "call-" unchanged.
• Use test rooms that do NOT start with "call-" (e.g., testcall-local-1) so the prod agent won’t claim them.
3) Start your local agent
• Run:
uv run python src/agent.py dev --log-level=DEBUG
• Confirm startup shows your local agent name.
4) Create / join the test room manually (so it’s not dispatched to prod)
• Use Agents Playground → Manual mode:
◦ WSS URL: your project WSS (wss://<project>.livekit.cloud)
◦ Room Name: testcall-local-1
◦ Identity: caller-test
◦ Room Token: paste a token you mint (or use the Playground helper)
◦ Connect
• Or run a tiny script to join testcall-local-1 with your SDK.
5) Observe local logs
• Your local terminal will show session start, participant joins, egress starts, etc., because the room name doesn’t match the production dispatch rule and your local worker will be assigned the job.
If you prefer a one-click pattern:
• Use a test prefix (e.g., testcall-) everywhere for dev, and keep prod on call-. Then running uv run ... dev + joining testcall-* always hits your local worker.
Docs that back this up
• Voice AI quickstart / agent CLI modes: https://docs.livekit.io/agents/start/voice-ai/#speak-to-your-agent
• Environment variables / local secrets: https://docs.livekit.io/agents/start/voice-ai/#environment-variables and https://docs.livekit.io/agents/ops/deployment/secrets/
• Agent dispatch (telephony): https://docs.livekit.io/agents/start/telephony/#agent-dispatch
• SIP dispatch rules: https://docs.livekit.io/sip/dispatch-rule/
• Phone numbers & trunks: https://docs.livekit.io/sip/cloud/phone-numbers/
If you want, I can:
• Paste a tiny Python script to mint a room token for testcall-local-1, or
• Give a 1-file script that joins that room automatically from your machine.
Which would you like?
Sources: Voice AI quickstart | LiveKit docs | Deploying to custom environments | LiveKit Docs | Secrets management | LiveKit docs | Agents telephony integration | LiveKit docs | SIP dispatch rule | LiveKit docsbreezy-knife-25008
11/29/2025, 9:08 PMtall-airline-16756
11/29/2025, 9:08 PMlk set up)
1. Create a short JSON file token request (optional) or run:
lk token create --room testcall-local-1 --identity caller-test
1. Copy the token output and paste it into Playground → Manual → Room Token.
B) One-file Python token generator (run locally)
1. Save this as mint_token.py and fill in API_KEY, API_SECRET, and LIVEKIT_URL (your project host, e.g., "your-project.livekit.cloud"):
import jwt
import time
import base64
from urllib.parse import urlparse
API_KEY = "your_api_key"
API_SECRET = "your_api_secret"
ROOM = "testcall-local-1"
IDENTITY = "caller-test"
TTL = 60 * 5
now = int(time.time())
payload = {
"jti": f"token-{now}",
"iat": now,
"exp": now + TTL,
"sub": API_KEY,
"room": ROOM,
"video": False,
"audio": True,
"name": IDENTITY,
"kid": API_KEY
}
token = jwt.encode(payload, API_SECRET, algorithm="HS256")
print(token)
1. Install PyJWT if needed: pip install pyjwt.
2. Run: python mint_token.py
3. Copy the printed token into Playground → Manual → Room Token. Ensure Room Name = testcall-local-1 and Identity = caller-test.
Manual mode fields in Playground
• WSS URL: wss://<your-project>.livekit.cloud (example: wss://myproj.livekit.cloud)
• Room Token: (token you generated)
• Room Name: testcall-local-1
• Identity: caller-test
Order to run for local logs
1. Start local agent: uv run python src/agent.py dev --log-level=DEBUG
2. In Playground → Manual, paste WSS URL and Room Token, set Room Name and Identity, then Connect.
3. Your local agent (with distinct AGENT_NAME) should receive the job and print the session logs locally.
If you want, I can produce a one‑line lk CLI command for your environment or tailor the Python script to read API keys from .env.local. Which do you prefer?breezy-knife-25008
11/29/2025, 9:10 PMtall-airline-16756
11/29/2025, 9:10 PMtestcall-local-1). Your local agent doesn’t create the room; a participant must join it using a room-scoped token. Here are two minimal ways to mint a token you can paste into Playground → Manual.
A) One‑line lk CLI (if you have lk configured)
1. Run:
lk token create --room testcall-local-1 --identity caller-test
1. Copy the token output into Playground → Manual → Room Token, set Room Name = testcall-local-1, Identity = caller-test, WSS = your project wss URL.
B) Tiny Python script that reads keys from .env.local
1. Save as mint_token.py next to your .env.local (fills API key/secret from env):
# mint_token.py
import os, time, jwt
from dotenv import load_dotenv
load_dotenv(".env.local")
API_KEY = os.getenv("LIVEKIT_API_KEY")
API_SECRET = os.getenv("LIVEKIT_API_SECRET")
ROOM = "testcall-local-1"
IDENTITY = "caller-test"
TTL = 60*5
now = int(time.time())
payload = {
"jti": f"token-{now}",
"iat": now,
"exp": now + TTL,
"sub": API_KEY,
"room": ROOM,
"name": IDENTITY,
"video": False,
"audio": True
}
print(jwt.encode(payload, API_SECRET, algorithm="HS256"))
1. Install deps: pip install pyjwt python-dotenv
2. Run: python mint_token.py — copy printed token into Playground → Manual.
Order to test
1. Start your local agent: uv run python src/agent.py dev --log-level=DEBUG
2. Open Playground → Manual, paste WSS URL, Room Token, Room Name = testcall-local-1, Identity = caller-test, Connect.
3. Your local agent (with unique AGENT_NAME) should receive the job and print full session logs.
If you want, tell me which method you prefer and I’ll adapt the script to your .env.local keys or give the exact lk command for your project.breezy-knife-25008
11/29/2025, 9:17 PMtall-airline-16756
11/29/2025, 9:17 PMtestcall-local-1) instead of call_*.
• How: modify whatever creates the room for the SIP inbound (your SIP->LiveKit mapping or webhook) so it uses a test room name or prefix that does NOT match "call-".
Result: the cloud dispatch rule will not match, your local worker will be assigned, and you’ll see full local logs.
2) Create a test dispatch rule that targets your local agent name
• Add a temporary dispatch rule that routes a specific test phone number (or a specific rule matching a header) to hvac-service-agent-local only.
• Use that test phone number to call. This keeps prod untouched and forces the job to your local worker.
Result: inbound call lands on your local worker.
3) Manually create the room the inbound flow would use, then bridge the SIP call into that same room
• Create/join testcall-local-1 first (Playground or token), then make the SIP incoming call join that room (adjust your SIP->LiveKit integration/webhook to target that exact room).
Result: both caller and local agent are in same room and local logs appear.
4) Temporarily disable/rename the prod dispatch rule (quick test)
• If safe, temporarily remove or rename the prod rule so calls aren’t auto-claimed by the cloud agent, then call your number.
Result: inbound calls become eligible for your local agent.
Quick verification steps you can run now
1. Start local agent: uv run python src/agent.py dev --log-level=DEBUG
2. In Playground Manual, join testcall-local-1 (WSS + token). Confirm local terminal shows session start logs.
3. Try to make the same inbound number join that exact room (change your SIP mapping/webhook to use that room name). If you can’t change SIP mapping, use option 2 and add a test dispatch rule for one test number.
If you want, tell me:
• Which option you prefer (1–4) and whether you can change the SIP->room mapping or add a temporary dispatch rule.
I’ll give the exact one-line CLI or config change to make that option work.breezy-knife-25008
11/29/2025, 11:47 PMtall-airline-16756
11/29/2025, 11:47 PMbreezy-knife-25008
11/29/2025, 11:48 PM