Skip to content

API Reference parrot.services.client

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

parrot.services.client

View source

Client for submitting tasks to AgentService via Redis Streams.

Class AgentServiceClient

Async client for submitting tasks to a running AgentService.

Publishes tasks to a Redis Stream and optionally waits for results on the response stream.

Usage::

async with AgentServiceClient("redis://localhost:6379") as client:
    task_id = await client.submit_task(
        AgentTask(agent_name="MyAgent", prompt="Hello")
    )
    result = await client.get_result(task_id, timeout=30)
Parameter Type Default Description
redis_url str 'redis://localhost:6379'
redis_db int 0
task_stream str 'parrot:agent_tasks'
result_stream str 'parrot:agent_results'

Method AgentServiceClient.connect

Connect to Redis.

connect() -> None

Method AgentServiceClient.disconnect

Disconnect from Redis.

disconnect() -> None

Method AgentServiceClient.submit_task

Publish a task to the AgentService task stream.

submit_task(task: AgentTask) -> str

Parameter Type Default Description
task AgentTask The agent task to submit.

Returns: str — The task ID.

Method AgentServiceClient.get_result

Wait for a task result on the response stream.

Polls the result stream for a matching task_id. This is a simple polling implementation suitable for occasional use.

get_result(task_id: str, timeout: float = 60.0) -> Optional[TaskResult]

Parameter Type Default Description
task_id str Task ID to wait for.
timeout float 60.0 Maximum seconds to wait.

Returns: Optional[TaskResult] — TaskResult if found within timeout, None otherwise.

Method AgentServiceClient.submit_and_wait

Submit a task and wait for its result.

Convenience method combining submit_task and get_result.

submit_and_wait(task: AgentTask, timeout: float = 60.0) -> Optional[TaskResult]

Parameter Type Default Description
task AgentTask The agent task to submit.
timeout float 60.0 Maximum seconds to wait for result.

Returns: Optional[TaskResult] — TaskResult if completed within timeout.

Alias AgentTask

Re-exported from parrot.services.models.AgentTask.

Alias TaskResult

Re-exported from parrot.services.models.TaskResult.

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