Skip to content

aleck31/MyAIBOX

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

112 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

MyAIBOX

Python FastAPI React TypeScript AWS Gemini

MyAIBOX (AI็™พๅฎ็ฎฑ) is a comprehensive Gen-AI application suite built with FastAPI and React. It provides access to various AI capabilities including AI Agent, multimodal chat, text processing, summarization, image/document recognition, and image creation.

Overview

The application integrates multiple GenAI models (Bedrock, Gemini, OpenAI), with secure authentication via Amazon Cognito and session management backed by DynamoDB. It features a modular architecture with a React frontend communicating via AG-UI Protocol (SSE streaming).

๐ŸŽ‰ What's New in v3.7

  • Voice input (Asking): speak your question โ€” live transcription via AWS Transcribe streaming, with optional auto-send
  • Research-style Asking: questions and follow-ups stack as a scrollable thread (numbered Q/A blocks with collapsible reasoning), plus a resizable rail that indexes every question for quick navigation

v3.6

  • Models enable/disable: toggle individual models off in Settings โ†’ Models without deleting them
  • Per-agent inference parameters: temperature / top_p / max_tokens configured in Agents settings are now actually applied
  • Tool progress hints: long-running tools (e.g. file_write) no longer make the UI look frozen
  • MCP health check: cached agent providers verify MCP sessions and rebuild on dead connections

v3.5

  • Unified Chat Module: Assistant + Persona merged into a single /chat/:agentId route; each agent = system prompt + tools + params + skills
  • Strands-native Skills: Agents can load Anthropic-style skills via the AgentSkills plugin (requires strands-agents>=1.39)
  • Per-agent Workspace: Each agent gets its own isolated workspace at storage/workspace/<username>/<agent_id>/
  • Configurable Agents: Users can override model, parameters, tools, and skills per agent (persisted in DynamoDB)
  • Breaking: /assistant and /persona routes now redirect to /chat/assistant; /api/assistant/* and /api/persona/* endpoints replaced by /api/chat/*

v3.2

  • Agent Session Cache: Per-session Strands Agent caching with 2h TTL, hot-swap model, persistent MCP connections
  • Multimodal Chat: File attachments and image display in Agent conversations
  • Image Editing: Edit images with text instructions (Gemini, Nova Canvas, Stability AI)
  • Shared SSE Parser: Unified readSSE() with proper line buffering, fixing stream truncation across modules
  • CLI Tools: my-aibox build (with auto version sync) and my-aibox check (ruff linting)

v3.0

  • React Frontend: Full migration from Gradio to React + AG-UI Protocol with SSE streaming
  • Generative UI: Dual-track streaming (CoT reasoning + tool use UI)
  • Model & MCP Management: In-app model registry and MCP server configuration

v2.x

  • Multi-provider Agent: Bedrock, Gemini, and OpenAI models via Strands SDK

Features

  • Chat ๐Ÿ’ฌ โ€” Unified conversational AI: pick an agent (Assistant, Q&A persona, etc.), each with its own tools, skills, system prompt, and workspace
  • Text ๐Ÿ“ โ€” Proofreading, rewriting, reduction, expansion, multi-language support
  • Summary ๐Ÿ“ฐ โ€” Document and text summarization
  • Asking ๐Ÿง  โ€” Research-style deep Q&A: voice or text input, follow-up threads, per-question reasoning
  • Vision ๐Ÿ‘€ โ€” Image analysis, document understanding (PDF), multi-model support
  • Draw ๐ŸŽจ โ€” AI image generation and editing with prompt optimization, style/ratio/seed options
  • Settings โš™๏ธ โ€” Account management, module configuration, model registry, MCP server management

Supported input formats: jpg/jpeg, png, gif, webp, pdf, csv, doc/docx, xls/xlsx, txt, md, mp4, webm, mov

Screenshots

Multimodal Chatbot

my-aibox

Vision Recognition

my-aibox

Generate and Edit

my-aibox

Settings

my-aibox

Project Structure

my-aibox/
โ”œโ”€โ”€ app.py                        # FastAPI + uvicorn entry point
โ”œโ”€โ”€ backend/                      # Backend Python modules
โ”‚   โ”œโ”€โ”€ api/                          # REST + SSE endpoints (chat, text, summary, asking, vision, draw, settings, upload)
โ”‚   โ”œโ”€โ”€ core/                         # Config, service layer, DynamoDB sessions
โ”‚   โ”œโ”€โ”€ common/                       # Auth, logger, CLI, provider cache, async stream
โ”‚   โ”œโ”€โ”€ genai/                        # LLM providers (Bedrock/Gemini/OpenAI), agents, tools
โ”‚   โ”œโ”€โ”€ utils/                        # AWS + Bedrock helpers
โ”‚   โ””โ”€โ”€ tests/                        # pytest unit + integration
โ”œโ”€โ”€ frontend/                     # React SPA (Vite + TypeScript)
โ”‚   โ”œโ”€โ”€ src/                          # components / pages / api / styles
โ”‚   โ””โ”€โ”€ assets/                       # UI static assets (avatars, icons)
โ”œโ”€โ”€ storage/                      # Runtime data (gitignored)
โ”‚   โ”œโ”€โ”€ uploads/                      # User-uploaded files
โ”‚   โ””โ”€โ”€ generated/                    # Generated images / videos
โ”œโ”€โ”€ logs/                         # Application logs (gitignored)
โ”œโ”€โ”€ deploy/                       # Deployment artifacts
โ”‚   โ”œโ”€โ”€ my-aibox.service              # systemd user unit template
โ”‚   โ”œโ”€โ”€ build-push.sh                 # build & push multi-arch image to ECR
โ”‚   โ””โ”€โ”€ full-stack/                   # Dockerfile + EKS reference (examples/)
โ”œโ”€โ”€ docs/                         # README screenshots, etc.
โ”œโ”€โ”€ pyproject.toml
โ””โ”€โ”€ README.md

Tool & Skill System

Type Configuration Examples
Strands Tools Per-agent toggle calculator, current_time, file_write
MCP Tools Settings โ†’ MCP Server exa-server, core-mcp-server
Legacy Tools Per-agent toggle get_weather, search_wikipedia
Skills Per-agent toggle (from ~/.agents/skills/) Anthropic-style skills loaded via Strands AgentSkills plugin

MCP server types: HTTP, stdio, SSE.

Setup

  1. Install dependencies:
curl -LsSf https://astral.sh/uv/install.sh | sh
uv sync
  1. Configure environment:
aws configure
cp .env.example .env
# Edit .env: AWS region, Cognito, DynamoDB, API keys
  1. Build frontend:
my-aibox build
  1. Run:
uv run python app.py

Routes

Path Description
/ React SPA (default โ†’ /chat/assistant)
/login Login page
/chat/:agentId Chat with the selected agent (e.g. /chat/assistant, /chat/family_doctor)
/text, /summary, /asking, /vision, /draw Tool modules
/settings/session, /settings/modules, /settings/models, /settings/mcp Settings pages
/api/* Backend API

Deployment

Local / EC2

my-aibox install            # set up the systemd user service (one-time)
my-aibox run                # run in the foreground (skips systemd)
my-aibox start|stop|restart # manage the systemd user service
my-aibox status             # show service status
my-aibox logs [-f]          # tail journalctl logs
my-aibox build              # build frontend (syncs version)
my-aibox check              # lint (ruff) + run unit tests
my-aibox test               # run pytest (default: tests/unit)
                            # use `my-aibox test -m integration` for real-service tests

Container / EKS

The image in deploy/full-stack/Dockerfile is thin: it ships uv + git only, and the start script git pull the latest code at pod startup. So most code changes do not require a rebuild โ€” just kubectl rollout restart.

deploy/build-push.sh           # build & push multi-arch (amd64 + arm64) to ECR
kubectl rollout restart deployment my-aibox   # roll pods, picks up latest commit + uv sync

deploy/full-stack/examples/ contains reference IAM role/policy and a k8s manifest with our values baked in โ€” copy them as a starting point, do not kubectl apply directly.

License

MIT License - see LICENSE file for details

About

๐Ÿงฐ AI็™พๅฎ็ฎฑ โ€” a modular Gen-AI suite: ๐Ÿค– agent with tool use & MCP, ๐Ÿ’ฌ multimodal chat, ๐Ÿ“ text processing, ๐Ÿง  deep reasoning, ๐Ÿ‘€ vision, ๐ŸŽจ image generation & editing. FastAPI + React + AG-UI (SSE), powered by Bedrock, Gemini, and OpenAI.

Topics

Resources

License

Stars

2 stars

Watchers

1 watching

Forks

Packages

 
 
 

Contributors