Author: Julia Hu
This project presents a multi-agent Email Assistant that leverages retrieval-augmented generation (RAG), image synthesis, and web data enrichment to generate high-quality, multi-modal email content. Built using the Strands Agents SDK, the assistant coordinates a suite of specialized agents—each responsible for tasks like querying knowledge bases, generating contextual images, and refining email content.
The system architecture integrates Amazon Bedrock for both text and image generation, a Knowledge Base for enterprise data retrieval, and optional web research capabilities to supplement real-time context. The final output is a well-structured, polished email that includes relevant knowledge snippets and visually compelling elements, all orchestrated through a single plain-language request.
A comprehensive email assistant that leverages knowledge base retrieval and image generation capabilities.
| Function | Agent/Tool | Data Source | Output |
|---|---|---|---|
| Orchestration | email_assistant |
Coordinates tools & writes final email | Structured Markdown / HTML |
| Knowledge Retrieval | retrieve_from_kb |
Amazon Bedrock Knowledge Base | Relevant context from audio/text |
| Image Creation | generate_image_nova |
Amazon Bedrock Nova Canvas | Custom images for email content |
| Web Research | http_request |
Public web | Supplementary information |
| Content Editing | editor |
Amazon Nova | Polished email content |
- User ➜
email_assistantwith a plain-language email request - Assistant analyzes request and determines needed resources:
- Knowledge context? → calls
retrieve_from_kbto query Knowledge Base - Visual content? → calls
generate_image_novato create relevant images - Additional facts? → uses
http_requestfor web research
- Knowledge context? → calls
- Assistant synthesizes all gathered information
- Final polished email returned to the user with embedded images and context
The assistant creates professional emails with:
- Proper structure (greeting, body, closing)
- Relevant knowledge base context integrated naturally
- Custom-generated images when appropriate
- Web research findings incorporated seamlessly
- Professional tone and formatting
- Python 3.10+
- AWS CLI v2 configured
- Access to Amazon Bedrock (Nova in us-east-1 region and Knowledge Base in your preferred region)
- Run the notebooks in Multi-modal-data-ingest/audio-video-rag/ folder to process audio files
- Create a Bedrock Knowledge Base and note the KB ID
pip install -r requirements.txtpython email_assistant.py --kb-id YOUR_KB_ID --region replace_your_regionpython kb_rag.py --kb-id YOUR_KB_IDpython image_generation_agent.py| Component Type | AWS Service | Purpose |
|---|---|---|
| Data Pipeline | Bedrock Data Automation | Processes audio files into embeddings |
| Storage Layer | S3 | Stores documents, images, and processed data |
| Search Layer | Amazon Bedrock Knowledge Base | Vector/keyword index for knowledge retrieval |
| AI Services | Amazon Nova | Foundation model for text generation and image creation |
| Compute | Amazon SageMaker | Notebook environment for development |
| Symptom | Likely Cause | Fix |
|---|---|---|
| NoCredentialsError | AWS credentials not exported | Run aws configure --profile <profile> |
| Knowledge Base Error | KB ID incorrect or in wrong region | Verify KB ID and region match where KB was created |
| Image Generation Fails | Token limit exceeded | Reset conversation after each interaction |
| ImportError Strands SDK | Missing Strands SDK | Check Python path includes SDK locations |
| ModuleNotFoundError | Incorrect import structure | Use absolute imports when running as script |
Email Request> Write an email to my team about our Q3 financial resultsEmail Request> Write an email summarizing the key points from our last earnings callEmail Request> Write an email announcing our new product launch with an image of a futuristic deviceYou can customize the Email Assistant by modifying:
- The system prompt in
create_email_assistant()function - The default region and KB ID in the script
- The tools available to the assistant
For production use, consider:
- Setting up persistent storage for generated images
- Implementing authentication for sensitive knowledge bases
- Creating a web interface using Streamlit or Flask
After you're done using the Email Assistant, you should clean up the resources to avoid incurring unnecessary costs.
If you created the knowledge base using the notebook in Multi-modal-data-ingest/audio-video-rag/, you can run the cleanup cell at the end of the notebook:
# Delete Knowledge Base
knowledge_base.delete_kb(delete_s3_bucket=True, delete_iam_roles_and_policies=True)