Skip to content

Quick Start

πŸš€ QuickstartLink

This guide helps you go from zero to a working Sierra Dev setup β€” where you can write structured invokers, generate standalone scripts, and produce CLI-ready YAML configs.


πŸ“ 1. Create Your First InvokerLink

In a file like scripts/greet.py, define an invoker:

Python
import sierra

# Define the invoker
invoker = sierra.InvokerScript(
    name="greet",
    description="Prints a personalized greeting message."
)

# Dependency functions
@invoker.dependancy
def random_function_one(param: int) -> int:
    return param * 2

@invoker.dependancy
def random_function_two(message: str) -> str:
    return message.upper()

@invoker.dependancy
def random_function_three(value: float) -> float:
    return value / 3.14

@invoker.dependancy
def random_function_four(flag: bool) -> bool:
    return not flag

# Main entrypoint
@invoker.entry_point
def run(
    name: sierra.Param[
        str | None,
        sierra.SierraOption(
            description="The name of the person to greet.",
            mandatory="MANDATORY"
        )
    ],
    polite: sierra.Param[
        bool | None,
        sierra.SierraOption(
            description="Whether to include a polite phrase in the greeting."
        )
    ] = False,
) -> None:
    if name is None:
        result = sierra.create_error_result("Missing mandatory parameter: name")
    else:
        greeting = f"Hello, {name}!"
        if polite:
            greeting = f"Good day to you, {name}!"
        result = sierra.create_tree_result([greeting])
    print(result)

# Loader function
def load(client: sierra.SierraDevelopmentClient) -> None:
    client.load_invoker(invoker)

βš™οΈ 2. Load the ClientLink

In your driver script (e.g. compile.py):

Python
import sierra

client = sierra.SierraDevelopmentClient(
    environment_name="default_env",
    logger=sierra.UniversalLogger(
        name="Sierra",
        level=sierra.sierra_internal_logger.LogLevel.DEBUG,
    ),
)

# Load all scripts from the environment
client.load_invokers_from_scripts()

# Compile to standalone Python + YAML config
client.compiler.compile()

πŸ—οΈ 3. What compile() DoesLink

It auto-generates:

  • A standalone script (e.g. invokers/greet.py)
  • A YAML entry for your CLI or automation config
  • Command-line argument parsing and runtime validation

Example compiled script:

Bash
python invokers/greet.py Alice true

Example output:

JSON
1
2
3
4
{
  "type": "tree",
  "tree": ["Good day to you, Alice!"]
}

πŸ“‚ 4. Environment LayoutLink

Your project directory might look like:

Text Only
1
2
3
4
5
6
7
8
πŸ“ default_env/
 β”œβ”€ scripts/
 β”‚   └─ greet.py
 β”œβ”€ invokers/
 β”‚   └─ greet.py  ← auto‑compiled
 β”œβ”€ venv/
 β”œβ”€ config.yaml   ← auto‑generated
 └─ source

πŸ§ͺ 5. Run & TestLink

After compilation:

  • CLI works with basic Python execution
  • All validations (types, required params) are automatically checked
  • Error and tree results are structured and JSON-compatible

πŸ“Œ NotesLink

  • Use @invoker.entry_point for the main logic
  • Use @invoker.dependancy to register helpers
  • Use Param[...] with SierraOption(...) for typed + validated inputs
  • Client will pick up all scripts inside the scripts/ directory

🧠 Learn MoreLink

Check out: