1. Building blocks
  2. Inputs and files

A run starts with an input, steps pass values and files to each other, and the last step’s return value is the result.

Rendering diagram…

​
Run input

Declare the input as a model and name it on the workflow. Every run’s input is checked against it before any step starts.

class InvoiceInput(ava.BaseInput):
    text: str
    currency: Literal["USD", "EUR"] = "USD"
    scan: ava.File | None = None


@ava.workflow(input=InvoiceInput)
def process_invoice():
    return read_document(ava.input.text) >> build_entry()
A step gets the input byExample
Selecting one field in the workflowread_document(ava.input.text)
Declaring a parameter typed with the input modeldef load(config: InvoiceInput)

An input that does not fit the model fails the run once, with the list of invalid fields.

​
In the UI

The operator builds a form from the input model: one field per attribute, defaults as placeholders, a file picker for ava.File fields.

​
Files

ava.File is one file. It travels between steps by reference: the bytes are not copied into the run’s data.

@ava.step
def render(entry: dict) -> ava.File:
    path = Path("entry.csv")
    path.write_text(to_csv(entry))
    return ava.File.from_path(path)


@ava.step
def count_lines(report: ava.File) -> int:
    return len(report.read_bytes().splitlines())
On a fileGives
ava.File.from_path(path)A file from a path on disk
file.name, file.size, file.content_typeIts name, size in bytes and type
file.read_bytes()Its content
file.open()A read-only file handle
file.pathIts location on disk, inside a step

​
Workspaces

ava.Workspace is a whole folder. ava.Workspace() is the run’s own folder: created on first use, shared by every step of the run, and kept with the run.

@ava.step
def write_notes(ws: ava.Workspace) -> ava.Workspace:
    (ws.path / "notes.md").write_text("...")
    return ws


@ava.workflow
def notes():
    return write_notes(ava.Workspace()) >> summarize()
ava.Workspace()The current run’s folder
ava.Workspace.from_path(dir)A copy of an existing folder, taken once
ws.pathThe folder on disk, inside a step

Agents can work in a workspace.

​
Results

A step, and a workflow, can return:

TypeNotes
Text, numbers, booleans, None
Lists, tuples, dicts with text keys
Pydantic models, dataclasses
ava.File, ava.WorkspaceBy reference

A step’s output is limited to 8 MiB of data. Return an ava.File for anything larger.