Skip to main content

Athena Labs Python SDK for agentic ML workflow orchestration

Project description

buildathena-sdk

PyPI version Python 3.11+ Status: Alpha

Python SDK for building blocks and workflows on the Athena Labs ML orchestration platform. Athena Labs makes ML workflows reproducible, observable, interruptible, and composable through a DAG execution engine with an AI agent that can build, run, monitor, and fix pipelines.

Alpha software — APIs may change between releases. Pin your version in production.

Installation

pip install buildathena-sdk

Requires Python 3.11+.

Quick Start

Define a block with a Pydantic config class, emit metrics and progress, and register artifacts:

from pydantic import BaseModel
from athena import block, BlockContext

class TrainConfig(BaseModel):
    epochs: int = 100
    learning_rate: float = 1e-3

@block(name="TrainModel", outputs=["checkpoint"], config=TrainConfig)
async def train_model(ctx: BlockContext, config: TrainConfig) -> dict:
    for epoch in range(config.epochs):
        loss = train_epoch(lr=config.learning_rate)
        await ctx.emit_metric("loss", loss, epoch=epoch)
        await ctx.emit_progress(epoch + 1, config.epochs)
        await ctx.check_pause()  # cooperative pause point

    ref = await ctx.artifacts.register("model.pt", schema_type="checkpoint")
    return {"checkpoint": ref}

Consuming Inputs

Blocks declare their inputs and access upstream outputs through ctx.inputs:

@block(name="Evaluate", inputs=["checkpoint"], outputs=["report"])
async def evaluate(ctx: BlockContext, config) -> dict:
    model = load_model(ctx.inputs["checkpoint"])
    score = run_eval(model)
    await ctx.emit_metric("accuracy", score)
    return {"report": {"accuracy": score}}

Credentials

Declare required secrets in the @block decorator and access them at runtime via ctx.secrets. Credentials are encrypted at rest and injected only during execution:

@block(name="FetchData", secrets=["API_KEY"], outputs=["dataset"])
async def fetch_data(ctx: BlockContext, config) -> dict:
    key = ctx.secrets["API_KEY"]
    data = await download(api_key=key)
    return {"dataset": data}

Cooperative Pause

Call check_pause() inside long-running loops to let Athena Labs pause the block between iterations without losing progress:

for epoch in range(config.epochs):
    train_step()
    await ctx.check_pause()  # yields control if a pause was requested

BlockContext API

Method / Accessor Description
ctx.inputs["name"] Access upstream block outputs
ctx.secrets["KEY"] Access declared secrets
await ctx.emit_metric(name, value, epoch=, step=, **labels) Emit a named metric
await ctx.emit_progress(current, total, message=) Emit progress (current/total)
await ctx.emit_event(type, name, payload) Emit a custom event
await ctx.check_pause() Cooperative pause checkpoint
await ctx.artifacts.register(path, schema_type=, name=, tags=, metadata=) Register an artifact

Config System

Athena Labs supports YAML configuration with composition, inheritance, and variable substitution:

# base.yaml
training:
  epochs: 100
  optimizer: adam

# experiment.yaml
$extends: base.yaml
training:
  epochs: 200
  learning_rate: ${LR:-1e-3}

See the full config docs for $include, $extends, and ${ref} substitution.

Other Decorators

@handler — Custom Storage Backends

Resolve custom URI schemes (e.g., s3://, gs://) for artifact storage:

from athena import handler

@handler(schemes=["s3"], name="S3Handler")
class S3Handler:
    async def get(self, key: str) -> bytes: ...
    async def put(self, key: str, data: bytes) -> str: ...

@inspector_backend — Interactive UI Plugins

Build interactive inspector panels that attach to running workflows:

from athena import inspector_backend

@inspector_backend
class LossPlotBackend:
    async def initialize(self, ctx) -> None: ...
    async def handle_message(self, msg: dict) -> dict: ...
    async def cleanup(self) -> None: ...

Documentation

License

Proprietary - Copyright (c) 2026 Athena Labs Research Inc. All rights reserved.

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

buildathena_sdk-0.1.64.tar.gz (71.1 kB view details)

Uploaded Source

Built Distribution

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

buildathena_sdk-0.1.64-py3-none-any.whl (45.4 kB view details)

Uploaded Python 3

File details

Details for the file buildathena_sdk-0.1.64.tar.gz.

File metadata

  • Download URL: buildathena_sdk-0.1.64.tar.gz
  • Upload date:
  • Size: 71.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.0

File hashes

Hashes for buildathena_sdk-0.1.64.tar.gz
Algorithm Hash digest
SHA256 048bda66c8523dc3ec575a8d7c35167b73d00ccce707a7f2c5c043cbd62ff4c3
MD5 3c2ad018eecf4fb54c285b9e1b0eda38
BLAKE2b-256 ad3e1fa4d64ada1525f098b90750bff4363e8ffa570ed4d29228f6d09ee8bb5c

See more details on using hashes here.

File details

Details for the file buildathena_sdk-0.1.64-py3-none-any.whl.

File metadata

File hashes

Hashes for buildathena_sdk-0.1.64-py3-none-any.whl
Algorithm Hash digest
SHA256 0596f040bdb0dc86e27157df81cff55877f19f16c7148940627515e43657036c
MD5 3a521798e45191223eb4e0fab75d6d6d
BLAKE2b-256 3996440d6466106805316ae371fe95e49d51b92a635dd894e7327607d4763594

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