Build Your First Workflow in 5 Minutes
Let’s create a simple text processing workflow that demonstrates the power and elegance of Nadoo Flow Core.Prerequisites
Make sure you have:
- Python 3.11+ installed
- nadoo-flow-core package installed (
pip install nadoo-flow-core)
Your First Workflow
We’ll build a workflow that:- Takes user input
- Transforms the text (uppercase)
- Analyzes sentiment
- Returns formatted results
Expected Output
Understanding the Code
Let’s break down what’s happening:1
Node Definition
We define custom nodes by extending
ChainableNode:- Override
execute()method with your logic - Return
NodeResultwith success status and output - Access input via
node_context.input_data - Store data in
workflow_contextfor sharing
2
Workflow Composition
Use the pipe operator (
|) to chain nodes:- Output of one node becomes input of the next
- Create linear pipelines easily
- Mix custom nodes with
FunctionNodefor quick transforms
3
Execution
Run workflows asynchronously:
- Call
workflow.run()with input data - Get the final output as a dictionary
- Handle errors with try/except blocks
Adding Streaming
Want real-time updates? Enable streaming:streaming_example.py
Parallel Processing
Process multiple items concurrently:parallel_example.py
Error Handling
Add resilience with retry and fallback:resilient_example.py
Adding Context
Share data between nodes using workflow context:context_example.py
Next Steps
Now that you’ve built your first workflow, explore more advanced features:Core Components
Deep dive into nodes, contexts, and execution
Advanced Features
Learn parallel execution, streaming, and caching
Real Examples
Build a streaming chatbot with memory
API Reference
Complete API documentation
Quick Tips
💡 Use Type Hints
💡 Use Type Hints
Always use type hints for better IDE support and error detection:
🔍 Debug with PassthroughNode
🔍 Debug with PassthroughNode
Insert
PassthroughNode to inspect data flow:⚡ Optimize with Caching
⚡ Optimize with Caching
Cache expensive operations:
🎯 Handle Errors Gracefully
🎯 Handle Errors Gracefully
Always return proper NodeResult on failure:
Pro Tip: Start simple, then add complexity. Begin with basic nodes, then add parallel execution, caching, and error handling as needed.