Skip to content

API Reference parrot_tools.flowtask.tool

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

parrot_tools.flowtask.tool

View source

FlowtaskToolkit for AI-Parrot - Execute Flowtask components and tasks dynamically.

This toolkit provides tools for:

  • Running individual Flowtask components with custom input data
  • Executing local Flowtask tasks
  • Calling remote Flowtask API endpoints
  • Running tasks from JSON/YAML code definitions

flowtask is an optional dependency. Install with: pip install ai-parrot[flowtask]

Class FlowtaskCodeExecutionInput

Input schema for code_execution tool.

Fields:

Field Type Default Description
task_code str The task definition as JSON or YAML string
format TaskCodeFormat TaskCodeFormat.YAML Format of the task code: 'json' or 'yaml'

Class FlowtaskComponentInput

Input schema for component_call tool.

Fields:

Field Type Default Description
component_name str Name of the Flowtask component to execute (e.g., 'GooglePlaces', 'GoogleGeoCoding')
attributes Dict[str, Any] Dictionary of attributes to pass to the component (e.g., {'use_proxies': True, 'type': 'traffic'})
input_data Union[Dict[str, Any], List[Dict[str, Any]], str] Input data for the component - can be a dictionary, list of dictionaries, or JSON string
structured_output Optional[Dict[str, Any]] None Optional structured output schema to format the results
return_as_dataframe bool False Whether to return the result as a pandas DataFrame (if possible)

Class FlowtaskListTasksInput

Input schema for list_tasks tool (task discovery).

Fields:

Field Type Default Description
program Optional[str] None Program name to filter tasks. If None, lists all programs/tasks.
fields Optional[List[str]] None Specific fields to return (e.g., ['task', 'task_id', 'description'])
timeout float 60.0 Timeout in seconds for the API call

Class FlowtaskRemoteExecutionInput

Input schema for remote_execution tool.

Fields:

Field Type Default Description
program str Program name/slug for the task
task_name str Name of the task to execute
long_running bool False If True, task is enqueued and returns immediately with status. If False, waits for task completion.
timeout float 300.0 Timeout in seconds for the API call (only applies when long_running=False)
max_retries int 3 Maximum number of retry attempts on failure
backoff_factor float 1.0 Backoff factor for exponential retry delay (delay = backoff_factor * 2^attempt)

Class FlowtaskTaskExecutionInput

Input schema for task_execution tool.

Fields:

Field Type Default Description
program str Program name/slug for the task (e.g., 'nextstop', 'test')
task_name str Name of the task to execute (e.g., 'employees_report')
debug bool True Whether to run in debug mode
storage str 'default' Task storage backend (e.g., 'default', 'private', 'row')
variables Optional[Dict[str, Any]] None Variables passed between task steps
attributes Optional[Dict[str, Any]] None Root-level component attributes
params Optional[Dict[str, Any]] None Parameters passed to all task components
ignore_steps Optional[List[str]] None List of component names to skip during execution
run_only Optional[List[str]] None If set, execute only these components

Class FlowtaskTaskServiceInput

Input schema for task_service tool (synchronous REST execution).

Fields:

Field Type Default Description
program str Program name/slug for the task (e.g., 'nextstop', 'walmart')
task_name str Name of the task to execute
method str 'GET' HTTP method: 'GET' or 'POST'
params Optional[Dict[str, Any]] None Query parameters or JSON body parameters for the task
timeout float 300.0 Timeout in seconds for the API call

Attribute FlowtaskTool

Class FlowtaskToolkit

Toolkit for executing Flowtask components and tasks dynamically.

This toolkit provides multiple tools for:

  • Running individual Flowtask components with custom input data
  • Executing local Flowtask tasks by program/task name
  • Calling remote Flowtask API endpoints
  • Running tasks from JSON/YAML code definitions
Parameter Type Default Description
**kwargs {}

Method FlowtaskToolkit.flowtask_component_call

Execute a single Flowtask component with custom input data and attributes.

This tool imports and runs any Flowtask component dynamically, allowing flexible data processing with custom configurations.

flowtask_component_call(component_name: str, input_data: Union[Dict[str, Any], List[Dict[str, Any]], str], attributes: Optional[Dict[str, Any]] = None, structured_output: Optional[Dict[str, Any]] = None, return_as_dataframe: bool = False) -> Dict[str, Any]

Parameter Type Default Description
component_name str
input_data Union[Dict[str, Any], List[Dict[str, Any]], str]
attributes Optional[Dict[str, Any]] None
structured_output Optional[Dict[str, Any]] None
return_as_dataframe bool False

Returns: Dict[str, Any]

Method FlowtaskToolkit.flowtask_task_execution

Execute a Flowtask Task locally by program and task name.

This runs the task using the local Flowtask Task instance, which processes the DAG-based workflow defined in the task configuration.

flowtask_task_execution(program: str, task_name: str, debug: bool = True, storage: str = 'default', variables: Optional[Dict[str, Any]] = None, attributes: Optional[Dict[str, Any]] = None, params: Optional[Dict[str, Any]] = None, ignore_steps: Optional[List[str]] = None, run_only: Optional[List[str]] = None) -> Dict[str, Any]

Parameter Type Default Description
program str
task_name str
debug bool True
storage str 'default'
variables Optional[Dict[str, Any]] None
attributes Optional[Dict[str, Any]] None
params Optional[Dict[str, Any]] None
ignore_steps Optional[List[str]] None
run_only Optional[List[str]] None

Returns: Dict[str, Any]

Method FlowtaskToolkit.flowtask_remote_execution

Execute a Flowtask Task remotely via the Flowtask API (Task Launcher).

Calls the Flowtask Launcher endpoint to run a task. If long_running is True, the task is enqueued and returns immediately with status. Otherwise, waits for task completion.

Uses exponential backoff retry on transient failures.

flowtask_remote_execution(program: str, task_name: str, long_running: bool = False, timeout: float = 300.0, max_retries: int = 3, backoff_factor: float = 1.0) -> Dict[str, Any]

Parameter Type Default Description
program str
task_name str
long_running bool False
timeout float 300.0
max_retries int 3
backoff_factor float 1.0

Returns: Dict[str, Any]

Method FlowtaskToolkit.flowtask_code_execution

Execute a Flowtask Task from a JSON or YAML code definition.

This allows running ad-hoc task definitions without requiring them to be saved as files. The task code should follow the standard Flowtask task definition format with name, description, and steps.

flowtask_code_execution(task_code: str, format: TaskCodeFormat = TaskCodeFormat.YAML) -> Dict[str, Any]

Parameter Type Default Description
task_code str
format TaskCodeFormat TaskCodeFormat.YAML

Returns: Dict[str, Any]

Method FlowtaskToolkit.flowtask_task_service

Execute a Flowtask Task via the Task Service REST API (synchronous).

Calls /api/v2/services/tasks/{program}/{task_name} which executes the task synchronously and returns the result directly. Supports both GET (params as query string) and POST (params as JSON body).

flowtask_task_service(program: str, task_name: str, method: str = 'GET', params: Optional[Dict[str, Any]] = None, timeout: float = 300.0) -> Dict[str, Any]

Parameter Type Default Description
program str
task_name str
method str 'GET'
params Optional[Dict[str, Any]] None
timeout float 300.0

Returns: Dict[str, Any]

Method FlowtaskToolkit.flowtask_list_tasks

List available Flowtask tasks for a given program.

Calls /api/v2/tasks/{program} to discover available tasks and their metadata. Useful for finding which tasks can be executed.

flowtask_list_tasks(program: Optional[str] = None, fields: Optional[List[str]] = None, timeout: float = 60.0) -> Dict[str, Any]

Parameter Type Default Description
program Optional[str] None
fields Optional[List[str]] None
timeout float 60.0

Returns: Dict[str, Any]

Method FlowtaskToolkit.list_known_components

Get a list of known Flowtask components.

list_known_components() -> List[str]

Returns: List[str] — List of component names

Method FlowtaskToolkit.add_known_component

Add a component to the known components list.

add_known_component(component_name: str) -> None

Parameter Type Default Description
component_name str Name of the component to add

Method FlowtaskToolkit.clear_component_cache

Clear the component import cache.

clear_component_cache() -> None

Class TaskCodeFormat

Format of the task code.

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