Declarative DataFlow Agent SDK — schema-driven, collision-free agent framework
Project description
nanoathens — Declarative DataFlow Agent SDK
A schema-driven, collision-free agent framework where LLMs extract values (not plans) and a static DAG resolves deterministic execution paths.
Install
pip install nanoathens # Core SDK only (no GPU deps)
pip install nanoathens[medgemma] # + MedGemma support
pip install nanoathens[all] # Everything
Or install from source:
pip install -e .
Quick Start
from nanoathens import (
ToolRegistry, ToolSchema, ToolType, ArgExtractorType,
DeclarativeDataFlowAgent, run_medgemma, load_medgemma,
)
# 1. Build your tool registry
registry = ToolRegistry()
registry.register(
name="my_tool",
description="Does something useful",
tool_type=ToolType.COMPUTATION,
arg_sources={"input_val": "user_input"},
arg_extractor={"name": "my_tool", "arguments": {"input_val": {"type": ArgExtractorType.LLM}}},
func=lambda input_val: f"Result for {input_val}",
output_keys={"output_val": "string"},
)
# 2. Create the agent
agent = DeclarativeDataFlowAgent(
registry=registry,
reasoning_caller=run_medgemma, # Uses stub if MedGemma not loaded
)
# 3. Run
import asyncio
result = asyncio.run(agent.run("Process my input", target_key="output_val"))
print(result["response"])
Architecture
User Query
│
▼
┌─────────────────────┐
│ LLMValueExtractor │ ← Extract values from query
│ ContextBank │ ← Accumulate context
└─────────┬───────────┘
▼
┌─────────────────────┐
│ GoalKeyResolver │ ← Map query → target key
└─────────┬───────────┘
▼
┌─────────────────────┐
│ DataFlowEngine │ ← Resolve DAG path
│ (collision-free) │ ← Backward DFS
└─────────┬───────────┘
▼
┌─────────────────────┐
│ GroundedArgFiller │ ← Fill args from context
│ Tool Execution │ ← Run each tool in order
└─────────┬───────────┘
▼
┌─────────────────────┐
│ Synthesis │ ← LLM summarizes results
└─────────────────────┘
Key Properties
- Collision-free DAG: No output key appears in any tool's input sources
- Deterministic: Same query always produces same execution plan
- Minimum LLM calls: 2 (extraction + goal resolution) + 1 per tool for arg filling
- Explicit null_plan: Returns registry gap information if no path exists
- Domain-agnostic: Works for any domain (oncology, radiology, etc.)
Modules
| Module | Classes |
|---|---|
core |
ToolType, ArgExtractorType, ToolSchema, ToolRegistry |
context |
ContextBank, LLMValueExtractor, BaseValueExtractor |
filler |
GroundedArgumentFiller |
engine |
DataFlowEngine |
resolver |
GoalKeyResolver |
agent |
DeclarativeDataFlowAgent, ConfigurableOrchestrator |
session |
SessionStore, SESSION_STORE |
inference |
run_medgemma, load_medgemma, set_pipeline |
retriever |
BM25ToolRetriever |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
nanoathens-0.1.1.tar.gz
(21.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nanoathens-0.1.1.tar.gz.
File metadata
- Download URL: nanoathens-0.1.1.tar.gz
- Upload date:
- Size: 21.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9ed63ff7a2666d1c0575c01f729f4fc6d315b917d1989dc155bd9958f5e8d2de
|
|
| MD5 |
b8100a6983c7282dcbdbab23dc1373a7
|
|
| BLAKE2b-256 |
bced4ad7496b32970396927f835b7b7227bf1ea8ca4c24af0058dc87a9c86c48
|
File details
Details for the file nanoathens-0.1.1-py3-none-any.whl.
File metadata
- Download URL: nanoathens-0.1.1-py3-none-any.whl
- Upload date:
- Size: 24.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d107942403a93c944770cf1c2695e49b1b8d4992c60adfd5ac992a5f23929d17
|
|
| MD5 |
035febccd601d0b69176ffec67f12f3e
|
|
| BLAKE2b-256 |
eee67e792cd9919a51ebcfedba843c9403c02f4df3099320c9c893eac2acc4de
|