Introducing Daggr: Chain apps programmatically, inspect visually

Daggr is a new open-source Python library that allows developers to chain Gradio apps, ML models, and custom functions into unified AI workflows with an automatically generated visual canvas for debugging.
**TL;DR:**Daggr is a new, open-source Python library for building AI workflows that connect Gradio apps, ML models, and custom functions. It automatically generates a visual canvas where you can inspect intermediate outputs, rerun individual steps, and manage state for complex pipelines, all in a few lines of Python code!
- Background
- Getting Started
- Sharing Your Workflows
- End-to-End Example with Different Nodes
- Next Steps
If you've built AI applications that combine multiple models or processing steps, you know the pain: chaining API calls, debugging pipelines, and losing track of intermediate results. When something goes wrong in step 5 of a 10-step workflow, you often have to re-run everything just to see what happened.
Most developers either build fragile scripts that are hard to debug or turn to heavy orchestration platforms designed for production pipelines—not rapid experimentation.
We've been working on Daggr to solve problems we kept running into when building AI demos and workflows:
Visualize your code flow: Unlike node-based GUI editors, where you drag and connect nodes visually, Daggr takes a code-first approach. You define workflows in Python, and a visual canvas is generated automatically. This means you get the best of both worlds: version-controllable code and visual inspection of intermediate outputs.
Inspect and Rerun Any Step: The visual canvas isn't just for show. You can inspect the output of any node, modify inputs, and rerun individual steps without executing the entire pipeline. This is invaluable when you're debugging a 10-step workflow and only step 7 is misbehaving. You can even provide “backup nodes” – replacing one model or Space with another – to build resilient workflows.
First-Class Gradio Integration: Since Daggr is built by the Gradio team, it works seamlessly with Gradio Spaces. Point to any public (or private) Space and you can use it as a node in your workflow. No adapters, no wrappers—just reference the Space name and API endpoint.
State Persistence: Daggr automatically saves your workflow state, input values, cached results, canvas position—so you can pick up where you left off. Use "sheets" to maintain multiple workspaces within the same app.
Install daggr with pip or uv, it just requires Python 3.10 or higher:
pip install daggr
uv pip install daggr
Here's a simple example that generates an image and removes its background. Check out this Space’s API reference from the bottom of the Space to see which inputs it takes and which outputs it yields. In this example, the Space returns both original image and the edited image, so we return only the edited image.
import random
import gradio as gr
from daggr import GradioNode, Graph
# Generate an image using a Gradio Space
image_gen = GradioNode(
"hf-applications/Z-Image-Turbo",
api_name="/generate_image",
inputs={
"prompt": gr.Textbox(
label="Prompt",
value="A cheetah sprints across the grassy savanna.",
lines=3,
),
"height": 1024,
"width": 1024,
"seed": random.random,
},
outputs={
"image": gr.Image(label="Generated Image"),
},
)
# Remove background using another Gradio Space
bg_remover = GradioNode(
"hf-applications/background-removal",
api_name="/image",
inputs={
"image": image_gen.image, # Connect to previous node's output
},
outputs={
"original_image": None, # Hide this output
"final_image": gr.Image(label="Final Image"),
},
)
graph = Graph(
name="Transparent Background Generator",
nodes=[image_gen, bg_remover]
)
graph.launch()
Source: Hugging Face Blog
















