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.2.tar.gz (21.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.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

Hashes for nanoathens-0.1.2.tar.gz
Algorithm Hash digest
SHA256 75f520548e7a3b7f2c52fd480567c1faac80a640d63c98c5836ad8ffee81d16f
MD5 948aa54a0a480e8ffc9847439252fd79
BLAKE2b-256 54468699b519a6e5a176009739696c16b7cfd8f7229fec12b633b45d320d5372

See more details on using hashes here.

File details

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

File metadata

  • Download URL: nanoathens-0.1.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 705377500b2042e016fcdae155d7a21bb4782afe637caa16e3e573cffd3e34ea
MD5 3bef254ac7ba16cc125843c88bee46e5
BLAKE2b-256 a5c1f2f28ed1376d367fece77659d8267abd3ef975acf77e9bcde1dd72df975d

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