Building Workflows
Learn how to create powerful AI workflows by connecting nodes together. Master common patterns and best practices for building robust agents.
Creating Your First Workflow
Add Your First Node
Right-click on the canvas and select a node from the menu, or drag a node from the palette.
- Start with an Input node to receive data
- Use Tab to quick-add nodes
- Nodes snap to grid for clean layouts
Connect Nodes Together
Click and drag from an output port (right side) to an input port (left side) to create a connection.
- Connections are color-coded by data type
- Delete connections by selecting and pressing Delete
- Hover over ports to see expected data types
Configure Node Settings
Click a node to select it and configure its settings in the Properties panel.
- Each node type has unique configuration options
- Use variables for dynamic values
- Add descriptions to document your workflow
Test Your Workflow
Click the Run button or press F5 to execute your workflow and see the results.
- Watch data flow through nodes in real-time
- Use the debugger to step through execution
- Check the console for errors and logs
Common Workflow Patterns
Linear Flow
The simplest pattern: data flows from input through processing to output in a straight line.
Conditional Branching
Use condition nodes to route data based on logic. Create different paths for different scenarios.
Loops
Process arrays or repeat actions using loop nodes. Great for batch processing.
Parallel Processing
Split data into multiple parallel paths for faster processing of independent tasks.
Sub-workflows
Encapsulate reusable logic in sub-workflows. Keep your main workflow clean and organized.
Error Handling
Use try-catch patterns to handle errors gracefully and provide fallback behavior.
Understanding Data Flow
Data flows through your workflow following these principles:
Output to Input
Data always flows from output ports (right side) to input ports (left side). Each connection carries the data produced by one node to be consumed by another.
Type Compatibility
Ports are typed (text, number, object, etc.). CogTog will warn you if you try to connect incompatible types, but will allow it with automatic conversion.
Multiple Connections
An output can connect to multiple inputs, sending the same data to all of them. An input typically accepts only one connection.
Execution Order
Nodes execute when all their inputs have data. CogTog automatically determines the correct execution order based on connections.
Best Practices
Keep workflows focused
Each workflow should do one thing well. Use sub-workflows for complex logic.
Name nodes descriptively
Use clear names that describe what each node does, not what type it is.
Document with comments
Add comment nodes to explain complex logic or important decisions.
Use variables for configuration
Store API keys, URLs, and settings in variables for easy updates.
Test incrementally
Build and test small sections before adding more complexity.
Handle errors gracefully
Always include error handling for API calls and external services.