Skip to content

API Reference parrot.services.worker_pool

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.services.worker_pool

View source

Bounded async worker pool for concurrent agent execution.

Class WorkerPool

Limits concurrent agent executions using an asyncio semaphore.

Parameter Type Default Description
max_workers int 10

Attributes:

Attribute Type Description
active_count int Number of currently executing tasks.
available_slots int Number of available worker slots.

Method WorkerPool.submit

Submit a coroutine for execution within the bounded pool.

submit(coro: Coroutine[Any, Any, Any], name: Optional[str] = None) -> asyncio.Task

Parameter Type Default Description
coro Coroutine[Any, Any, Any] Coroutine to execute.
name Optional[str] None Optional task name for debugging.

Returns: asyncio.Task — The created asyncio.Task.

Method WorkerPool.shutdown

Gracefully shut down the worker pool.

Waits for active tasks up to timeout seconds, then cancels remaining.

shutdown(timeout: float = 30.0) -> None

Parameter Type Default Description
timeout float 30.0

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally