Working Examples
Learn Flow Core through practical, working examples from our GitHub repository. Each example progressively introduces more advanced concepts.All examples are fully functional and can be found in the
examples/ directory of the Flow Core repository.Available Examples
Basic Chat Bot
Simple chatbot with conversation memory using
InMemoryChatHistoryStreaming Chat
Real-time token streaming for chat responses
Parallel Search
Concurrent execution with multiple search engines
RAG Pipeline
Complete Retrieval-Augmented Generation workflow
Advanced Features
Retry, fallback, caching, and resilience patterns
Human-in-the-Loop
Workflow interruption for human approval
Example Progression
🎯 Level 1: Basics
Start with fundamental concepts:01_basic_chat_bot.py
Learn the basics of Flow Core with a simple chatbot that maintains conversation history:- Session-based conversation history
- Window-based memory (keeps last N messages)
- Simple rule-based responses
- History inspection
🚀 Level 2: Streaming
Add real-time capabilities:02_streaming_chat.py
Implement token-by-token streaming for responsive chat experiences:- Character-by-character streaming
- Simulated typing effect
- Complete response aggregation
- Stream event handling
⚡ Level 3: Parallel Execution
Scale with concurrent processing:03_parallel_search.py
Execute multiple search operations simultaneously:- Concurrent API calls to multiple sources
- Aggregated search results
- Fallback handling for failed searches
- Response time tracking
🧠 Level 4: RAG Pipeline
Build production-ready AI workflows:04_rag_pipeline.py
Complete Retrieval-Augmented Generation implementation:- Document processing pipeline
- Vector store integration
- Semantic search
- Context injection
- LLM-powered responses
🛡️ Level 5: Advanced Patterns
Production-grade resilience:advanced_features_example.py
Comprehensive demonstration of enterprise features:- Automatic retry on transient failures
- Graceful degradation
- Performance optimization through caching
- API rate limit handling
- Comprehensive error handling
👥 Level 6: Human-in-the-Loop
Interactive workflows with human oversight:hitl_example.py
Implement workflows that pause for human input:- Pause workflow for approval
- State preservation during interruption
- Manual intervention points
- Workflow resumption
- Audit trail
Running the Examples
Prerequisites
Running Individual Examples
Example Structure
Each example follows a consistent structure:Key Learning Points
From Basic Examples
- Node Creation: How to implement custom nodes
- Context Management: Working with node and workflow contexts
- Memory Systems: Implementing conversation history
- Error Handling: Proper error propagation
From Advanced Examples
- Parallel Processing: Scaling with concurrent execution
- Streaming: Real-time data processing
- Resilience: Production-grade error handling
- Optimization: Caching and performance tuning
Common Patterns
Pattern 1: Stateful Conversations
Pattern 2: Parallel Data Fetching
Pattern 3: Retry with Fallback
Pattern 4: Stream Processing
Best Practices Demonstrated
Error Handling
Error Handling
Every example shows proper error handling with meaningful error messages and graceful degradation.
Type Safety
Type Safety
All examples use type hints and Pydantic models for runtime validation.
Async/Await
Async/Await
Proper use of Python’s async/await for concurrent operations.
Resource Management
Resource Management
Cleanup of resources, proper context management, and memory efficiency.
Documentation
Documentation
Clear comments in both Korean and English explaining key concepts.
Building Your Own
After studying these examples, you’ll be able to:- Create Custom Nodes: Build nodes for any use case
- Compose Workflows: Chain nodes into complex workflows
- Handle State: Manage conversation and application state
- Scale Performance: Use parallel execution and streaming
- Ensure Reliability: Implement retry, fallback, and caching
- Add Human Oversight: Create approval workflows
Getting Help
Next Steps
Ready to dive deeper? Start with these examples:1
Run Basic Chat Bot
Start with
01_basic_chat_bot.py to understand core concepts2
Try Streaming
Move to
02_streaming_chat.py for real-time features3
Scale with Parallel
Explore
03_parallel_search.py for concurrent execution4
Build RAG Pipeline
Study
04_rag_pipeline.py for production patterns