Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

docs(tinyflows): rewrite README to describe the graph vocabulary seam

Steven Enamakel7c240090e83c
diff --git a/crates/openhuman-core/src/flows/tinyflows/README.md b/crates/openhuman-core/src/flows/tinyflows/README.md
index 51c6b88151..09fba2b285 100644
--- a/crates/openhuman-core/src/flows/tinyflows/README.md
+++ b/crates/openhuman-core/src/flows/tinyflows/README.md
@@ -1,118 +1,11 @@
-# tinyflows capability seam
+# TinyFlows graph vocabulary
-Wires the vendored `tinyflows` workflow engine (validate → compile → run over
-its own in-crate state-graph runtime, [`vendor/tinyflows/`](../../../../../vendor/tinyflows/)) to real OpenHuman
-services. `tinyflows` knows nothing about OpenHuman. Every effect a flow node
-can have (calling an LLM, running an agent, making an HTTP request, running
-code, calling a tool, reading/writing state, resolving a sub-workflow,
-recalling/writing memory) is a trait the engine declares and this module
-implements. See
-[`docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md`](../../../../../docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md)
-for the engine's own model (trigger model, run state shape, the two-gate
-security model); this README covers only the host seam.
+`mod.rs` keeps a small compatibility namespace for the generic graph model and
+legacy graph migration used by OpenHuman's authoring, validation, and Catalog
+adapters.
-## Layout
-
-- [`mod.rs`](./mod.rs): export-focused. Re-exports `caps::build_capabilities` and
- `caps::open_flow_checkpointer`, the two entry points `flows::ops*.rs`
- calls to drive a run. The checkpointer is `tinyflows_drivers::DriverCheckpointer`
- on the flow catalog's storage; the `checkpoints.db` tinyflows used to write is
- imported once.
-- `caps/`: every capability adapter except `memory`, plus construction,
- curation, preflight, and invocation logic. `build_capabilities` also fills
- `tasks` with the engine's own `TokioTaskRunner` and deliberately leaves
- `shell` and `approvals` as `None` (no host shell adapter yet; approvals
- reuse the engine's pause/`flows_resume` fallback).
- - `ops.rs`: `build_capabilities` (assembles the `Capabilities` bundle for
- one run), `open_flow_checkpointer` (a `DriverCheckpointer` on the flow
- catalog's storage), and the `OpenHumanTools` / `PreflightToolInvoker`
- adapters. Composio curation, tier classification, connection references,
- and argument preflight live with the Composio owner under
- `integrations/composio/`; these adapters translate policy outcomes into
- the flow engine's capability errors.
- - `agent.rs`: `OpenHumanAgentRunner` (`AgentRunner`): resolves an `agent`
- node's trusted `agent_ref` and routes it to a full harness turn
- (`Agent::run_single`, a nested tinyagents graph) when a harness
- `AgentDefinition` exists, or to a persona-shaped `OpenHumanLlm::complete`
- when only a custom registry entry does. Also owns the timeout clamp and
- its scaling against the definition's iteration cap.
- - `llm.rs`: `OpenHumanLlm` (`LlmProvider`) over OpenHuman's inference
- stack; what an `agent` node falls back to without an agent runner, and
- what a raw completion node uses directly.
- - `prompt.rs`: message assembly, the `input_context` carrier and its size
- cap, and tolerant JSON extraction for structured-output nodes.
- - `http.rs`: `OpenHumanHttp` (`HttpClient`); inherits the allowlist and
- DNS-rebind protection of the underlying `HttpRequestTool` and adds
- `http_cred:<name>` credential resolution, injected after the approval
- gate computes its redacted summary so the secret never reaches the UI,
- graph, output, or logs.
- - `code.rs`: `OpenHumanCode` (`CodeRunner`); runs JS/Python through
- `sandbox::execute_in_sandbox` under `CODE_RUN_TIMEOUT_SECS`.
- - `StateStore` is `FlowState` (`state.rs`, `FlowStateDocuments`), namespaced per flow (`"flow:<id>"`) so saved flows never
- collide on a state key.
- - `resolver.rs`: `OpenHumanWorkflowResolver` (`WorkflowResolver`);
- resolves a `sub_workflow` node's id to a stored workflow.
- - `tier.rs`: `enforce_node_tier_gate` / `gate_call_for_tier`: the
- autonomy-tier and approval gate every acting node (tool call, HTTP
- request, code run, memory read/write) passes through first.
- - `tools/`: `tool_call` node dispatch, split by slug namespace:
- `native.rs` for the `oh:` prefix (native OpenHuman tools, same registry
- the assistant uses), `composio.rs` for everything else (Composio
- actions; must stay the catch-all backend since Composio slugs carry no
- prefix).
-- [`memory_adapter.rs`](./memory_adapter.rs): `OpenHumanMemory`, the `MemoryProvider` adapter for
- the `memory` node. Routes every operation through the same `tier.rs` gate
- pair as the other acting adapters (`CommandClass::Read` for
- `recall`/`search`/`flavour`/`people`, `CommandClass::Write` for
- `remember`/`forget`); `remember`/`forget` hard-refuse any scope other than
- `"flow"`. Scopes are memory v2 tag filters: `user` reads everything,
- `flow` reads the run's own `flow:<id>` items, `flows` reads every flow's
- items (tag `flows`), the same tags the `flow_memory_*` agent tools use.
- `recall` returns the engine's answer plus citations, `search` raw hits;
- `flavour` and `people` are unsupported in v2 (unknown slug / empty
- listing).
-- [`observability.rs`](./observability.rs): `tinyflows::observability::RunObserver` impls:
- `FlowRunObserver`, which persists live
- steps via `flows::upsert_flow_run_step` and publishes
- `DomainEvent::FlowRunProgress` twice per non-trigger node so the frontend
- can render a run live.
-- [`../ops/execution.rs`](../ops/execution.rs): after a run settles, reads the
- durable TinyFlows observation journal, adapts it to the bus-owned graph
- observation type, and calls the generic exporter in
- [`../../agent/progress_tracing/flow_export.rs`](../../agent/progress_tracing/flow_export.rs).
-
-## Security model
-
-The contract is spelled out in
-[flows-on-tinyagents.md § The security model: two gates](../../../../../docs/gitbooks/en/developing/architecture/flows-on-tinyagents.md#the-security-model-two-gates);
-this module holds the outer gate. `tier.rs` consults the user's autonomy
-tier for each acting node's `CommandClass` and forces an `ApprovalGate`
-round-trip on `Prompt`, even when the saved flow's own `require_approval` is
-false. Composio `tool_call` nodes additionally pass the deny-by-default
-curation check in `integrations/composio/flow_gate.rs` (`is_curated_flow_tool`), stricter than the
-agent loop's because a flow author's slug is free-form and never round-trips
-through live tool discovery; `tools/composio.rs` documents why the tier gate
-must run before curation. The inner gate (the agent definition's `ToolScope`
-and sandbox) applies to the nested harness turn `agent.rs` starts, with no
-new origin wrapper.
-
-## Used by
-
-`crates/openhuman-core/src/flows/ops*.rs` calls `build_capabilities` and
-`open_flow_checkpointer` to run or resume a flow, and
-the flow-run adapter in `ops/execution.rs` once a run settles.
-
-## Tests
-
-[`tinyflows_tests.rs`](./tinyflows_tests.rs) (capability-seam smoke tests against the real engine;
-note the real `HttpRequestTool` blocks loopback, so HTTP coverage asserts the
-SSRF/allowlist rejections rather than a mock round-trip),
-[`memory_adapter_tests.rs`](./memory_adapter_tests.rs) (the `memory` node adapter against an in-memory
-reference engine), plus a `<module>_tests.rs` file beside most modules
-above.
-
-## Further reading
-
-- [Parent module README](../README.md)
-- [Workflows](../../../../../docs/gitbooks/en/features/workflows.md)
-- [tinyflows](../../../../../vendor/tinyflows/README.md)
+Execution is owned by the compiled TinyFlows module and accessed through its
+TinyBus contracts. OpenHuman must not call TinyFlows compiler, engine,
+capability, checkpoint, run-row, or observer implementations directly. The
+host-side code in `flows/` is limited to contract adapters and OpenHuman policy
+callbacks.