Architecture
This document explains how the project is layered.
The intended product shape is:
- a control plane for agent systems that change over time
- a runtime for executing those systems
- an explainability layer for understanding composition and behavior
Layers
1. Beginner API
Files:
yggdrasil/app.py
Purpose:
- fast time-to-first-success
- code-generation-friendly helpers
- simple builder flow for first projects
2. Core Runtime
Files:
yggdrasil/core/nodes.pyyggdrasil/core/edges.pyyggdrasil/core/store.pyyggdrasil/core/executor.pyyggdrasil/core/guardrails.pyyggdrasil/core/routing.pyyggdrasil/core/runtime_records.pyyggdrasil/core/workflow_runtime.py
Purpose:
- graph data model
- traversal and execution
- tool execution
- routing and orchestration
- composition-time explainability
- run-time explainability signals
Internal split:
executor.py: primary runtime entry point and traversal flowrouting.py:RoutingAdvisorand routing validation / decision-table helpersguardrails.py:GuardrailEngineand permissions / secrets / schema helpersruntime_records.py:RuntimeRecordStorefor persisted runtime-service recordsworkflow_runtime.py:WorkflowRuntimeServicefor pause/resume and transaction helpers
Runtime Collaboration
flowchart TB
U["User / App Code"] --> GE["GraphExecutor"]
GE --> AC["AgentComposer"]
GE --> RA["RoutingAdvisor"]
GE --> GG["GuardrailEngine"]
GE --> RR["RuntimeRecordStore"]
GE --> WR["WorkflowRuntimeService"]
AC --> GS["GraphStore"]
GG --> GS
RR --> GS
GE --> BE["LLM Backend"]
GE --> TR["TraceEvent / Observability"]
GS --> N["Nodes / Edges / Runtime Records"]
Intent:
GraphExecutorcoordinates executionAgentComposerresolves runtime composition from graph dataRoutingAdvisorowns routing reasoning and validationGuardrailEngineowns permissions, secrets, and validation checksRuntimeRecordStoreowns persisted runtime-service artifactsWorkflowRuntimeServiceowns pause/resume and transaction-oriented workflow behavior
3. Model Backends
Files:
yggdrasil/backends/
Purpose:
- adapt provider-specific chat APIs into the shared
LLMBackendcontract
4. Tool Layer
Files:
yggdrasil/tools/
Purpose:
- importable built-in tools
- tool registry
- stable callable references for config-driven integrations
5. Platform / Operations Layer
Files:
yggdrasil/exporters/yggdrasil/viz/
Purpose:
- trace export and visualization
Design Intent
The preferred dependency direction is:
beginner API
-> core runtime
-> backends / tools
-> platform layers build beside the runtime, not inside every example
The most important architectural constraint is this:
- changes to the agent system should be representable as graph/data changes
- explanations of behavior should be recoverable from the runtime and graph state
Contributor Guidance
- Put new user ergonomics in the beginner API or docs first.
- Put execution semantics in the core runtime.
- Put operational workflows in config/admin modules.
- Avoid making
GraphExecutorthe default home for every new feature unless it truly belongs to execution.