Overview
This tutorial demonstrates how to build a production-ready AI assistant using Julep. We’ll create an intelligent support assistant that can:- Crawl and index documentation automatically
- Answer questions using RAG (Retrieval-Augmented Generation)
- Provide contextual, accurate responses based on indexed content
- Offer an interactive chat interface with session management
- Collect and validate user feedback for continuous improvement
What You’ll Learn
By the end of this tutorial, you’ll understand how to:- Configure a Julep agent with specific instructions and capabilities
- Create complex workflows for document processing and indexing
- Implement RAG-powered conversations with hybrid search
- Build an interactive chat interface using Chainlit
- Deploy a production-ready AI assistant
Prerequisites
- Python 3.8+
- Julep API key (get one at platform.julep.ai)
- Basic understanding of Julep concepts (agents, tasks, sessions)
- Spider API key for web crawling
Project Structure
The Julep Assistant project is organized as follows:Step 1: Agent Configuration
First, let’s understand how the agent is configured. Theagent.yaml
file defines the assistant’s personality and capabilities:
- The agent uses Claude Sonnet 4 for high-quality responses
- Instructions provide clear guidance on how to help users
- The agent is specialized for Julep-specific support
Step 2: Web Crawling and Document Indexing
The assistant’s knowledge base is built in two stages: first crawling documentation websites, then indexing the content for RAG retrieval.Web Crawling with Spider Integration
Before indexing documents, we need to crawl the target website. Thetask/crawl.yaml
defines a reusable crawling workflow:
Complete Workflow: Crawl + Index
Thetask/full_task.yaml
combines both crawling and indexing into a single workflow:
smart_mode
: Intelligently navigates and extracts contentlimit
: Number of pages to crawl (set to 2 for testing, increase for production)return_format: markdown
: Returns clean markdown contentproxy_enabled
: Uses proxy for better reliabilityfilter_output_images/svg
: Removes images to focus on text contentreadability
: Extracts main content, removing navigation and ads
Document Indexing Workflow
After crawling, the main workflow intask/main.yaml
processes and indexes the content:
Input Schema
Document Processing Steps
1
Chunk Creation
The workflow starts by creating documentation-sized chunks:This creates ~1500 word chunks with 300-word overlap to preserve context.
2
Content Analysis
Each page is analyzed to extract structured information:
3
Code Extraction
All code examples are extracted and categorized:
4
Q&A Generation
For each chunk, the system generates questions and answers:
5
Document Storage
Finally, enhanced content is stored as agent documents:
Step 3: Building the Chat Interface
The chat interface is built with Chainlit, providing a smooth user experience. Here’s how it works:Session Initialization
Message Handling
Step 4: RAG Configuration
The assistant uses hybrid search for optimal retrieval:Search Modes Explained
- Hybrid Mode: Combines semantic vector search with keyword matching
- Vector Mode: Pure semantic search based on embeddings
- Text Mode: Traditional keyword-based search
Step 5: Dynamic Feedback System
The assistant implements an innovative feedback system that dynamically improves the agent’s behavior by updating its instructions in real-time based on validated user feedback.How the Feedback System Works
The feedback system validates and applies user feedback directly to the agent’s instructions:Feedback Validation Process
The system uses AI to validate feedback before applying it:Feedback Collection UI
The system provides three feedback options:Real-time Agent Improvement
When valid feedback is received, the agent immediately adapts:- Positive Feedback: Reinforces current behavior patterns
- Negative Feedback: Prompts for specifics and adjusts instructions
- Detailed Feedback: Allows comprehensive improvements
Benefits of Dynamic Feedback
- Continuous Learning: Agent improves with each interaction
- User-Driven Evolution: Adapts to actual user needs
- Quality Control: AI validation prevents harmful changes
- Immediate Impact: Changes apply to next interaction
Step 6: Running the Assistant
Installation
- Clone the repository and install dependencies:
- Set up environment variables:
Running the Chat Interface
http://localhost:8000
.
Using Scripts for Better Monitoring
While thefull_task.yaml
can handle both crawling and indexing, using the separate scripts provides better visibility and control:
Web Crawler Script:
- Provides real-time progress updates
- Saves crawled content to JSON for inspection
- Allows you to verify content before indexing
- Handles rate limiting and retries
- Reads the crawled content from the crawler output
- Shows progress for each document being indexed
- Provides detailed error messages if indexing fails
- Generates a summary report of indexed documents
Resources
- Julep Assistant GitHub Repository - Complete source code and examples
- Julep Documentation
- API Reference
- Discord Community
Summary
You’ve learned how to build a production-ready AI assistant with Julep that features:- Web crawling with Spider integration for content acquisition
- Automated documentation processing and indexing
- RAG-powered responses with hybrid search
- Interactive chat interface with session management
- Feedback collection and analysis using Julep documents
- Scalable architecture for production deployment