desktop-agent-builder

Build desktop-distributed AI agent applications with a Python FastAPI backend, React TypeScript frontend, and PyInstaller executable packaging. Use this skill whenever the user wants to create a desktop app powered by an AI agent, build a chatbot with a local GUI, package a Python+React app as a standalone .exe, integrate AWS Bedrock or other LLM providers into a desktop tool, create an SSE-streaming chat interface, or bundle a full-stack web app into a shareable executable. Also use when the user mentions PyInstaller, Strands SDK agents, desktop AI tools, or distributable agent applications.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "desktop-agent-builder" with this command: npx skills add suman73/tigeragentskill/suman73-tigeragentskill-desktop-agent-builder

Desktop Agent Builder

A comprehensive skill for building production-ready desktop AI agent applications that combine a Python backend with a React frontend, packaged as a standalone executable.

Architecture Overview

The pattern is a local client-server architecture bundled into a single distributable package:

project/
├── backend/                 # Python FastAPI server + AI agent
│   ├── main.py              # FastAPI app, API routes, SSE streaming
│   ├── run.py               # Entry point (dev + frozen exe)
│   ├── build_exe.py         # Build script (uv + PyInstaller)
│   ├── requirements.txt     # Python dependencies
│   └── app/
│       ├── agent_factory.py # Agent creation, tools, system prompt
│       ├── sessions.py      # Session management, credential validation
│       ├── models.py        # Pydantic request/response models
│       ├── config.py        # App configuration dataclass
│       ├── profiles.py      # AWS profile discovery
│       └── ...              # Additional modules as needed
├── frontend/                # React + TypeScript + Vite SPA
│   ├── src/
│   │   ├── App.tsx          # Root component, routing, state
│   │   ├── api.ts           # API client + SSE streaming helper
│   │   ├── types.ts         # Shared TypeScript types
│   │   └── components/      # UI components
│   └── vite.config.ts
└── infra/                   # Optional: CDK/CloudFormation for cloud resources

How It Works

  1. User launches the .exe — it starts a local FastAPI server on localhost:8000
  2. Server serves the React SPA as static files from the bundled frontend_dist/
  3. Browser opens automatically to http://localhost:8000
  4. User interacts with the chat UI, which calls backend API endpoints
  5. Backend runs the AI agent, streams responses via Server-Sent Events (SSE)
  6. Only prerequisite on the user's machine: AWS CLI (or whatever external tool the agent needs)

Key Design Decisions

Read references/architecture.md for detailed rationale on each decision. The highlights:

  • Local server, not Electron: Avoids Chromium bloat. The user's default browser is the UI. FastAPI serves both the API and the SPA static files.
  • SSE over WebSockets: Simpler, works through proxies, natural fit for streaming LLM responses. The agent runs synchronously in a thread pool; events are pushed to a queue that the SSE generator reads from.
  • Session-based, not persistent: Sessions live in memory. No database needed. The exe is stateless between runs.
  • Lazy agent creation: Credentials are validated on connect, but the agent (which is expensive to initialize) is only created on the first chat message. This keeps the connect flow fast.
  • uv for builds: uv resolves and installs Python packages 10-50x faster than pip. The build script creates a clean venv with uv venv, installs deps with uv pip install, then runs PyInstaller from that venv.
  • onedir not onefile: PyInstaller --onedir produces a folder with the exe + dependencies. Startup is instant. --onefile extracts to a temp dir on every launch — slow and triggers antivirus.

Building a New Desktop Agent App

Step 1: Scaffold the Backend

Create the FastAPI server with these core components:

  1. run.py — Entry point that works both in dev (uvicorn with reload) and frozen (PyInstaller) mode
  2. main.py — FastAPI app with CORS, API routes, SSE streaming, and static file serving
  3. app/agent_factory.py — Agent creation with configurable tools and system prompt
  4. app/sessions.py — Session lifecycle (create, get, destroy)
  5. app/models.py — Pydantic models for all API request/response schemas

See references/backend-patterns.md for code patterns for each component.

Step 2: Scaffold the Frontend

Create the React SPA with Vite:

  1. api.ts — API client with SSE streaming helper that parses data: lines
  2. App.tsx — Root component managing session state and view routing
  3. components/ChatWindow.tsx — Chat UI with message bubbles, tool call display, streaming indicator
  4. components/ProfileSelector.tsx — Login/connect page (pre-auth)
  5. components/Sidebar.tsx — Navigation sidebar (post-auth)

See references/frontend-patterns.md for the SSE streaming pattern and component structure.

Step 3: Wire SSE Streaming

The critical integration point. The pattern:

Frontend (EventSource) ←SSE→ Backend (StreamingResponse) ←Queue→ Agent Thread
  1. Agent runs in a ThreadPoolExecutor thread
  2. A ToolStreamingHook pushes events (tool_call, tool_result, content) to a Queue
  3. The SSE endpoint reads from the queue with timeout, yields data: {json}\n\n lines
  4. Frontend reads the SSE stream, updates UI in real-time
  5. Final data: [DONE]\n\n signals stream end

Step 4: Build the Executable

The build script (build_exe.py) does:

  1. uv venv .build_venv — Create clean venv
  2. uv pip install --python .build_venv/Scripts/python.exe <packages> — Install deps fast
  3. npm run build — Build frontend
  4. Copy frontend/distbackend/frontend_dist
  5. Run PyInstaller with --onedir, --add-data for frontend + app modules, --hidden-import and --collect-submodules for dynamic imports, --exclude-module for unused heavy packages

See references/pyinstaller-guide.md for the full list of hidden imports and exclusions needed for common packages (FastAPI, uvicorn, boto3, strands, etc.).

Step 5: Test the Executable

  1. Run the exe from the dist/ folder
  2. Verify browser opens to localhost:8000
  3. Verify the SPA loads (static files served correctly)
  4. Verify API endpoints work (create session, send message, stream response)
  5. Verify the agent can use its tools (AWS calls, etc.)

Common issues and fixes are in references/troubleshooting.md.

Adding Features

Custom Tools for the Agent

Define tools using the @tool decorator pattern:

from strands import tool

@tool
def my_custom_tool(param: str) -> str:
    """Description of what this tool does."""
    # Implementation
    return result

Add to the agent's tool list in agent_factory.py.

System Check / Prerequisites Page

Add a GET /api/system-check endpoint that verifies the user's machine has required software (AWS CLI, etc.). Display results on the login page so first-time users know what to install.

Report Generation

For data-heavy features, generate HTML reports server-side and serve them via a download endpoint with Content-Disposition: attachment header. Avoid blob URLs — they're blocked by some corporate browser policies.

Configuration from Cloud (SSM Parameter Store)

Fetch config from AWS SSM Parameter Store in a single batch get_parameters call. This lets you update config (model IDs, prompts, feature flags) without rebuilding the exe.

What NOT to Do

  • Don't use --onefile for PyInstaller — it's slow to start and triggers antivirus
  • Don't open the browser with webbrowser.open() for SSO auth — corporate environments block it. Show the URL in the UI instead.
  • Don't use WebSockets for LLM streaming — SSE is simpler and sufficient
  • Don't bundle a database — use in-memory sessions for desktop apps
  • Don't hardcode credentials or config — use profiles and cloud config
  • Don't use npm run dev in the exe — build the frontend and serve static files

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

openclaw-version-monitor

监控 OpenClaw GitHub 版本更新,获取最新版本发布说明,翻译成中文, 并推送到 Telegram 和 Feishu。用于:(1) 定时检查版本更新 (2) 推送版本更新通知 (3) 生成中文版发布说明

Archived SourceRecently Updated
Coding

ask-claude

Delegate a task to Claude Code CLI and immediately report the result back in chat. Supports persistent sessions with full context memory. Safe execution: no data exfiltration, no external calls, file operations confined to workspace. Use when the user asks to run Claude, delegate a coding task, continue a previous Claude session, or any task benefiting from Claude Code's tools (file editing, code analysis, bash, etc.).

Archived SourceRecently Updated
Coding

ai-dating

This skill enables dating and matchmaking workflows. Use it when a user asks to make friends, find a partner, run matchmaking, or provide dating preferences/profile updates. The skill should execute `dating-cli` commands to complete profile setup, task creation/update, match checking, contact reveal, and review.

Archived SourceRecently Updated
Coding

clawhub-rate-limited-publisher

Queue and publish local skills to ClawHub with a strict 5-per-hour cap using the local clawhub CLI and host scheduler.

Archived SourceRecently Updated