Skip to content

Latest commit

 

History

History
139 lines (92 loc) · 5.85 KB

File metadata and controls

139 lines (92 loc) · 5.85 KB

Quick Start Guide

Let's get you up and running quickly. This should take about five minutes.

Setup

First, install the dependencies:

pip install -r requirements.txt

Then set up your API key. Create a .env file in the project root:

# Create .env file
echo "GEMINI_API_KEY=sk-your-key-here" > .env

Just replace sk-your-key-here with your actual Gemini API key.

Running the Application

Start the Chainlit UI:

chainlit run frontend/chainlit_app.py

The application will automatically open in your browser at http://localhost:8000. If it doesn't, just copy that URL into your browser.

Note: If port 8000 is already in use, you can specify a different port:

chainlit run frontend/chainlit_app.py --port 8001

Chainlit provides a chat-based interface that's perfect for interacting with workflows. It supports markdown and Mermaid diagrams, so you can see workflow graphs rendered beautifully.

Using the Workflows

I've included four different workflows to show different patterns. Here's how to use each one:

Approval Workflow

This one's straightforward - it prepares something, asks for your approval, then continues based on your decision.

  1. Type graph approval to see the workflow structure
  2. Type execute approval {"content": "Review this document"} to run it
  3. The workflow will execute and show you the results

The chat interface makes it easy to interact with workflows naturally.

Parallel Workflow

This one's fun to watch - multiple agents work at the same time, then everything gets merged together.

  1. Type graph parallel to see how it's structured
  2. Type execute parallel {"task": "Analyze these three topics: AI, ML, and NLP"}
  3. Watch as three agents work simultaneously and results get merged automatically

Iterative Workflow

This workflow keeps refining until it's happy with the quality. It's like having an agent that reviews its own work.

  1. Type graph iterative to see the refinement loop
  2. Type execute iterative {"content": "Write a blog post about LangGraph"}
  3. It will generate, review itself, and if the quality isn't good enough, it refines and tries again until it meets the quality threshold

Conditional Workflow

This one analyzes your input and routes it to the right processor based on what it finds.

  1. Type graph conditional to see the routing logic
  2. Type execute conditional {"input": "This is a technical document about APIs"}
  3. The system figures out what type of input it is and routes it to the appropriate processor automatically

Understanding Workflow Graphs

One of the coolest features is the workflow visualization. Type graph <workflow_name> and you'll see a Mermaid diagram rendered right in the chat showing exactly how each workflow is structured. You can see:

  • How nodes are connected
  • Where conditional routing happens
  • Entry and exit points
  • The overall flow

Chainlit renders Mermaid diagrams beautifully, so you get a visual representation of your workflows right in the interface. This is super helpful when you're trying to understand what a workflow does or debug why something isn't working.

Tips

A few things that might help:

  • Commands: Use help to see all available commands
  • Input Format: JSON is preferred because it's structured, but plain text works too
  • Workflow Graphs: Use graph <workflow_name> to see any workflow's structure
  • Execution: Results are shown in the chat with formatted JSON output
  • Multiple Workflows: You can run multiple workflows in the same session

Example Use Cases

Here are some real scenarios where these workflows come in handy:

Content Review

The approval workflow is perfect when you need a human to review something before it goes live. Maybe you're publishing blog posts, deploying code, or sending out marketing emails - anything where you want a second pair of eyes.

Data Processing

Got multiple data sources to analyze? The parallel workflow lets you process them all at the same time instead of waiting for each one to finish. Much faster.

Content Generation

The iterative workflow is great when quality matters. It generates something, checks if it's good enough, and if not, it refines and tries again. Perfect for blog posts, documentation, or any content where you want it polished.

Task Routing

The conditional workflow acts like a smart router. It looks at incoming tasks, figures out what type they are, and sends them to the right processor. Great for customer support, content classification, or any scenario where different types of inputs need different handling.

Troubleshooting

Ran into an issue? Here are some common problems and how to fix them:

Error: "GEMINI_API_KEY environment variable is required"

  • Make sure you created a .env file in the project root
  • Double-check that your API key is in there (no quotes needed)
  • Restart the application after creating or editing the .env file

Workflow seems stuck or hanging:

  • Check the "Handle Approvals" tab - it might be waiting for your input
  • Look at the execution output to see what step it's on
  • Check the "Execution Monitor" tab for more details

Graph visualization not showing:

  • Make sure the workflows are compiled (they should be automatically)
  • Try clicking the "Refresh Graph" button
  • If it's still not working, check the console for any error messages

Next Steps

Once you've got the basics working, here's what you can do next:

  • Dive into the workflow code in backend/workflows/ to see how they're built
  • Create your own workflows by extending the BaseWorkflow class
  • Add custom nodes by extending BaseNode for your specific use cases
  • Integrate with your own tools and agents - the system is designed to be extensible

The code is pretty well documented, so you should be able to figure out how to customize things for your needs. If you build something cool, I'd love to see it!