How vrsen/openswarm works
This repo is a Python-first multi-agent system built on Agency Swarm, with a thin Node.js wrapper for distribution and a few JavaScript helpers for slide conversion. The main architecture is centered on a single orchestrator that receives a user request and delegates work to specialist agents.
The primary entrypoints are swarm.py for local development, server.py for an HTTP API runtime, and bin/openswarm as the packaged CLI entry. The README also shows an npm-installed launcher, so the repo supports both developer-run and end-user CLI distribution.
The orchestration boundary is explicit: orchestrator/orchestrator.py is the coordination layer and orchestrator/instructions.md defines its behavior. Its job is to route tasks, not solve them directly. This is the control plane that fans out requests to one or more specialist agents.
The specialist agents are separated into top-level modules, each with its own instructions and toolset: virtual_assistant, deep_research, data_analyst_agent, slides_agent, docs_agent, image_generation_agent, and video_generation_agent. Each agent is a distinct capability boundary, which makes the architecture strongly modular and easy to diagram as independent workers under one orchestrator.
A shared tool layer lives in shared_tools/ and provides cross-cutting operations such as file copying, searching tools, finding tools, executing tools, and managing connections. This is also where model availability and OpenAI client utilities are centralized, so model/provider logic is not duplicated in every agent.
Several agents have their own internal pipelines rather than being just prompt wrappers. The slides agent is the most complex: it includes PPTX/OOXML schema assets, HTML-to-PPTX scripts, rendering utilities, slide screenshots, template registry, and slide file utilities. That indicates a two-stage flow: generate or edit slide content in HTML/PPTX-oriented intermediate forms, then export and validate to final presentation artifacts.
The docs agent follows a similar document-processing pattern. It contains tools for creating, viewing, modifying, restoring, listing, and converting documents, plus a substantial tools/utils/ layer for HTML-to-DOCX transformation and validation. That suggests document generation is not purely textual; it includes structured document assembly and fidelity checks.
The media agents each encapsulate a specialized artifact pipeline. image_generation_agent includes create/edit/combine/background-removal tools plus image I/O helpers. video_generation_agent includes generation, trimming, audio/image/video edits, subtitles, and combine operations. These agents likely produce local media files as intermediate and final outputs rather than returning only text.
data_analyst_agent is built around structured-data analysis and an isolated IPython execution environment, as stated in the README. The presence of test CSV data and a separate tools package suggests a sandboxed compute boundary for analysis, plotting, and statistical work.
virtual_assistant is the most integration-heavy agent. Its tools cover email, calendar, Slack, filesystem operations, product search, scholar search, and skill listing. The README calls out Composio support, so this agent acts as the connector to external SaaS systems like Gmail, Slack, GitHub, and HubSpot when credentials are available.
The repo also has a clear artifact/workspace model: agents operate on files, documents, decks, images, and videos, with utilities for reading, writing, restoring, and converting those artifacts. That means the main data flow is usually prompt → orchestration → agent/tool execution → file-based deliverable, with some agents also calling external APIs for enrichment or generation.
patches/ is an important compatibility layer. It contains targeted fixes for upstream dependencies and runtime behavior, including PPTX-related patches and file/encoding fixes. In an architecture diagram, this sits beneath the application layer as a maintenance layer that adapts third-party libraries to OpenSwarm’s workflows.
Deployment is supported in multiple ways: local Python execution, Docker via Dockerfile and docker-compose.yml, and GitHub Actions for build/test automation. The repo is therefore not just an agent library; it is a distributed delivery system for running agent workflows in terminal, container, or API form.
Main entry points: orchestrator.py Orchestrator · Dockerfile Deploy · slides_agent.py Slides Agent · patches Patches
Components 19
Runtime
Entry points and orchestration control plane
- swarm.py · Python entrypoint for local agent runs
swarm.py - server.py · Runs the system behind an HTTP API
server.py - Orchestrator · Receives requests and delegates work to specialist agents
orchestrator/orchestrator.py - Orch Rules · Instruction set defining orchestration behavior
orchestrator/instructions.md
Agents
Specialist workers and their tool pipelines
- Virtual Assistant · Handles email, calendar, Slack, filesystem, search, and skills
virtual_assistant/virtual_assistant.py - Deep Research · Research-oriented specialist agent
deep_research/deep_research.py - Data Analyst · Structured-data analysis and sandboxed compute agent
data_analyst_agent/data_analyst_agent.py - Slides Agent · Builds and edits slide decks through HTML and PPTX stages
slides_agent/slides_agent.py - Docs Agent · Creates, modifies, and converts documents with validation
docs_agent/docs_agent.py - Image Agent · Generates and edits images, including background removal
image_generation_agent/image_generation_agent.py - Video Agent · Generates and edits video, audio, subtitles, and composites
video_generation_agent/video_generation_agent.py - Slide Tools · Slide build, render, inspect, and template utilities
slides_agent/tools - OOXML Assets · PPTX/OOXML schemas, pack/unpack, and validation scripts
slides_agent/pptx/ooxml - Doc Tools · Document creation, conversion, restore, and HTML-to-DOCX helpers
docs_agent/tools - Media Tools · Image and video generation/editing utilities and shared helpers
image_generation_agent/tools
Shared Layer
Cross-cutting tools, patches, and common utilities
- Shared Tools · Copying, searching, executing, connection management, and model utilities
shared_tools - Patches · Targeted fixes for upstream libraries and runtime quirks
patches
Connections 24
- swarm.py → Orchestrator: starts · Local development runtime enters the control plane
- server.py → Orchestrator: serves · HTTP runtime delegates requests into orchestration
- openswarm → Orchestrator: launches · Packaged CLI invokes the same orchestration layer
- Orchestrator → Orch Rules: guided by · Routing behavior is defined by orchestration instructions
- Orchestrator → Virtual Assistant: delegates · Dispatches tasks to the virtual assistant specialist
- Orchestrator → Deep Research: delegates · Dispatches research work to the research agent
- Orchestrator → Data Analyst: delegates · Dispatches analysis tasks to the analyst agent
- Orchestrator → Slides Agent: delegates · Dispatches deck work to the slides pipeline
- Orchestrator → Docs Agent: delegates · Dispatches document work to the docs pipeline
- Orchestrator → Image Agent: delegates · Dispatches image tasks to the image pipeline
- Orchestrator → Video Agent: delegates · Dispatches video tasks to the video pipeline
- Virtual Assistant → Shared Tools: uses · Shares connection, search, and execution utilities
- Data Analyst → Shared Tools: uses · Relies on shared model/client helpers and execution support
- Slides Agent → Slide Tools: uses · Presentation assembly depends on dedicated slide tooling
- Slides Agent → OOXML Assets: uses · Uses schema assets and pack/unpack validation tooling
- Slide Tools → Patches: adapted by · Slide workflow depends on compatibility fixes
- Docs Agent → Doc Tools: uses · Document lifecycle actions run through the docs toolchain
- Doc Tools → Patches: adapted by · HTML-to-DOCX and file handling are stabilized by patches
- Image Agent → Media Tools: uses · Image generation and editing use media helpers
- Video Agent → Media Tools: uses · Video generation and editing use media helpers
- Patches → Shared Tools: stabilizes · Compatibility fixes support shared runtime behavior
- Deploy → swarm.py: packages · Container and CI delivery include the Python runtime
- Deploy → server.py: packages · Container and CI delivery include the API runtime
- Deploy → openswarm: packages · Release artifacts include the CLI launcher