proud-whale-10574
08/20/2025, 10:04 PMtall-airline-16756
08/20/2025, 10:04 PMtall-airline-16756
08/20/2025, 10:06 PMentrypoint_fn and agent_name combos. Each worker is meant to have one entrypoint function and, if you want, one agent name.
If you want to run different agents with their own entrypoint functions and agent names, the best way is to create separate worker processes—each with its own specific entrypoint_fn and agent_name.
Here’s a simple example:
• Worker 1 - Customer Service Agent:
async def customer_service_entrypoint(ctx: JobContext):
# Customer service specific logic
pass
if __name__ == "__main__":
cli.run_app(
WorkerOptions(
entrypoint_fnc=customer_service_entrypoint,
agent_name="customer-service-agent",
)
)
• Worker 2 - Sales Agent:
async def sales_entrypoint(ctx: JobContext):
# Sales specific logic
pass
if __name__ == "__main__":
cli.run_app(
WorkerOptions(
entrypoint_fnc=sales_entrypoint,
agent_name="sales-agent",
)
)
Once you have these workers up and running, you can dispatch the right agent using the AgentDispatchService like this:
# Dispatch customer service agent
await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="customer-service-agent",
room=room_name,
metadata="customer_service_job"
)
)
# Dispatch sales agent
await lkapi.agent_dispatch.create_dispatch(
api.CreateAgentDispatchRequest(
agent_name="sales-agent",
room=room_name,
metadata="sales_job"
)
)
This way, everything stays nicely separated and flexible for your different agent types. If you want me to walk you through anything else or have questions, just let me know—I’m here to help!