Skip to content

API Reference parrot.tools.executors.k8s

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

parrot.tools.executors.k8s

View source

Kubernetes-backed remote tool executor.

Submits the envelope as a single-shot batch/v1 Job running the parrot-tools image. The image's entrypoint is python -m parrot.cli.tool_worker --envelope - which reads the envelope JSON from stdin and prints the resulting ToolResult JSON to stdout. The executor tails the pod's logs to read that result, then deletes the Job so Kubernetes reclaims the pod.

This module's heavy dependency (kubernetes_asyncio) is only imported when an executor instance is constructed, so projects that never use the K8s executor are not forced to install the client.

Alias AbstractToolExecutor

Re-exported from parrot.tools.executors.abstract.AbstractToolExecutor.

Class K8sToolExecutor

Runs the envelope inside an ephemeral Kubernetes Job.

Parameter Type Default Description
image Optional[str] None Container image that ships parrot.cli.tool_worker. Defaults to :data:parrot.conf.K8S_TOOL_IMAGE.
namespace Optional[str] None Kubernetes namespace in which to create the Job. Defaults to :data:parrot.conf.K8S_NAMESPACE.
kubeconfig_path Optional[str] None Path to a kubeconfig file. When None, the executor first tries in-cluster config (so it works from a pod with a ServiceAccount), then falls back to ~/.kube/config.
ttl_seconds_after_finished Optional[int] None ttlSecondsAfterFinished for the Job. Defaults to 60s so Kubernetes garbage-collects the pod shortly after we read its result.
resources Optional[Dict[str, Dict[str, str]]] None Optional resources.limits / requests block to attach to the pod. Defaults to a small slice (500m CPU, 512Mi memory) so unattended tools can't balloon the cluster.
env Optional[Dict[str, str]] None Extra environment variables to inject into the pod.
image_pull_secrets Optional[List[str]] None Names of K8s secrets for private registries.
service_account Optional[str] None ServiceAccount name the pod runs as.
labels Optional[Dict[str, str]] None Extra labels stamped on the Job/Pod (merged with the executor's standard parrot-executor=true label).
log_poll_interval_seconds float 1.0 How often to poll the pod's logs while waiting for the worker to finish. Defaults to 1s.

Method K8sToolExecutor.execute

execute(envelope: ToolExecutionEnvelope) -> 'ToolResult'

Parameter Type Default Description
envelope ToolExecutionEnvelope

Returns: 'ToolResult'

Method K8sToolExecutor.close

close() -> None

Alias ToolExecutionEnvelope

Re-exported from parrot.tools.executors.abstract.ToolExecutionEnvelope.

Alias ToolResult

Re-exported from parrot.tools.abstract.ToolResult.

Attribute logger

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