did livekit release agent server recently?? like w...
# ask-ai
b
did livekit release agent server recently?? like we used the entrypoint and worker func which was registered to livekit server for our calling now i am seeing AgentServer as another module, could u explain
t
Thanks — great question. I’ll explain what changed and how
AgentServer
fits with the entrypoint/worker pattern you were using. Short answer • Yes: LiveKit introduced the
AgentServer
module as part of the Agents framework. It doesn’t eliminate your entrypoint/worker logic; it provides a centralized server abstraction that registers and manages those entrypoints/workers for safer, more scalable production use. Why AgentServer was added (what it solves) • Lifecycle & isolation:
AgentServer
spawns isolated processes for each job/session so one crash won’t take down others. • Prewarming: You can load heavy models once per process (reduce cold starts) via setup/prewarm hooks. • Job dispatch & control: It centralizes job acceptance/rejection, load/dispatch rules, and lifecycle hooks. • Cleaner registration: Instead of manually registering functions with the server, you attach entrypoints to the AgentServer instance (decorators/registration on the server). • Production readiness: Easier shutdown handling, observability points, and consistent job lifecycle management. How it relates to the entrypoint/worker pattern • You still write your entrypoint and worker logic the same way. The difference is how they are registered and managed: ◦ Old pattern: You wrote an entrypoint/worker and registered it directly with LiveKit server logic. ◦ New pattern: You create an
AgentServer
instance and register the entrypoint on it (e.g.,
@server.rtc_session()
), and optionally add a
setup_fnc
to prewarm models or add shutdown hooks. The server handles spawning, lifecycle, and dispatch for you. Minimal example • Before: plain
entrypoint(ctx: JobContext)
registered directly. • Now:
Copy code
server = AgentServer()

  def prewarm(proc: JobProcess):
      proc.userdata["vad"] = load_vad_model()

  server.setup_fnc = prewarm

  @server.rtc_session()
  async def entrypoint(ctx: JobContext):
      vad = ctx.proc.userdata["vad"]
      session = AgentSession(vad=vad, ...)
      await session.start(...)
Is migration required? • Not strictly required, but AgentServer is recommended for production: better isolation, lower latency via prewarming, and more robust lifecycle controls. You can migrate incrementally—keep your entrypoint logic and register it with an AgentServer to gain the benefits. If you want, I can: • Help refactor a specific entrypoint/worker to use AgentServer (paste a snippet, remove secrets). • Show how to add a
setup_fnc
to prewarm models for your workload. • Explain how this integrates with calls/SIP flows you mentioned. Which would you prefer — a migration example for an existing script, or a checklist to convert a worker to
AgentServer
? Sources: Simple Call Answering Agent | LiveKit Documentation | Job lifecycle | LiveKit Documentation | Server options | LiveKit Documentation