Yggdrasil - Observable and Explainable Agent-as-Graph library
Build agent systems as graphs, where agents, tools, context, and workflow state live in one runtime.
yggdrasil is a Python framework for graph-native orchestration. The core idea is simple:
- store agents, tools, prompts, and context as graph nodes
- connect them with typed edges
- let the runtime compose and execute that graph at query time
The strongest use case is not just "build an agent." It is:
- build an agent system that changes over time
- manage that system as graph data
- explain why it behaved the way it did
The intended workflow is:
- define agents, tools, and context as graph nodes
- connect them with typed edges
- run queries through the graph
- inspect behavior with structured traces and
explain_run
Illustration
Yggdrasil is named after the world tree because the project is meant to connect distinct realms of work in one traversable system:
- data and memory
- humans and approvals
- deterministic business logic
- probabilistic reasoning with LLMs
- durable workflow state across all of them
Start Here
If you are new to the project, use this order:
- Start Here
- Your First Graph
- Choose a Backend
- Control Plane Thesis
- Explainable Agent Systems
- Flagship Workflow
- Observability
- Visualizer Web UI
Skip these until later:
- Capturing Domain Knowledge
- Advanced configuration
- Batch execution
- Long-running workflows
- API reference
Install
Requirements: Python 3.11+
Install directly from Git without cloning:
pip install "yggdrasil @ git+https://github.com/hoangdao1/yggdrasil.git"
Add extras the same way:
pip install "yggdrasil[anthropic] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[openai] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[embeddings] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[observe] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[neo4j] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[claude-code] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[viz] @ git+https://github.com/hoangdao1/yggdrasil.git"
pip install "yggdrasil[dev] @ git+https://github.com/hoangdao1/yggdrasil.git"
Or clone the repo for local development:
git clone https://github.com/hoangdao1/yggdrasil.git
cd yggdrasil
pip install -e .
Add the extras you need:
pip install -e ".[anthropic]" # default Anthropic backend
pip install -e ".[openai]" # OpenAI-compatible backend
pip install -e ".[embeddings]" # semantic retrieval
pip install -e ".[observe]" # OpenTelemetry export
pip install -e ".[neo4j]" # Neo4j graph store
pip install -e ".[claude-code]" # Claude Code sub-agent backend
pip install -e ".[viz]" # browser trace visualizer
pip install -e ".[dev]" # tests + rich trace UI
Fastest Working Example
90% of use cases fit in five lines. The beginner-friendly path uses GraphApp, which wires up the store, executor, and backend automatically.
import asyncio
from yggdrasil_lm.app import GraphApp
async def main() -> None:
app = GraphApp()
agent = await app.add_agent("Bot", system_prompt="You are a helpful assistant.")
ctx = await app.run(agent, "What is Python 3.13?")
print(ctx.outputs[agent.node_id]["text"])
asyncio.run(main())
Need tools? Attach the built-ins and go:
import asyncio
from yggdrasil_lm.app import GraphApp
async def main() -> None:
app = GraphApp()
agent = await app.add_agent(
"Researcher",
system_prompt="You are a technical researcher.",
model="claude-sonnet-4-6",
)
app.use_default_tools() # registers built-in web_search, echo, run_python
ctx = await app.run(agent, "What changed in Python 3.13?")
print(ctx.outputs[agent.node_id]["text"])
asyncio.run(main())
Want local Claude Code sub-agents instead of a hosted API backend?
from yggdrasil_lm.app import GraphApp
app = GraphApp(
provider="claude-code",
cwd="/path/to/project",
permission_mode="acceptEdits",
)
This uses your Claude Code executor setup and can bridge graph ToolNodes into
the sub-agent as in-process MCP tools.
See API reference §2 Builder API for the full GraphApp surface, including add_tool(fn=..., attach=True, agent=...), add_context, add_prompt, and delegate.
Why This Project Exists
Many agent systems start as prompt-and-tool loops, then become operational systems:
- new policies appear
- review steps are added
- context sources change
- capabilities vary by tenant or environment
- operators need to explain decisions
yggdrasil is designed for that phase.
It treats the agent system as something that should be:
- versioned
- diffed
- migrated
- inspected
- explained
Core Mental Model
Keep these four ideas in mind:
-
Composition is traversal. Agents discover tools, prompts, and context by following graph edges.
-
Execution is traversal. Running a query is a walk through the graph.
-
Routing is explicit. Multi-agent handoff is represented in the graph and resolved by the executor.
-
Outputs can become graph state. Runs produce traces and can materialize runtime context.
API Layers
There are two ways to use the project.
Beginner API
Use this first. Import from yggdrasil.app:
GraphAppcreate_agent()create_tool()create_context()create_prompt()create_executor()
Low-Level Runtime API
Use this when you need direct control:
AgentNode,ToolNode,ContextNode,PromptNodeEdgeNetworkXGraphStoreGraphExecutor
What The Project Already Does Well
- dynamic tool and context composition from graph edges
- multi-agent routing
- sequential, fan-out, and DAG execution strategies
- batch execution with concurrency, checkpointing, and resume
- structured traces with terminal and browser views
- typed run explanations with hop summaries, routing decisions, and tool call details
- workflow runtime features such as pause/resume, approvals, and checkpoints
- multimodal image queries and visual RAG (Anthropic and OpenAI-compatible backends)
For the browser trace viewer specifically, see Visualizer Web UI.
Recommended Learning Path
Learn the runtime
- Your First Graph
- Workflow Patterns
- Observability
- Explainable Agent Systems
- Why behavior changed
- Flagship Workflow
Run practical local examples
- examples/builder_echo.py
- examples/deterministic_routing.py
- examples/approval_workflow.py
- examples/parallel_workers.py
- examples/research_pipeline.py
- examples/image_query_and_visual_rag.py
- examples/neurosymbolic_pipeline.py — neural extraction → symbolic Datalog reasoning (with proof) → neural explanation
Learn provider setup
Learn the platform layer
- Neurosymbolic Reasoning —
ReasonerNode+ the built-in Datalog engine - Control Plane Thesis
- Architecture
- Repo map
Contributor Docs
Reference Docs
Project Status
This repo now has a clearer split:
README.md: first-run pathdocs/: tutorials, architecture, and operationsAPI_REFERENCE.md: exhaustive referenceyggdrasil/app.py: beginner-facing builder APIyggdrasil/core/: low-level runtime
Metadata
Release files for yggdrasil-lm 0.1.21
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| yggdrasil_lm-0.1.21.tar.gz | 170.3 kB | Without provenance | Details for yggdrasil_lm-0.1.21.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yggdrasil_lm-0.1.21-py3-none-any.whl | Python 3 | none | any | Details for yggdrasil_lm-0.1.21-py3-none-any.whl |
Total release size: 328.9 kB
Release files / yggdrasil_lm-0.1.21.tar.gz
| Download URL | yggdrasil_lm-0.1.21.tar.gz |
|---|---|
| Size | 170.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ae1bf2ff5598506a5cb669cf7d60c0f83e91c2eaa01fbbf3dc69ed76ad763079
|
|
BLAKE2b-256 checksum How to use checksums |
f115ef4eff55af78737b706c2aebe569607dc918ecf3378a870cbc5e9673efec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.3
|
Release files / yggdrasil_lm-0.1.21-py3-none-any.whl
| Download URL | yggdrasil_lm-0.1.21-py3-none-any.whl |
|---|---|
| Size | 158.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6add133b2c593351dca12235d2a96d43e8ed8af1c44bc378a3a7cad4a0561d54
|
|
BLAKE2b-256 checksum How to use checksums |
4c44553f20431bcb600c94ebccfec1402dfb71a607be9af9aa635c1613a917e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.3
|
Security for yggdrasil-lm 0.1.21
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.