Agent.__init__() got an unexpected keyword argumen...
# ask-ai
c
Agent.__init__() got an unexpected keyword argument 'entrypoint_fnc' {"message": "Error in entrypoint: Agent.__init__() got an unexpected keyword argument 'entrypoint_fnc'", "level": "ERROR", "name": "__main__", "timestamp": "2025-10-08T213206.384144+00:00"} ERRORlivekit.agentsunhandled exception while running the job task Traceback (most recent call last): File "C:\Users\KC\AppData\Local\Programs\Python\Python313\Lib\site-packages\opentelemetry\util\_decorator.py", line 71, in async_wrapper return await func(*args, **kwargs) # type: ignore ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\KC\AppData\Local\Programs\Python\Python313\Lib\site-packages\livekit\agents\ipc\job_proc_lazy_main.py", line 240, in _traceable_entrypoint await self._job_entrypoint_fnc(job_ctx) File "C:\Users\KC\Desktop\project\Restaurant_template_voice_agent\voice_agent.py", line 616, in entrypoint assistant = Agent( entrypoint_fnc=restaurant_agent.get_system_prompt(), ...<9 lines>... ] ) TypeError: Agent.__init__() got an unexpected keyword argument 'entrypoint_fnc' {"message": "unhandled exception while running the job task", "level": "ERROR", "name": "livekit.agents", "exc_info": "Traceback (most recent call last):\n File \"C:\\Users\\KC\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\opentelemetry\\util\\_decorator.py\", line 71, in async_wrapper\n return await func(*args, **kwargs) # type: ignore\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"C:\\Users\\KC\\AppData\\Local\\Programs\\Python\\Python313\\Lib\\site-packages\\livekit\\agents\\ipc\\job_proc_lazy_main.py\", line 240, in _traceable_entrypoint\n await self._job_entrypoint_fnc(job_ctx)\n File \"C:\\Users\\KC\\Desktop\\project\\Restaurant_template_voice_agent\\voice_agent.py\", line 616, in entrypoint\n assistant = Agent(\n entrypoint_fnc=restaurant_agent.get_system_prompt(),\n ...<9 lines>...\n ]\n )\nTypeError: Agent.__init__() got an unexpected keyword argument 'entrypoint_fnc'", "timestamp": "2025-10-08T213206.385266+00:00"}
t
Thanks for reaching out, Hai. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
The error you're seeing happens because the
entrypoint_fnc
parameter isn't valid for the
Agent
class constructor. Instead, it's meant to be used with the
WorkerOptions
class when you start a LiveKit agent worker process. To help you fix this, here are some friendly steps: 1. Make sure that
entrypoint_fnc
is used only with
WorkerOptions
and not directly with the
Agent
class. 2. Update your code so that
entrypoint_fnc
is passed to
cli.run_app(WorkerOptions(entrypoint_fnc=...))
. Here's a simple example to guide you:
Copy code
async def entrypoint(ctx: JobContext):
    # Initialize and start your agent here
    agent = MyAgent()
    session = AgentSession()
    await session.start(agent=agent, room=ctx.room)

if __name__ == "__main__":
    cli.run_app(WorkerOptions(entrypoint_fnc=entrypoint))  # Correct usage
Also, remember to pass agent-specific parameters like
instructions
,
stt
,
llm
,
tts
, and others directly to the
Agent
constructor. Reserve
entrypoint_fnc
just for
WorkerOptions
. If anything is unclear or you want to walk through this together, please don’t hesitate to ask. I’m here to help! Sources: delay-handling/agent.py | Worker options | LiveKit Docs | basics/repeater.py