Skip to content

Invoker

InvokerLink

Define and manage invoker scripts in the Sierra Dev. Invoker scripts are used to execute specific actions in a controlled environment.

Invoker Example
Python
import sierra

# Define an InvokerScript with dependencies and an entry point
invoker = sierra.InvokerScript(
    name="example",
    description="An example invoker script."
)

@invoker.dependency
def helper_function(param: int) -> int:
    return param + 1

@invoker.entry_point
def run(param: sierra.Param[int, sierra.SierraOption(description="An integer parameter.")]) -> None:
    result = helper_function(param)
    print(f"Result: {result}")

# Register the invoker
sierra.register_invoker(invoker)

sierra.invoker Link

ClassesLink

InvokerScript Link
Python
InvokerScript(name: str, description: str | None = None)

A wrapper for creating Sierra invoker scripts that generates config.yaml and argparse-compatible scripts.

This class is used to define a script with its parameters, then generate: 1. A standalone Python script with argparse handling 2. A YAML configuration for Sierra 3. Proper JSON output formatting

ATTRIBUTE DESCRIPTION
name

The unique name of the script.

TYPE: str

description

A short description of the script.

TYPE: str | None

params

List of parameter metadata.

TYPE: list[SierraInvokerParam]

http_client

Optional HTTP client used for external requests.

TYPE: httpx.Client | None

logger

Logger instance for capturing script activity.

TYPE: UniversalLogger

_entry_point

The registered Python function.

TYPE: _TCallable | None

_output_dir

Directory to output generated files.

TYPE: Path | None

AttributesLink
name instance-attribute Link
Python
name = name
description instance-attribute Link
Python
description = description
params instance-attribute Link
deps instance-attribute Link
Python
deps: list[_TCallable] = []
requirements instance-attribute Link
Python
requirements: list[str] = []
command instance-attribute Link
Python
command: str = ''
filename instance-attribute Link
Python
filename: pathlib.Path
FunctionsLink
verify_signature staticmethod Link
Python
verify_signature(func: _TCallable) -> None

Verifies that all parameters are properly typed with SierraOption metadata. Raises TypeError if any parameter lacks SierraOption typing.

PARAMETER DESCRIPTION
func

The function to verify.

TYPE: _TCallable

RAISES DESCRIPTION
TypeError

If any parameter lacks proper SierraOption annotation.

entry_point Link
Python
entry_point(func: _TCallable) -> _TCallable

Register a Python function as an invoker script.

This extracts parameter metadata and prepares the function for code generation.

PARAMETER DESCRIPTION
func

The function to register.

TYPE: _TCallable

RETURNS DESCRIPTION
_TCallable

The original function (unchanged).

dependancy Link
Python
dependancy(func: _TCallable) -> _TCallable
requirement Link
Python
requirement(requirement: list[str]) -> None
set_command Link
Python
set_command(command_string: str) -> None