Skip to main content

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:
  1. Configure a Julep agent with specific instructions and capabilities
  2. Create complex workflows for document processing and indexing
  3. Implement RAG-powered conversations with hybrid search
  4. Build an interactive chat interface using Chainlit
  5. 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. The agent.yaml file defines the assistant’s personality and capabilities:
Key points:
  • 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. The task/crawl.yaml defines a reusable crawling workflow:

Complete Workflow: Crawl + Index

The task/full_task.yaml combines both crawling and indexing into a single workflow:
The key Spider crawler parameters:
  • smart_mode: Intelligently navigates and extracts content
  • limit: Number of pages to crawl (set to 2 for testing, increase for production)
  • return_format: markdown: Returns clean markdown content
  • proxy_enabled: Uses proxy for better reliability
  • filter_output_images/svg: Removes images to focus on text content
  • readability: Extracts main content, removing navigation and ads

Document Indexing Workflow

After crawling, the main workflow in task/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:
  1. Positive Feedback: Reinforces current behavior patterns
  2. Negative Feedback: Prompts for specifics and adjusts instructions
  3. Detailed Feedback: Allows comprehensive improvements
Example of instruction evolution:

Benefits of Dynamic Feedback

  1. Continuous Learning: Agent improves with each interaction
  2. User-Driven Evolution: Adapts to actual user needs
  3. Quality Control: AI validation prevents harmful changes
  4. Immediate Impact: Changes apply to next interaction
This approach makes the assistant truly adaptive, learning from user interactions to provide increasingly better support over time.

Step 6: Running the Assistant

Installation

  1. Clone the repository and install dependencies:
  1. Set up environment variables:

Running the Chat Interface

This starts the web interface at http://localhost:8000.

Using Scripts for Better Monitoring

While the full_task.yaml can handle both crawling and indexing, using the separate scripts provides better visibility and control: Web Crawler Script:
This 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
Document Indexer Script:
This script:
  • 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
Monitoring Task Execution: You can also monitor the full workflow execution:

Resources

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
This assistant demonstrates the power of Julep for building stateful, context-aware AI applications that can maintain conversations, access external knowledge, and provide accurate, helpful responses.