How berriai/moyai works
Moyai is a self-hosted coding agent: people submit background coding tasks through the browser or Slack, an agent works in an isolated workspace using a selectable harness and model, and the result can include saved files and a GitHub pull request. The map also includes documented search, automation, memory, attachments, and spend capabilities. Several modules are indexed but not excerpted; their links are included only where the README documents the behavior or the excerpts/index establish the relationship.
Main entry points: main.py Web application · runner.py Session orchestration · agent.py Agent runtime · litellm_harness.py Model harnesses
Components 22
User entry points
- Web workspace
app/static/app.js - Slack chat
app/slack.py
Workspace control plane
- Web application
app/main.py - Session orchestration
app/runner.py - Automations
app/automations.py - Connections
app/connectors.py
Agent execution
- Agent runtime
sandbox/agent.py - Model harnesses
sandbox/litellm_harness.py - Context recovery
sandbox/context_recovery.py - Workspace tools
app/skills.py - Sandbox provider
app/sandboxes/modal.py
Connected services
- LiteLLM providers
- GitHub integration
app/github.py - Slack service
State and results
- Workspace database
app/db.py - Agent memory
app/memory.py - Context receipts
sandbox/context_store.py - Saved files
app/attachments.py - Private object storage
app/blob_storage.py - Spend tracking
app/spend.py - Pull request status
app/session_pull_requests.py
Other components
- Teammate
Connections 22
- Teammate → Web workspace: submits tasks
README.md - Teammate → Slack chat: submits tasks
README.md - Web workspace → Web application: sends requests
README.md - Slack chat → Slack service: sends messages
README.md - Slack service → Web application: starts work
README.md - Web application → Session orchestration: dispatches work
app/main.py - Session orchestration → Sandbox provider: creates workspace
README.md - Session orchestration → Agent runtime: runs task
README.md - Agent runtime → Model harnesses: invokes harness
sandbox/litellm_harness.py - Model harnesses → LiteLLM providers: requests inference
README.md - Agent runtime → Workspace tools: uses tools
README.md - Model harnesses → Context recovery: recovers context
sandbox/litellm_harness.py - Context recovery → Context receipts: compacts history
sandbox/context_recovery.py - Session orchestration → Workspace database: persists sessions
app/main.py - Web application → Connections: configures connections
app/main.py - Agent runtime → GitHub integration: works with repositories
README.md - GitHub integration → Pull request status: provides PR state
app/session_pull_requests.py - Session orchestration → Saved files: saves files
README.md - Saved files → Private object storage: stores payloads
app/blob_storage.py - Web application → Automations: offers automation
app/main.py - Agent runtime → Agent memory: uses memory
README.md - Web application → Spend tracking: tracks spend
app/main.py