is a python gent has option supports both `PROCESS...
# ask-ai
s
is a python gent has option supports both
PROCESS
and
THREAD
t
Thanks for reaching out, Rahul. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Thanks — I want to make sure I answer the right question. When you say "python gent", do you mean: • a specific Python client/library (for example a LiveKit Python client), • a command-line tool or generator named "gent", or • did you mean "agent" or another package name? Also, when you say "supports both
PROCESS
and `THREAD`" do you mean: • an option to choose a concurrency model for background work (multiprocessing vs threading), • a setting in a client for how media/IO is handled, or • something else? If you confirm the exact package/tool and the area you're referring to (installation, runtime option, client config, etc.), I’ll tell you whether that option exists and how to enable it or offer the closest alternative.
s
i mean agent created in python , is it have option to use python process or thread
t
Thanks — regarding a Python agent: job execution is process-based. Each job runs in its own Python process (the framework spawns a subprocess per job) so you cannot switch the agent's job-level model to use threads instead of processes. You can, however, use threads or asyncio inside a single job/process for concurrency (for example to handle background tasks or multiple streams). You can also tune process behavior with options like
num_idle_processes
and a
prewarm
function to prepare processes before they accept jobs. Would you like instructions for using threads/async inside a job or help tuning `num_idle_processes`/prewarm settings? Sources: Deploying to custom environments | LiveKit docs | Agent server options | LiveKit docs | Job lifecycle | LiveKit docs
s
but in workers code its shows, @dataclass class WorkerPermissions: can_publish: bool = True can_subscribe: bool = True can_publish_data: bool = True can_update_metadata: bool = True can_publish_sources: list[models.TrackSource] = field(default_factory=list) hidden: bool = False if sys.platform.startswith("win"): # Some python versions on Windows gets a BrokenPipeError when creating a new process _default_job_executor_type = JobExecutorType.THREAD else: _default_job_executor_type = JobExecutorType.PROCESS T = TypeVar("T")
t
You're right to point to that snippet — it shows how the agent chooses the job executor. • The agent defaults to
JobExecutorType.THREAD
on Windows because some Python versions on Windows can raise a
BrokenPipeError
when creating new processes. • On non‑Windows platforms it defaults to
JobExecutorType.PROCESS
so each job runs in its own subprocess for isolation. You can still use threading or asyncio inside a single job/process for concurrency. If you want to override the default executor type (for example force processes on Windows or threads elsewhere), do you want instructions for where and how to set that in your agent configuration? Sources: Agent server options | LiveKit docs
s
job_executor_type: JobExecutorType = _default_job_executor_type """Which executor to use to run jobs. (currently thread or process are supported)"""
t
You're correct — the agent exposes
job_executor_type
with two options:
JobExecutorType.PROCESS
and
JobExecutorType.THREAD
. • What they mean ◦ PROCESS: each job runs in its own subprocess (strong isolation; a crash in one job won't take down others). ◦ THREAD: jobs run on threads within the same process (less isolation, but avoids process-creation issues on some platforms). • Defaults ◦ On Windows the agent defaults to
JobExecutorType.THREAD
because some Python versions on Windows can raise
BrokenPipeError
when spawning processes. ◦ On non-Windows platforms the default is
JobExecutorType.PROCESS
. • How to configure ◦ Set
job_executor_type
on your agent configuration to one of the enum values. Example:
Copy code
from your_agent_module import JobExecutorType, AgentConfig

    cfg = AgentConfig(
      job_executor_type=JobExecutorType.PROCESS  # or JobExecutorType.THREAD
    )
• Remember that forcing
PROCESS
on Windows may trigger the process-creation issues the default avoids. Inside a job (regardless of executor) you can still use threads or asyncio for concurrency. Would you like a snippet showing where to pass this config when constructing the agent in your code?