Skip to content

My first Python step

A step type is a manifest plus code. The Python SDK uses only the standard library and runs the step on your machine the same way an agent does, with no core.

  1. Create the skeleton.

    Janela do terminal
    python -m automatrpa new greet --name acme.greet
  2. Write the logic in greet/main.py:

    from automatrpa.step import StepContext, TransientError, main
    def handle(ctx: StepContext) -> dict[str, object]:
    name = ctx.inputs["name"]
    ctx.log("building the greeting", attempt=ctx.attempt_number)
    if not name:
    raise TransientError("empty name")
    return {"message": f"Hello, {name}!"}
    if __name__ == "__main__":
    main(handle)

    TransientError asks for another attempt; PermanentError or any other exception is a permanent failure.

  3. Run it locally.

    Janela do terminal
    python -m automatrpa run greet --inputs greet/inputs.json
  4. Check it against the catalog and publish it (development environment only):

    Janela do terminal
    automatrpa catalog export --out catalog.json
    python -m automatrpa check greet --catalog catalog.json
    automatrpa step-type publish greet

More in the step development guide.