roboto.domain.actions.action
Module Contents
Action
A reusable function to process, transform or analyze data in Roboto.
Actions are containerized functions that can be invoked to process datasets, files, or other data sources within the Roboto platform. They encapsulate processing logic, dependencies, and compute requirements, making data processing workflows reproducible and scalable.
Actions can be created, updated, invoked, and managed through this class. They support parameterization, inheritance from other actions, and can be triggered automatically based on events or conditions.
An Action consists of:
- Container image and execution parameters
- Input/output specifications
- Compute requirements (CPU, memory, etc.)
- Parameters that can be customized at invocation time
- Metadata and tags for organization
Actions are owned by organizations and can have different accessibility levels (private to organization or public in the Action Hub).
Parameters
roboto_client Optional[roboto.Properties
Action.accessibility
The accessibility level of this action (Organization or ActionHub).
Action.compute_requirements
The compute requirements (CPU, memory) for running this action.
Action.container_parameters
The container parameters including image URI and execution settings.
Action.create()
Create a new action in the Roboto platform.
Creates a new action with the specified configuration. The action will be owned by the caller’s organization and can be invoked to process data.
Parameters
name strUnique name for the action within the organization.
compute_requirements Optional[roboto.CPU, memory, and other compute specifications.
container_parameters Optional[roboto.Container image URI, entrypoint, and environment variables.
description Optional[str]Detailed description of what the action does.
inherits Optional[roboto.Reference to another action to inherit configuration from.
metadata Optional[dict[str, Any]]Custom key-value metadata to associate with the action.
parameters Optional[list[roboto.List of parameters that can be provided at invocation time.
requires_downloaded_inputs Optional[bool]Whether input files should be downloaded before execution.
short_description Optional[str]Brief description (max 140 characters) for display purposes.
tags Optional[list[str]]List of tags for categorizing and searching actions.
timeout Optional[int]Maximum execution time in minutes before the action is terminated.
uri Optional[str]Container image URI if not inheriting from another action.
caller_org_id Optional[str]Organization ID to create the action in. Defaults to caller’s org.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Returns
The newly created Action instance.
Raises
If short_description exceeds 140 characters or other validation errors occur.
If the request is malformed.
If the caller lacks permission to create actions.
Usage
Create a simple action:
action = Action.create(
name="hello_world", uri="ubuntu:latest", description="A simple hello world action"
)Create an action with parameters and compute requirements:
from roboto.domain.actions import ComputeRequirements, ActionParameter
action = Action.create(
name="data_processor",
uri="my-registry.com/processor:v1.0",
description="Processes sensor data with configurable parameters",
compute_requirements=ComputeRequirements(vCPU=4096, memory=8192),
parameters=[
ActionParameter(name="threshold", required=True, description="Processing threshold"),
ActionParameter(name="output_format", default="json", description="Output format"),
],
tags=["data-processing", "sensors"],
timeout=60,
)Create an action that inherits from another:
base_action = Action.from_name("base_processor", owner_org_id="roboto-public")
derived_action = Action.create(
name="custom_processor",
inherits=base_action.record.reference,
description="Custom processor based on base_processor",
metadata={"version": "2.0", "team": "data-science"},
)Action.delete()
Delete this action from the Roboto platform.
Permanently removes this action and all its versions. This operation cannot be undone.
Raises
If the action is not found.
If the caller lacks permission to delete the action.
Return type
Usage
Delete an action:
action = Action.from_name("old_action")
action.delete()Action.from_name()
Load an existing action by name.
Retrieves an action from the Roboto platform by its name and optionally a specific version digest. Action names are unique within an organization, so a name + org_id combination always provides a fully qualified reference to a specific action.
Parameters
name strName of the action to retrieve. Must be unique within the organization.
digest Optional[str]Specific version digest of the action. If not provided, returns the latest version.
owner_org_id Optional[str]Organization ID that owns the action. If not provided, searches in the caller’s organization.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Returns
The Action instance.
Raises
If the action is not found.
If the caller lacks permission to access the action.
Usage
Load the latest version of an action:
action = Action.from_name("data_processor")Load a specific version of an action:
action = Action.from_name("data_processor", digest="abc123def456")Load an action from another organization:
action = Action.from_name("public_processor", owner_org_id="roboto-public")Properties
Action.inherits_from
Reference to another action this action inherits configuration from.
Action.invoke()
Invokes this action using any inputs and options provided.
Executes this action with the specified parameters and returns an Invocation object that can be used to track progress and retrieve results.
Parameters
invocation_source roboto.Manual, trigger, etc.
data_source_type Optional[roboto.If set, should equal Dataset for backward compatibility.
data_source_id Optional[str]If set, should be a dataset ID for backward compatibility.
input_data Optional[Union[list[str], roboto.Either a list of file name patterns, or an InvocationInput specification.
upload_destination Optional[roboto.Default upload destination (e.g. dataset) for files written to the invocation’s output directory.
compute_requirement_overrides Optional[roboto.Overrides for the action’s default compute requirements (e.g. vCPU)
container_parameter_overrides Optional[roboto.Overrides for the action’s default container parameters (e.g. entrypoint)
idempotency_id Optional[str]Unique ID to ensure an invocation is run exactly once.
invocation_source_id Optional[str]ID of the trigger or manual operator performing the invocation.
parameter_values Optional[dict[str, Any]]Action parameter values.
timeout Optional[int]Action timeout in minutes.
caller_org_id Optional[str]Org ID of the caller.
Returns
An Invocation object that can be used to track the invocation’s progress.
Raises
Invalid method parameters or combinations.
Incorrectly formed request.
The caller is not authorized to invoke this action.
Usage
Basic invocation with a dataset:
from roboto import Action, InvocationSource
action = Action.from_name("ros_ingestion", owner_org_id="roboto-public")
iv = action.invoke(
invocation_source=InvocationSource.Manual,
data_source_id="ds_12345",
data_source_type=InvocationDataSourceType.Dataset,
input_data=["**/*.bag"],
upload_destination=InvocationUploadDestination.dataset("ds_12345"),
)
iv.wait_for_terminal_status()Invocation with compute requirement overrides:
from roboto import Action, InvocationSource, ComputeRequirements
action = Action.from_name("image_processing", owner_org_id="roboto-public")
compute_reqs = ComputeRequirements(vCPU=4096, memory=8192)
iv = action.invoke(
invocation_source=InvocationSource.Manual,
compute_requirement_overrides=compute_reqs,
parameter_values={"threshold": 0.75},
)
status = iv.wait_for_terminal_status()
print(status)
# 'COMPLETED'Properties
Action.metadata
Custom metadata key-value pairs associated with this action.
Action.modified
The timestamp when this action was last modified.
Action.parameters
The list of parameters that can be provided when invoking this action.
Action.published
The timestamp when this action was published to the Action Hub, if applicable.
Action.query()
Query actions with optional filtering and pagination.
Searches for actions based on the provided query specification. Can search within an organization or across the public Action Hub.
Parameters
spec Optional[roboto.Query specification with filters, sorting, and pagination. If not provided, returns all accessible actions.
accessibility roboto.Whether to search organization actions or public Action Hub. Defaults to Organization.
owner_org_id Optional[str]Organization ID to search within. If not provided, searches in the caller’s organization.
roboto_client Optional[roboto.Roboto client instance. Uses default if not provided.
Yields
Action instances matching the query criteria.
Raises
ValueErrorIf the query specification contains unknown fields.
If the caller lacks permission to query actions.
Return type
Usage
Query all actions in your organization:
for action in Action.query():
print(f"Action: {action.name}")Query actions with specific tags:
from roboto.query import QuerySpecification
spec = QuerySpecification().where("tags").contains("ml")
for action in Action.query(spec):
print(f"ML Action: {action.name}")Query public actions in the Action Hub:
from roboto.domain.actions import Accessibility
spec = QuerySpecification().where("name").contains("ros")
for action in Action.query(spec, accessibility=Accessibility.ActionHub):
print(f"Public ROS Action: {action.name}")Query with pagination:
spec = QuerySpecification().limit(10).order_by("created", ascending=False)
recent_actions = list(Action.query(spec))
print(f"Found {len(recent_actions)} recent actions")Properties
Action.record
The underlying action record containing all action data.
Action.requires_downloaded_inputs
Whether input files should be downloaded before executing this action.
Action.set_accessibility()
Set the accessibility level of this action.
Changes whether this action is private to the organization or published to the public Action Hub.
Parameters
accessibility roboto.The new accessibility level (Organization or ActionHub).
Returns
This Action instance with updated accessibility.
Raises
If the caller lacks permission to modify the action.
Usage
Make an action public in the Action Hub:
from roboto.domain.actions import Accessibility
action = Action.from_name("my_action")
action.set_accessibility(Accessibility.ActionHub)Make an action private to the organization:
action.set_accessibility(Accessibility.Organization)Properties
Action.short_description
A brief description of the action (max 140 characters) for display purposes.
Action.tags
The list of tags associated with this action for categorization.
Action.timeout
The maximum execution time in minutes before the action is terminated.
Action.to_dict()
Convert this action to a dictionary representation.
Returns
Dictionary containing all action data in JSON-serializable format.
Usage
Get action as dictionary:
action = Action.from_name("my_action")
action_dict = action.to_dict()
print(action_dict["name"])
# 'my_action'Action.update()
Update this action with new configuration.
Updates the action with the provided changes. Only specified parameters will be modified; others remain unchanged. This creates a new version of the action.
Parameters
compute_requirements Optional[Union[roboto.New compute requirements (CPU, memory).
container_parameters Optional[Union[roboto.New container parameters (image, entrypoint, etc.).
description Optional[Union[str, roboto.New detailed description.
inherits Optional[Union[roboto.New action reference to inherit from.
metadata_changeset Union[roboto.Changes to apply to metadata (add, remove, update keys).
parameter_changeset Union[roboto.Changes to apply to parameters (add, remove, update).
short_description Optional[Union[str, roboto.New brief description (max 140 characters).
timeout Optional[Union[int, roboto.New maximum execution time in minutes.
uri Optional[Union[str, roboto.New container image URI.
requires_downloaded_inputs Union[bool, roboto.Whether to download input files before execution.
Returns
This Action instance with updated configuration.
Raises
If short_description exceeds 140 characters or other validation errors occur.
If the caller lacks permission to update the action.
Usage
Update action description and timeout:
action = Action.from_name("my_action")
action.update(description="Updated description of what this action does", timeout=45)Update compute requirements:
from roboto.domain.actions import ComputeRequirements
action.update(compute_requirements=ComputeRequirements(vCPU=4096, memory=8192))Add metadata using changeset:
from roboto.updates import MetadataChangeset
changeset = MetadataChangeset().set("version", "2.0").set("team", "ml")
action.update(metadata_changeset=changeset)Properties