Skip to main content

Your Automation Powerhouse

Project description

Zrb Logo

🤖 Zrb: Your Automation Powerhouse

Zrb (Zaruba) is a Python-based tool that makes it easy to create, organize, and run automation tasks. Think of it as a command-line sidekick, ready to handle everything from simple scripts to complex, AI-powered workflows.

Whether you're running tasks from the terminal or a sleek web UI, Zrb streamlines your process with task dependencies, environment management, and even inter-task communication.

Contribution Guidelines | Report an Issue


📑 Table of Contents


🔥 Why Choose Zrb?

Zrb is designed to be powerful yet intuitive, offering a unique blend of features:

  • 🤖 Built-in LLM Integration: Go beyond simple automation. Leverage Large Language Models to generate code, create diagrams, produce documentation, and more.
  • 🐍 Pure Python: Write your tasks in Python. No complex DSLs or YAML configurations to learn.
  • 🔗 Smart Task Chaining: Define dependencies between tasks to build sophisticated, ordered workflows.
  • 💻 Dual-Mode Execution: Run tasks from the command line for speed or use the built-in web UI for a more visual experience.
  • ⚙️ Flexible Configuration: Manage inputs with defaults, prompts, or command-line arguments. Handle secrets and settings with environment variables from the system or .env files.
  • 🗣️ Cross-Communication (XCom): Allow tasks to safely exchange small pieces of data.
  • 🌍 Open & Extensible: Zrb is open-source. Feel free to contribute, customize, or extend it to meet your needs.

🚀 Quickstart Part 1: Your First Basic Pipeline in < 2 Minutes

Let's start with the absolute basics: defining simple units of work and chaining them together. You only need Python installed.

1. Define Your Tasks

Create a file named zrb_init.py in your project directory (or your home directory for global access!).

# zrb_init.py
from zrb import cli, CmdTask, Task

# 1. Define tasks.
# CmdTask is perfect for running shell commands.
prepare_env = CmdTask(
    name="prepare-env", 
    cmd="echo 'Environment prepared!'"
)

# Task is for pure Python logic.
build_app = Task(
    name="build-app",
    action=lambda ctx: ctx.print("Building application in pure Python...")
)

deploy_app = CmdTask(
    name="deploy-app", 
    cmd="echo 'Deploying app to the cloud ☁️'"
)

# 2. Register tasks to the main 'cli' object so Zrb knows about them
cli.add_task(prepare_env, build_app, deploy_app)

# 3. Define the execution order (The Directed Acyclic Graph - DAG)
# prepare-env runs first, then build-app, then deploy-app
prepare_env >> build_app >> deploy_app

2. Run Your First Pipeline!

Now, open your terminal and run:

zrb deploy-app

Zrb will see that deploy-app depends on build-app, which depends on prepare-env. It will automatically run them in the correct sequential order:

[prepare-env] Environment prepared!
[build-app] Building application in pure Python...
[build-app] Build complete.
[deploy-app] Deploying app to the cloud ☁️

Congratulations! You've just built and run your first Zrb automation pipeline.


🚀 Quickstart Part 2: Your First AI-Powered Workflow in < 5 Minutes

Now that you understand the basics, let's unleash Zrb's full power. This example uses an LLM to analyze your code and generate a Mermaid diagram, then converts that diagram into a PNG image.

1. Prerequisites

  • An LLM API Key: Zrb needs an API key to talk to an AI model (OpenAI is default, but others are supported).
    export OPENAI_API_KEY="your-key-here"
    
  • Mermaid CLI: This tool converts Mermaid diagram scripts into images. Install it via npm:
    npm install -g @mermaid-js/mermaid-cli
    

2. Update Your zrb_init.py

Add the following to your existing zrb_init.py file (or create a new one if you prefer to keep examples separate):

# zrb_init.py (continued)
from zrb import cli, LLMTask, CmdTask, StrInput, Group
from zrb.llm.tool.code import analyze_code
from zrb.llm.tool.file import write_file

# Create a group for Mermaid-related tasks
mermaid_group = cli.add_group(Group(
    name="mermaid",
    description="🧜 Mermaid diagram related tasks"
))

# Task 1: Generate a Mermaid script from your source code using an LLM
make_mermaid_script = mermaid_group.add_task(
    LLMTask(
        name="make-script",
        description="Create a mermaid diagram from source code in the current directory",
        input=[
            StrInput(name="dir", default="./"),
            StrInput(name="diagram", default="state-diagram"),
        ],
        message=(
            "Read all necessary files in {ctx.input.dir}, "
            "make a {ctx.input.diagram} in mermaid format. "
            "Write the script into `{ctx.input.dir}/{ctx.input.diagram}.mmd`"
        ),
        tools=[analyze_code, write_file],
    )
)

# Task 2: Convert the Mermaid script into a PNG image using CmdTask
make_mermaid_image = mermaid_group.add_task(
    CmdTask(
        name="make-image",
        description="Create a PNG from a mermaid script",
        input=[
            StrInput(name="dir", default="./"),
            StrInput(name="diagram", default="state-diagram"),
        ],
        cmd="mmdc -i '{ctx.input.diagram}.mmd' -o '{ctx.input.diagram}.png'",
        cwd="{ctx.input.dir}",
    )
)

# Set up the dependency: the image task runs after the script is created
make_mermaid_script >> make_mermaid_image

3. Run Your AI-Powered Workflow!

Navigate to any project with source code (e.g., a Python project). For instance, if you've cloned a repository:

git clone https://github.com/someuser/my-python-project.git
cd my-python-project

Now, run your new task:

zrb mermaid make-image

Zrb will interactively ask for the directory and diagram name. Just press Enter to accept the defaults (./ and state-diagram). The AI will analyze your code, generate the Mermaid script, and mmdc will convert it to a PNG. In moments, you'll have a beautiful diagram of your code!

State Diagram


🖥️ Try the Web UI

Prefer a graphical interface? Zrb has you covered. Explore the full details in the Web UI Guide.

zrb server start

Then open your browser to http://localhost:21213 to see your tasks in a clean, user-friendly interface.

Zrb Web UI


💬 Interact with an LLM Directly

Zrb brings AI capabilities right to your command line. For full details on configuring and using the AI assistant, see the LLM Integration Guide.

Interactive Chat

Start a chat session with an LLM to ask questions, brainstorm ideas, or get coding help.

zrb llm chat

⚙️ Installation & Configuration

Ready to dive deeper into getting Zrb set up and customized? Our comprehensive guides cover everything you need:


🤝 CI/CD Integration

Integrate Zrb into your Continuous Integration/Continuous Deployment pipelines for robust, automated workflows. See the CI/CD Integration Guide for examples with GitHub Actions, GitLab CI, and Bitbucket Pipelines.


🗺️ Documentation Directory

Zrb scales from simple scripts to massive automation ecosystems. Explore the documentation to unlock its full potential:

I. Core Concepts

The foundational pillars of the framework.

II. Task Types & Built-ins

Pre-packaged operations you can use immediately.

III. Advanced Features

Taking your automation to the next level.

IV. Configuration

V. Guides & Specifications


🎥 Demo Video

Watch a video demonstration of Zrb in action:

Video Title


💖 Support Zrb

If you find Zrb valuable, please consider showing your support:


🎉 Fun Fact

Did you know? Zrb is named after Zaruba, a powerful, sentient Madou Ring that acts as a guide and support tool in the Garo universe.

Madou Ring Zaruba (魔導輪ザルバ, Madōrin Zaruba) is a Madougu which supports bearers of the Garo Armor. (Garo Wiki | Fandom)

Madou Ring Zaruba on Kouga's Hand

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zrb-2.22.2.tar.gz (599.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

zrb-2.22.2-py3-none-any.whl (737.0 kB view details)

Uploaded Python 3

File details

Details for the file zrb-2.22.2.tar.gz.

File metadata

  • Download URL: zrb-2.22.2.tar.gz
  • Upload date:
  • Size: 599.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.13.0 Darwin/25.4.0

File hashes

Hashes for zrb-2.22.2.tar.gz
Algorithm Hash digest
SHA256 a142cc9f4d063fa737da8e85b7290519bb07e5e7792d163805e448a86a6a6e64
MD5 4874155d0208e35c5747f247d8b16601
BLAKE2b-256 a34ee9264db4ef5eb73683d924953ab7fd99358633a45600184f8a9f92b248a7

See more details on using hashes here.

File details

Details for the file zrb-2.22.2-py3-none-any.whl.

File metadata

  • Download URL: zrb-2.22.2-py3-none-any.whl
  • Upload date:
  • Size: 737.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.3.4 CPython/3.13.0 Darwin/25.4.0

File hashes

Hashes for zrb-2.22.2-py3-none-any.whl
Algorithm Hash digest
SHA256 bd08e537f06920c2c9585c71ac59b5c912c41862419b4a0221df7644a47d9a76
MD5 9951eee67be7d3419d279b85078ec07c
BLAKE2b-256 53091491db9251fe4f74243dbe6e993a08f031dcbe949729cb467f3468c1f9de

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page