A Retrieval-Augmented Generation (RAG) chatbot deployed on Amazon Bedrock AgentCore that answers fitness-related questions using a knowledge base and remembers conversation history across sessions.
The bot: - Retrieves fitness knowledge using FAISS vector search - Uses Groq LLM (Llama‑3.3‑70B) for responses - Stores conversation history using AgentCore Memory - Runs inside Amazon Bedrock AgentCore runtime
User Query ↓ AgentCore Runtime ↓ Memory Retrieval (AgentCoreMemoryStore) ↓ RAG Retrieval (FAISS Vector Store) ↓ LLM Generation (Groq / Llama‑3.3‑70B) ↓ Store Conversation in AgentCore Memory
- Retrieval Augmented Generation (RAG)
- Persistent memory across sessions
- Amazon Bedrock AgentCore deployment
- Groq LLM integration
- FAISS vector database
- LangChain based tools
.
├── main.py
├── rag_tool.py
├── vector_store.py
├── documents/
├── pyproject.toml
└── README.md
You need:
- AWS Account
- AWS CLI configured
- Python 3.12+
- AgentCore CLI installed
- Docker installed
- Groq API Key
Create environment variables:
Linux / Mac
export GROQ_API_KEY=your_key
Windows
set GROQ_API_KEY=your_key
pip install -r requirements.txt
or if using pyproject.toml
pip install .
Run the script that loads documents and builds FAISS index.
Example:
python vector_store.py
This creates a FAISS index used for retrieval.
python main.py
Or using uvicorn if FastAPI is used:
uvicorn main:app --reload
aws configure
Set:
- Access Key
- Secret Key
- Region
Inside the project directory:
agentcore init
This generates the agentcore.yaml configuration file.
Edit the configuration file:
entrypoint: main:app
language: python
deployment_type: container
platform: linux/arm64
Add your IAM execution role.
agentcore deploy
This step will:
- Build a container
- Push image to Amazon ECR
- Create AgentCore runtime
- Deploy the agent
Example:
agentcore deploy --env GROQ_API_KEY=your_key
Run:
agentcore invoke "{'input':'How much water should I drink daily?'}"
Example response:
{
"answer": "The general recommendation is to drink 2–3 liters of water daily."
}
The bot stores messages using:
AgentCoreMemoryStore
Each session is stored using:
(actor_id, thread_id)
This allows the bot to remember previous questions within the same session.
Example:
User: How much water should I drink daily?
Assistant: 2‑3 liters
User: What did I ask earlier?
Assistant: You asked about daily water intake.
Deploy
agentcore deploy
Invoke
agentcore invoke "{'input':'your question'}"
View logs
aws logs tail /aws/bedrock-agentcore/runtimes/<runtime-name> --follow
- Amazon Bedrock AgentCore
- LangChain
- LangGraph Memory
- FAISS
- Groq LLM
- Python
- Multi‑agent architecture
- User preference memory
- Streaming responses
- API gateway integration
- Web UI
Aditya Naranje
AI / ML Engineer | Generative AI | LLM Applications