Quickstart Guide
Get RecoAgent up and running in 10 minutes with this step-by-step tutorial. You'll build a simple RAG agent that can answer questions about your documents.
What You'll Build
By the end of this tutorial, you'll have:
- A working RecoAgent installation
- A simple RAG agent that can answer questions
- Knowledge of core RecoAgent concepts
- A foundation for building more complex agents
Prerequisites
Before you begin, make sure you have:
- Python 3.8 or higher
- An OpenAI API key (or another LLM provider)
- Basic familiarity with Python
Step 1: Installation
First, let's install RecoAgent and its dependencies:
pip install recoagent
Step 2: Set Up Environment
Create a new directory for your project and set up your environment:
mkdir my-recoagent-project
cd my-recoagent-project
Create a .env
file with your API keys:
# .env
OPENAI_API_KEY=your_openai_api_key_here
LANGSMITH_API_KEY=your_langsmith_key_here
LANGSMITH_PROJECT=recoagent-quickstart
Step 3: Create Your First Agent
Create a file called quickstart.py
:
import os
from recoagent import RecoAgent, DocumentLoader
from recoagent.retrievers import HybridRetriever
from recoagent.agents import RAGAgent
# Load environment variables
from dotenv import load_dotenv
load_dotenv()
# Initialize the agent
agent = RecoAgent(
llm_provider="openai",
embedding_model="text-embedding-ada-002",
vector_store="opensearch" # or "azure" or "vertex"
)
# Load some sample documents
loader = DocumentLoader()
documents = loader.load_from_text([
"RecoAgent is an enterprise RAG platform built with LangGraph and LangChain.",
"It supports hybrid retrieval combining BM25 and vector embeddings.",
"The platform includes built-in evaluation metrics and safety guardrails."
])
# Create a simple RAG agent
rag_agent = RAGAgent(
retriever=HybridRetriever(),
system_prompt="You are a helpful assistant that answers questions about RecoAgent."
)
print("RecoAgent initialized successfully!")
Step 4: Test Your Agent
Now let's test the agent with a simple question:
# Ask a question
question = "What is RecoAgent?"
# Get the response
response = rag_agent.ask(question)
print(f"Question: {question}")
print(f"Answer: {response.answer}")
print(f"Sources: {response.sources}")
Step 5: Add More Documents
Let's add more documents to make the agent more useful:
# Add more documents
more_docs = [
"RecoAgent supports multiple vector stores including OpenSearch, Azure AI Search, and Vertex AI Vector Search.",
"The platform includes NVIDIA NeMo Guardrails for safety and governance.",
"RecoAgent provides comprehensive observability with LangSmith integration.",
"You can evaluate your RAG system using RAGAS metrics like context precision and faithfulness."
]
# Update the agent's knowledge base
rag_agent.add_documents(more_docs)
# Test with a more complex question
question = "What vector stores does RecoAgent support and what safety features does it include?"
response = rag_agent.ask(question)
print(f"Question: {question}")
print(f"Answer: {response.answer}")
print(f"Sources: {len(response.sources)} documents referenced")
Step 6: Explore Advanced Features
Let's try a multi-step question that requires reasoning:
# Enable multi-step reasoning
rag_agent.enable_multi_step_reasoning = True
# Ask a complex question
question = "How can I evaluate the quality of my RAG system and what metrics should I focus on?"
response = rag_agent.ask(question)
print(f"Question: {question}")
print(f"Answer: {response.answer}")
print(f"Reasoning steps: {len(response.reasoning_steps)}")
print(f"Confidence score: {response.confidence}")
What You've Accomplished
Congratulations! In just 10 minutes, you've:
✅ Installed RecoAgent - Set up the development environment
✅ Created your first agent - Built a working RAG system
✅ Added knowledge - Loaded documents into the agent
✅ Tested functionality - Asked questions and got answers
✅ Explored advanced features - Used multi-step reasoning
Next Steps
Now that you have RecoAgent running, here are some recommended next steps:
🚀 Immediate Next Steps
- Installation Tutorial - Complete setup guide (coming soon)
- Understanding RAG - Deep dive into retrieval concepts (coming soon)
- First Agent - Build a more sophisticated agent (coming soon)
🔧 Customization
- How-To: Custom Tools - Extend agent capabilities (coming soon)
- How-To: Configure Vector Stores - Set up production stores (coming soon)
- Examples: Advanced Usage - See real-world patterns (coming soon)
📊 Evaluation & Production
- How-To: Evaluation Setup - Measure performance (coming soon)
- Tutorial: Production Deployment - Scale to enterprise (coming soon)
- Demo: End-to-End - See a complete application
Troubleshooting
Common Issues
ImportError: No module named 'recoagent'
- Make sure you installed RecoAgent:
pip install recoagent
- Check your Python environment and virtual environment
API Key Errors
- Verify your
.env
file has the correct API keys - Ensure you have credits/quota available with your LLM provider
Vector Store Connection Issues
- For OpenSearch: Make sure the service is running locally or accessible
- For cloud providers: Verify your credentials and region settings
Getting Help
If you encounter issues:
- Check the Troubleshooting Guide (coming soon)
- Review Common Issues (coming soon)
- Join our Community Discussions for support
- Open an Issue for bugs
Summary
You now have a working RecoAgent installation and have built your first RAG agent! The quickstart has shown you:
- How to install and configure RecoAgent
- How to create a basic RAG agent
- How to load documents and ask questions
- How to use advanced features like multi-step reasoning
Ready to learn more? Explore the other tutorials and examples to build more sophisticated agents and applications!