Skip to content

Rust API

Flow’s engine is a Rust workspace. Every shell drives the same core through the same public APIs. This includes the desktop app, the HTTP server, the CLI, and the TUI. Anything documented here behaves identically across editions.

CrateRole
flow-domainPure types: FlowGraph, FlowNode, FlowEdge, the AI node contract. No I/O.
flow-securityKeyring access, PII sanitizer, path confinement, sandbox profiles.
flow-storageSQLite store: runs, steps, AI audit records, schedules, templates index.
flow-executionThe executor: scheduling, adapters registry, event stream, AI tool loop, staging.
flow-adapter-aiAI provider registry (local llama-server + cloud providers) behind one request type.
flow-adapter-shell / -fs / -cli / -utilityAction adapters: sandboxed shell, jailed filesystem, vendor-neutral CLI tools, utilities.
flow-applicationFlowApp, the orchestrator facade every host embeds. Owns settings, storage, models, runs.
flow-dslThe Flow DSL parser and serializer. Pure, no I/O.
flow-models-serverManaged llama-server subprocess lifecycle (fetch, start, stop, status).
flow-serverThe HTTP/SSE host exposing FlowApp for the browser edition.
flow-cliThe flow binary: headless runs, generation, and the full-screen TUI.

Dependencies point strictly downward:

flow-domain
-> flow-security, flow-storage
-> flow-execution, flow-adapter-ai
-> flow-adapter-{shell, fs, cli, utility}
-> flow-application (FlowApp)
-> hosts: flow-desktop (Tauri), flow-server, flow-cli

flow-dsl is independent of the stack and is a pure parser. flow-spec is build-time only and feeds the generated DSL spec.

  • To embed the engine, start with flow-application. One struct, FlowApp, is the entire integration surface.
  • To watch or drive runs, start with flow-execution. It covers events, run control, and the AI tool loop.
  • For graph and contract types, see flow-domain and flow-dsl.
  • To add an action adapter, see adapters.
  • For storage, the HTTP host, and the model server, see services.

The deeper, exhaustive reference is the generated rustdoc (cargo doc --workspace). These pages curate the surfaces hosts actually use.