Skip to main content

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.3.tar.gz (21.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nanoathens-0.1.3-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

Details for the file nanoathens-0.1.3.tar.gz.

File metadata

  • Download URL: nanoathens-0.1.3.tar.gz
  • Upload date:
  • Size: 21.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.7

File hashes

Hashes for nanoathens-0.1.3.tar.gz
Algorithm Hash digest
SHA256 d41075cc627e8cfd796803032794f3b5f04dd4e9af038c0ae177a84862ca00d5
MD5 364c2bd66d8a284f1abcb589873c0ae7
BLAKE2b-256 cfaef83b7aa79704b67bf5c15aaa5fc3cb5b259bcca22e63d40ce0ee6abae1b4

See more details on using hashes here.

File details

Details for the file nanoathens-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nanoathens-0.1.3-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

Hashes for nanoathens-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5e8fe045925ecfc60dd2b6aeec80e5fbe5d1b61d65800da33e7e95bf64bb90bc
MD5 0bca89003571612d97254f69b42d23bb
BLAKE2b-256 b39bb933e08ff98748bf0ef617b2626d223fc17c1607b48216b6b14974b9d44c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page