This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
RAGents is an advanced agentic RAG framework written in Python 3.10+. It combines intelligent decision-tree agents with multimodal RAG capabilities and type-safe LLM interactions using the instructor package.
# Install in development mode
pip install -e ".[dev]"
# Run the main demo
python main.py
# Run examples
python examples/basic_usage.py
# Run tests
pytest
# Format code
black ragents/
ruff check ragents/
# Type checking
mypy ragents/# Basic installation
pip install -e .
# With optional dependencies
pip install -e ".[weaviate,vision]"The codebase follows a modular architecture with clear separation of concerns:
ragents/agents/: Agent implementations with decision tree capabilitiesragents/rag/: RAG engine with multimodal processingragents/llm/: Type-safe LLM client using instructor for structured outputsragents/config/: Environment-driven configuration managementragents/processors/: Document and content processors
- Async-first design: All main operations support async/await
- Type safety: Extensive use of Pydantic models and instructor for LLM interactions
- Mixin architecture: Extensible agent capabilities through mixins
- Environment configuration: Configuration through environment variables with fallbacks
- Structured outputs: All LLM interactions use typed responses
instructor: Type-safe LLM interactionspydantic: Data validation and settings managementopenai/anthropic: LLM provider clientschromadb: Vector database for embeddingssentence-transformers: Text embeddings
- Follow the existing async patterns
- Use Pydantic models for data validation
- Add appropriate type hints
- Create corresponding test files
- Update configuration classes if needed
- Extend
Agentbase class or useDecisionTreeAgent - Define decision nodes for complex behaviors
- Use structured thinking patterns with instructor
- Always use the
LLMClientwith structured outputs - Define Pydantic models for expected responses
- Implement retry logic for robustness
- Add new settings to appropriate config classes
- Support environment variable overrides
- Provide sensible defaults
Required:
OPENAI_API_KEYorANTHROPIC_API_KEY: LLM provider authentication
Optional configuration:
RAGENTS_LLM_PROVIDER: openai/anthropic (default: openai)RAGENTS_CHUNK_SIZE: Document chunk size (default: 1000)RAGENTS_TOP_K: Retrieval results count (default: 5)RAGENTS_ENABLE_VISION: Enable image processing (default: false)RAGENTS_WORKING_DIR: Working directory (default: ./output)