Repository navigation
[AI] Define optional runtime profiles, local model preparation and existing provider routing #80
Description
Outcome
Make optional AI-assisted stages usable across Flow, Renderflow, Aniflow, and Optiflow through explicit local or remote runtime profiles. Reuse maintained provider libraries or gateways and the existing extension contracts; keep ordinary media workflows usable with AI disabled.
The first proof is one useful, schema-validated Renderflow summary candidate from approved textual source material, followed by bounded domain consumers. This is an integration capability, not a new general model router or autonomous agent platform.
Existing owners and overlap
- Flow #7: extension envelopes, explicit effects, provider locks, secret handles, transform/observer boundaries and recovery.
- Flow #10: comic workflow.
- Flow #78: reusable AMV recipe.
- Renderflow #396, #309, #257, #258: existing model catalog, skill runtime, Ollama/OpenAI-compatible adapters and cache.
- Flow #14 and children [FLO-OBS-01] Define the suite observability, privacy, and stream contract #15–[FLO-OBS-07] Add privacy-safe diagnostics and operator runbooks #21: existing suite observability, OTLP and diagnostic reporting. This issue consumes that track rather than duplicating it.
- Each holon retains its domain schemas, validation, standalone CLI/library and release lifecycle. No sibling source imports or holon-to-Flow dependency.
Bounded checkpoints
- Choose the integration seam. Inventory existing domain clients and compare a narrow Rust provider library (for example genai or Rig's provider core) with an optional maintained gateway such as LiteLLM. Record maintenance/MSRV/license/dependency weight, locality, modality and structured-output limitations. Select the smallest justified approach; reuse working Renderflow adapters where sufficient. A common HTTP shape does not imply equal capabilities.
- Prepare and configure explicitly. Define an interoperability profile over existing extension envelopes, model-bundle preparation evidence, effective configuration and redacted diagnostics. Produce reviewable synthetic examples.
- Prove one consumer. Connect a released Renderflow capability and a synthetic comic-summary example; retain typed unavailable/refused/invalid/cancelled states and review-required artifacts. Domain consumers own their adapters.
- Qualify operation and reporting. Exercise the selected local profile on recorded hardware, optionally compare an explicitly authorized hosted profile, and correlate execution/reporting with the existing observability track. Real-provider qualification is separate from hermetic mock tests.
Use focused reviewable PRs and sync after each checkpoint. Issue capture starts no implementation, installation, download, model invocation, paid request, merge or publication.
Acceptance criteria
- Distinguish a local inference runtime, provider library/gateway, a bounded inference step, and an optional iterative agent. A tool-use loop is added only for a task that needs it; declare its tool allowlist and maximum calls/steps.
- Preserve deterministic/non-AI operation. Enabling AI is explicit; credentials or an installed runtime alone do not enable it.
- Support disabled, local-only/offline, explicitly permitted remote, unavailable, failed, awaiting-review and produced states. An approved loopback/local endpoint can operate without external network access. A local service's own cloud features/egress must be disabled or explicitly declared; a loopback URL alone is not proof of offline execution.
- Provide a separate opt-in preparation path for a selected local runtime/model bundle. Record source/revision, observed weight/config digests where available, size/storage estimates, model and code licenses separately, quantization, device/runtime compatibility, memory/context/concurrency guidance, preparation outcome and rollback/removal guidance. Validate artifacts through the runtime's supported identity mechanisms; do not invent a universal model packaging format.
- Normal plan/run does not download models, install packages, silently choose a different model or start an unrequested service. Missing dependencies produce actionable doctor/setup results.
- Reuse existing configuration resolvers and document a compatible mapping for defaults, user/project recipes, recognized environment overrides and explicit CLI options. Deployment endpoints and credential handles stay separate from versioned nonsecret processing recipes. Unknown options and contradictory policies fail clearly; show redacted effective values and their sources.
- Secrets are resolved at the runtime boundary through explicit handles/environment indirection. Do not serialize keys, pass them in CLI arguments, broadly inherit environments, or forward secrets into generic extension payloads.
- Capability negotiation distinguishes text/image/audio/video, tools and schema-constrained output per model. Enforce input/context/output, deadline, attempts, calls/tokens and cost policies; report unsupported options rather than assuming provider equivalence.
- Preserve Flow's explicit prelaunch-only fallback and invocation/recovery semantics. Disable or constrain a gateway's automatic retries/fallback so it cannot cause undeclared remote/paid use or duplicate tool effects after invocation. A timeout or exhausted local model cannot silently become a paid/cloud request.
- Record requested and observed provider/model identities, local artifact digests when available, runtime/library version, template and schema revision, effective nonsecret settings, exact source/output references, cache identity and result validation. Cloud aliases/revisions and unknown evidence remain explicit; a fixed seed does not imply universal reproducibility.
- Model output is untrusted candidate data. Validate structure and task-specific evidence references; preserve prompt/data separation and human review. AI output cannot approve media acceptance, destructive changes, signatures or publication.
- Reuse [EPIC] Establish suite-wide observability and CLI experience #14–[FLO-OBS-07] Add privacy-safe diagnostics and operator runbooks #21 for bounded run/stage/provider correlation, latency, attempts, cache decisions, cancellation, validation and usage. Distinguish provider-reported cost, estimated cost with pricing revision, unknown cost and local resource measurements. Unknown is not zero.
- Prompt/source/media content, private paths and credentials are excluded from portable telemetry by default. Operational trace IDs, timing, sampling and exporter configuration do not affect artifact/cache/plan identities. Local structured reports work without a collector; optional OTLP uses a reviewed version of the evolving GenAI conventions.
- Hermetic fake-provider tests cover AI disabled, missing model, local-to-remote refusal, malformed/schema-invalid or unsupported output, prompt-injection-like source text, timeout/cancellation, changed model/profile/cache identity, bounded retries and exporter failure. No paid/live service is required in ordinary CI.
- A small redistribution-safe evaluation set measures source grounding, utility, latency, tokens when available, and local resources. Publish an accurate runnable demo with exact versions and remaining limits; model quality and real hardware checks are separate from deterministic test assertions.
Non-goals
Training a foundation model; copying existing Renderflow AI infrastructure; wrapping RIFE/Upscayl/FFmpeg in an LLM router; a mandatory always-on platform; building a new router, telemetry backend or shared crate without evidence; blanket rollout of agents; automatic model downloads, paid fallback, source mutation or posting. This optional track does not turn every finishing feature into a prerequisite for existing releases.
Primary references checked 2026-10-17
- Twelve-Factor configuration
- LiteLLM SDK/gateway and Ollama integration
- Rust genai and Rig
- Ollama local/runtime configuration
- Current OpenTelemetry GenAI conventions
Recheck maintenance and exact released versions at implementation time; these are evaluation candidates, not selected new dependencies.
Domain integration issues
- egohygiene/renderflow#456 — Add source-grounded publication summary candidates using shared runtime profiles
- egohygiene/aniflow#116 — Add optional source-bound AMV review notes using local or remote model profiles
- egohygiene/optiflow#133 — Add optional explanations of immutable inventory and optimization evidence
These are domain-owned consumers of the interoperability profile, not imports of Flow code. The first shared proof targets the Renderflow publication-summary consumer; Aniflow and Optiflow can author bounded fake-provider adapters in parallel once the seam is agreed.
October 21, 2026 audit reconciliation
Checkpoint 1 is useful independent work now: inventory current domain clients and select the smallest justified seam. The later profile, released renderflow summary consumer, model/hardware and optional remote reporting proofs remain staged gates. This audit adds no model router, model download, service, inference or new mandatory release dependency; preserve all original local-only, privacy, bounded-effect and human-review criteria.
Evidence: https://github.com/egohygiene/flow/blob/audit/flow-suite-20261021T025401Z/audits/flow-suite-20261021T025401Z.md. Complete roadmap and native issue hierarchy: #11. Original scope and historical handoffs above remain preserved.
Activity