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.0.tar.gz (17.7 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.0-py3-none-any.whl (19.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nanoathens-0.1.0.tar.gz
  • Upload date:
  • Size: 17.7 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.0.tar.gz
Algorithm Hash digest
SHA256 24e3404deb790fb97cb6b8185a1b23d980b0d37b2eac66064f0844769d7f64f6
MD5 db20dc19661376fac6a499f02c3db23d
BLAKE2b-256 7859cf27a02d2d7d8dde69bf3ce4a12fea76667422e410289380050b8ceddaa3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanoathens-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 100224fe1e3d9843f7bd70584180ec8bd9eba1b9f1b5bf0b320f19a0cc5627a0
MD5 0384c7519840050d544b3e7c04105461
BLAKE2b-256 470bad819ca02a30ba558bfcbee631af13e8d5651d72a40e23268070bf81e7df

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