How prefecthq/marvin works
Main Components
a) Core Engine Layer:
• Orchestrator (src/marvin/engine/orchestrator.py)
• LLM Integration (src/marvin/engine/llm.py)
• Event System (src/marvin/engine/events.py)
• Handlers (src/marvin/engine/handlers.py)
b) Agent Layer:
• Agent System (src/marvin/agents/)
• Team Management (src/marvin/agents/team.py)
• Actor Implementation (src/marvin/agents/actor.py)
c) Task Management Layer:
• Task System (src/marvin/tasks/)
• Thread Management (src/marvin/thread.py)
d) Memory Layer:
• Memory System (src/marvin/memory/)
• Multiple Storage Providers:
• Chroma
• Lance
• Postgres
e) Functions Layer:
• High-level Functions (src/marvin/fns/):
• cast
• classify
• extract
• generate
• plan
• run
• say
• summarize
f) Tools Layer:
• Interactive Tools (src/marvin/tools/interactive/)
• Thread Tools (src/marvin/tools/thread.py)
[Client Applications]
• ↓
[High-level Functions Layer]
• ↓
[Task & Thread Management]
• ↓
[Agent & Team Layer]
• ↓
[Core Engine Layer]
• ↓
[Memory Layer]
Component Relationships
Following key interactions:
• Tasks are managed by the Orchestrator
• Agents interact with Tasks through the Engine
• Memory providers are accessed by both Tasks and Agents
• High-level functions utilize the Task system
• Tools can be accessed by Agents during task execution
Implementation Details
Use the following symbols and notations:
[ Rectangle ] - Core components
( Oval ) - External services
<Diamond> - Decision points
→ - Data flow
⟷ - Bidirectional communication
Additional Elements
Supporting components:
• Configuration management (settings.py)
• CLI interface (src/marvin/cli/)
• Utility functions (src/marvin/utilities/)
• Type system integration (pydantic models)