Is there any hooks that I can use call an internal...
# ask-ai
b
Is there any hooks that I can use call an internal api when worker is registered after running voice agent
t
Thanks for reaching out, Ambuj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Regarding calling an internal API when a worker is registered after running a voice agent — yes. Use the agent's entrypoint (the function run when a worker accepts a job) to invoke your API. • Python example: decorate an entrypoint with
@agents.rtc_session()
and call your API inside before/after
ctx.connect()
or session start. • Node.js example: in
defineAgent({ entry: async (ctx: JobContext) => { ... } })
call your API inside the
entry
function before continuing with
ctx.connect()
and creating the
AgentSession
. Would you like a short code snippet for your preferred runtime (Python or Node.js) showing where to place the API call? Sources: Agent server options | LiveKit docs
b
I want a hook when a worker is registered. Example - 2025-12-12 131926,592 - INFO livekit.agents - registered worker {"id": "AW_xFqSCpY5UWkW", "url": "wss://sigma-ai-xxxxxxxxxxxxxx.livekit.cloud", "region": "India South", "protocol": 16}
t
Thanks — you're asking for a hook that fires exactly when a worker is registered (the log line you showed). Short answer: there is no built-in worker-registered callback you can subscribe to. What you can do instead: • Call your internal API from your agent process at startup, just before/after you call
agents.run_app(worker)
(Python) or inside the `entry`/startup code of your agent (Node.js). That moment corresponds to when the worker connects and registers. • Or emit the call from your job handler the first time it receives a job if you need to wait until the worker is fully ready to handle jobs. • If you need an out-of-process solution, tail/forward agent logs (the "registered worker" log line) and trigger your internal API from your logging/observability pipeline. If you want, tell me whether you use Python or Node.js and I’ll show a 3–6 line snippet showing exactly where to place the API call. Sources: server-sdk-js | livekit/livekit_composite | DeepWiki | client-sdk-js | livekit/livekit_composite | DeepWiki | Agents Framework | livekit/livekit_composite | DeepWiki