Skip to content

Replace Streamlit UI with FastAPI backend for computer-use demo#363

Open
ZenRepoMaster wants to merge 1 commit into
anthropics:mainfrom
ZenRepoMaster:test_project
Open

Replace Streamlit UI with FastAPI backend for computer-use demo#363
ZenRepoMaster wants to merge 1 commit into
anthropics:mainfrom
ZenRepoMaster:test_project

Conversation

@ZenRepoMaster
Copy link
Copy Markdown

Summary

This PR replaces the experimental Streamlit interface with a production-capable
FastAPI backend, providing a cleaner architecture with proper session management,
real-time streaming, and persistent chat history.

What's changed

  • FastAPI backend — REST API for session CRUD, SSE for real-time agent
    output, WebSocket proxy for VNC desktop access
  • SQLite persistence — chat history and session state stored with
    SQLAlchemy async + aiosqlite; WAL mode for concurrent reads/writes
  • API key encryption — Fernet symmetric encryption for keys stored at rest
  • Multi-session support — per-session asyncio locks prevent concurrent
    sampling loop runs; SSE queue fan-out supports multiple browser tabs
  • HTML/JS frontend — zero-dependency chat UI with three panels: session
    sidebar, chat messages (with inline screenshots), and a tabbed right panel
    for the VNC desktop and API request/response logs
  • Docker Compose — two services: existing desktop (Xvfb + x11vnc + noVNC)
    and new api (FastAPI on port 8000); API waits for desktop healthcheck before
    starting

How to run

  1. Copy .env.example to .env and fill in API_SECRET_KEY and
    ANTHROPIC_API_KEY
  2. docker compose up
  3. Open http://localhost:8000

What's preserved

  • loop.py and all tools are unchanged
  • Bedrock and Vertex provider support carried over
  • noVNC iframe fallback still available on port 6080

- Add FastAPI backend with session management, SQLite persistence,
  SSE streaming for agent output, and WebSocket VNC proxy
- Add HTML/JS frontend with chat UI, desktop panel, and API log panel
- Add Docker Compose setup with separate desktop and api services
- Add Fernet encryption for API keys stored in SQLite
- Keep existing loop.py and tools unchanged

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant