Ship production-ready AI agents in hours, not months.
๐ Documentation ยท ๐ Tutorials ยท ๐ง Guides ยท ๐ฌ Discord
git clone https://github.com/LegendStack/agentic-fastapi-template
cd agentic-fastapi-template && docker compose upThat's it. Your agent is running at http://localhost:8000/docs with:
- ๐ค Demo Agent showcasing all features (no API keys needed)
- ๐ RAG pipeline with vector search
- ๐ก๏ธ Safety guardrails (PII masking, moderation)
- ๐ฌ Real-time streaming (SSE/WebSocket)
Tip
New to LegendStack? Start with the Interactive Tutorial โ it walks you through every feature in 90 minutes.
| Building AI Agents From Scratch | With LegendStack |
|---|---|
| Set up FastAPI, auth, database, caching... | โ Batteries included |
| Build RAG pipeline from scratch | โ Production-ready RAG with reranking |
| Figure out LangGraph patterns | โ 11 modular node examples |
| Add safety guardrails | โ PII masking, moderation built-in |
| Implement caching, rate limiting | โ Semantic cache, tiered limits |
| Debug memory, threading issues | โ Entity-aware cross-thread memory |
| Build monitoring, cost tracking | โ OpenTelemetry + cost tracking |
| Weeks/Months | Hours |
|
|
|
|
| Resource | Format | Time | Best For |
|---|---|---|---|
| Quick Start | Docs | 5 min | Get running fast |
| Jupyter Tutorial | Notebook | 90 min | Hands-on learning |
| Streamlit Walkthrough | Web App | 30 min | Visual learners |
| Integration Guide | Docs | 15 min | Connect real services |
| Customization Cookbook | Docs | โ | Add your logic |
| Production Checklist | Checklist | โ | Pre-deploy review |
๐ค Chat with the Demo Agent
from app.agents.demo import LegendDemoAgent
agent = LegendDemoAgent() # Uses mocks (no API keys needed)
result = await agent.chat("What is LegendStack?")
print(result["response"])
print(result["features_used"]) # Shows which features were invokedโ๏ธ Connect Azure OpenAI
from app.core.integration_config import configure_integrations, get_azure_openai_client
configure_integrations() # Auto-configures from .env
client = get_azure_openai_client()
response = await client.chat([{"role": "user", "content": "Hello!"}], deployment="gpt-4o")๐ RAG with Reranking
from app.agents import RerankingService, CrossEncoderReranker
docs = await vector_store.search("How to deploy?", k=20)
reranker = RerankingService(CrossEncoderReranker())
top_docs = await reranker.rerank("How to deploy?", docs, top_k=5)๐ก๏ธ Resilient LLM Calls
from app.agents import ResilientClient
client = ResilientClient(name="openai") # Retry + circuit breaker
result = await client.execute(call_llm, prompt) # Auto-retries on failure๐ ๏ธ CLI: Generate New Agent
uv run python src/app/cli/main.py create-agent CustomerSupport
uv run python src/app/cli/main.py create-connector Slack๐ฅ๏ธ Launch Studio Dashboard
streamlit run studio/main.py| Milestone | Time |
|---|---|
| Clone & run with mocks | 5 min |
| Connect real Azure OpenAI | 30 min |
| Customize for your use case | 2-4 hours |
| Production-ready | 1-2 days |
Interactive setup:
./setup.py # Choose: local / staging / production| Environment | Config | Best For |
|---|---|---|
local |
Uvicorn + auto-reload | Development |
staging |
Gunicorn + workers | Load testing |
production |
NGINX + Gunicorn | Deployment |
Then:
docker compose up๐ Full setup guide: Getting Started
src/app/
โโโ agents/ # ๐ค Agentic AI framework
โ โโโ demo/ # Demo agent with all features
โ โโโ nodes/ # Reusable LangGraph nodes
โ โโโ connectors/ # Enterprise integrations
โ โโโ guardrails/ # Safety & moderation
โโโ api/v1/ # ๐ REST endpoints
โโโ core/ # โ๏ธ Config, DB, auth
โโโ cli/ # ๐ ๏ธ Developer tools
docs/
โโโ getting-started/ # ๐ Quick start
โโโ tutorials/ # ๐ Interactive learning
โโโ guides/ # ๐ง Integration & cookbook
โโโ user-guide/ # ๐ Detailed reference
notebooks/
โโโ tutorial.ipynb # ๐ 8-chapter Jupyter tutorial
studio/
โโโ tutorial_app.py # ๐ฅ๏ธ Streamlit walkthrough
# Run all tests (161 tests)
uv run pytest tests/ -v
# Run specific test file
uv run pytest tests/test_demo_agent.py -vTo enable Vault integration (AppRole Auth):
VAULT_ENABLED=true
VAULT_URL=http://localhost:8200
VAULT_ROLE_ID=<your-role-id>
VAULT_SECRET_ID=<your-secret-id>
VAULT_SECRET_PATH=secret/data/my-appWe welcome contributions! See CONTRIBUTING.md for guidelines.
- ๐ Report bugs
- ๐ก Request features
- ๐ Improve docs
MIT โ use it for anything.
Built with โค๏ธ by the LegendStack team