i want to get the log of all the worker options co...
# ask-ai
a
i want to get the log of all the worker options configuration used within the code. how to get that logs?
✅ 1
t
Thanks for reaching out, Harshita. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — you want logs of all worker options configuration used in your code. I can help with that. Short answer: there’s no automatic full dump of worker options; you need to emit those option values yourself from your agent code and then view the logs (CLI, dashboard, or external sink). What to do (quick steps): 1. Log option values at startup/entrypoint ◦ In your agent entrypoint, add a log or set
ctx.log_context_fields
to include the worker configuration you care about (e.g.,
worker_id
,
room_name
,
drain_timeout
,
permissions
,
load_threshold
, any custom options). ◦ Example pattern:
Copy code
@server.rtc_session(agent_name="my-agent")
     async def my_agent(ctx: JobContext):
         ctx.log_context_fields = {
             "worker_id": ctx.worker_id,
             "room_name": ctx.room.name,
             "drain_timeout": my_worker_options.drain_timeout,
             "permissions": my_worker_options.permissions,
             "load_threshold": my_worker_options.load_threshold,
         }
         ctx.log.info("worker options logged", extra=ctx.log_context_fields)
1. Increase verbosity if needed ◦ Set
--log-level=DEBUG
or
LIVEKIT_LOG_LEVEL=DEBUG
to capture more detailed logs. 1. Retrieve logs ◦ Stream live logs with the CLI:
lk agent logs --id <agent-id>
. ◦ View stored logs in the cloud dashboard under Agent insights → Logs (note: logs for completed sessions are not real-time and are retained for a limited time). ◦ Forward logs to an external service (Datadog, CloudWatch, Sentry, New Relic) by configuring the appropriate secret/integration if you want centralized storage/retention. If you want, tell me: • which runtime (Python or Node) and agent SDK version you’re using, and • the exact worker options you need logged (list them), and I’ll give you the exact snippet and the recommended place to add it. Sources: Job lifecycle | LiveKit Documentation | Where to find your Agent Logs | LiveKit | Server options | LiveKit Documentation, with interactive elements
a
i want to get the log of all the worker options configurations used within the code via entrypoint . how to get that logs?
t
Thanks — you're asking how to capture all worker option values from your agent's entrypoint. Below are concise steps and a Python example you can drop into your entrypoint to emit those values to logs. Steps 1. In the entrypoint, collect the worker option values you care about (built-in and any custom options). 2. Add them to
ctx.log_context_fields
so they become structured fields in JSON logs. 3. Optionally log a message with those fields using
ctx.log
. 4. Increase verbosity with
--log-level=DEBUG
or
LIVEKIT_LOG_LEVEL=DEBUG
if you need more detail. 5. Retrieve logs via
lk agent logs --id <agent-id>
, the cloud dashboard (Agent insights → Logs), or forward to Datadog/CloudWatch/Sentry/New Relic. Python example (entrypoint)
Copy code
@server.rtc_session(agent_name="my-agent")
async def my_agent(ctx: JobContext):
    # Gather worker option values (replace with your actual option sources)
    worker_options = {
        "worker_id": ctx.worker_id,
        "room_name": getattr(ctx.room, "name", None),
        "drain_timeout": getattr(ctx, "drain_timeout", None),
        "permissions": getattr(ctx, "permissions", None),
        "load_threshold": getattr(ctx, "load_threshold", None),
        # add any custom options here
    }

    # Add structured fields to logs
    ctx.log_context_fields = worker_options

    # Emit a log line that includes those fields
    ctx.log.info("Worker options at entrypoint", extra=worker_options)

    # ...rest of your agent logic...
Notes • There is no automatic full dump of all worker options — you must enumerate and log the ones you want. • If you want persistent central storage or longer retention, forward logs to an external service. Tell me your SDK (Python or Node) and which exact worker options you need logged and I’ll provide a tailored snippet. , with interactive elements
a
how to get worker information in livekit entrypint
t
You want to access worker information from your LiveKit agent entrypoint. Below are what you can read from the entrypoint and a concise Python and Node example showing common fields to log. What you can access in the entrypoint • Worker identity:
ctx.worker_id
• Room/job info:
ctx.room
(e.g.,
ctx.room.name
) and job metadata on
ctx.job
where available • Shared prewarm/worker state:
ctx.proc.userData
(store/retrieve data between
prewarm
and
entry
) • Add structured log fields:
ctx.log_context_fields
to include worker info in JSON logs Python example (entrypoint)
Copy code
@server.rtc_session(agent_name="my-agent")
async def my_agent(ctx: JobContext):
    # worker + job info
    info = {
        "worker_id": ctx.worker_id,
        "room_name": getattr(ctx.room, "name", None),
        "job_id": getattr(ctx, "job", None) and ctx.job.id,
        "proc_user_data": getattr(ctx.proc, "userData", None),
    }

    # attach structured fields and emit a log line
    ctx.log_context_fields = info
    ctx.log.info("entrypoint worker info", extra=info)

    # rest of agent...
Node (TypeScript) pattern
Copy code
export default defineAgent({
  async entry(ctx: JobContext) {
    const info = {
      worker_id: ctx.worker_id,
      room_name: ctx.room?.name,
      job_id: ctx.job?.id,
      proc_user_data: ctx.proc?.userData,
    };

    ctx.log_context_fields = info;
    ctx.log.info("entrypoint worker info", info);
  }
});
Retrieving the logs • Stream live logs:
lk agent logs --id <agent-id>
• Cloud dashboard: Agent insights → Logs • Or forward to Datadog/CloudWatch/Sentry/NewRelic for centralized retention If you tell me your SDK (Python or Node) and the exact worker fields you want (e.g.,
drain_timeout
,
permissions
, custom options), I’ll return a ready-to-drop snippet that logs every requested option. Sources: Agents (Node.js) | livekit/livekit_composite | DeepWiki | Job lifecycle | LiveKit Documentation | Server options | LiveKit Documentation, with interactive elements