The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
docs(agent): document agent module and artifacts layout
Steven Enamakel4b2a13b31d3f
diff --git a/crates/openhuman-core/src/agent/README.md b/crates/openhuman-core/src/agent/README.mdindex 51264b68c7..25ef49a656 100644--- a/crates/openhuman-core/src/agent/README.md+++ b/crates/openhuman-core/src/agent/README.md@@ -274,11 +274,11 @@ Turn execution:| `harness/` | Agent definitions and loader, parent/fork context task-locals, sandbox and spawn-depth context, oversized tool-result artifacts, the channel/CLI turn graph ([README](harness/README.md)) || `bus.rs` | The `agent.run_turn` native request handler (`AgentTurnRequest` to `AgentTurnResponse`) || `progress.rs` | `AgentProgress`, the event enum every turn streams to its observer |-| [`progress_sink.rs`](./progress_sink.rs) | Task-local progress sink for in-process embedders driving an RPC that returns only text |+| [`progress_sink.rs`](./progress_sink.rs) | The `ProgressSink` channel type an in-process embedder hands a turn (carried on `AgentChatEnv`) |+| [`turn_env.rs`](./turn_env.rs) | `HostTurnEnv`: the explicit per-turn host values (budget, depth, cancellation, deadline, hooks, tool-belt authority) an entry point hands the session || [`progress_tracing.rs`](./progress_tracing.rs), `progress_tracing/` | OpenTelemetry/Langfuse-style spans built from the progress stream ([README](progress_tracing/README.md)) || `turn_origin.rs` | `AgentTurnOrigin` task-local, the trust and routing label the approval gate reads |-| [`turn_workspace.rs`](./turn_workspace.rs) | Task-local per-turn filesystem root an embedder binds one turn to |-| [`stop_hooks.rs`](./stop_hooks.rs) | `StopHook` mid-turn halts and the scoped `with_tool_call_limit` budget |+| [`stop_hooks.rs`](./stop_hooks.rs) | `StopHook` mid-turn halts and the `tool_call_limit` budget || [`tool_policy.rs`](./tool_policy.rs) | `ToolPolicy`, the pre-execution allow/deny hook installed through the builder || [`hooks.rs`](./hooks.rs) | `PostTurnHook` background hooks, including ones registered by embedders || [`queued_turn.rs`](./queued_turn.rs) | `QueuedTurn`, the payload for a message sent while a turn is running |@@ -418,11 +418,11 @@ What lives elsewhere:`register_agent_handlers` runs from [`channels/runtime/startup/start_channels.rs`](../channels/runtime/startup/start_channels.rs)and [`core/runtime/subscribers.rs`](../core/runtime/subscribers.rs); tests that replace the handler restoreit through the guard in `bus.rs`.-- `stop_hooks::with_tool_call_limit(Some(n), turn)` narrows the TinyAgents- invocation budget for one awaited turn, including parallel calls. Zero- permits no tool calls. Nested scopes take the smaller limit, `None` keeps- the enclosing one, and the limit applies per run, not as an aggregate- across child runs.+- `HostTurnEnv::tool_call_limit` (`Some(n)`) narrows the TinyAgents+ invocation budget for one turn tree, including parallel calls. Zero+ permits no tool calls, the host can only narrow the product default, and+ the limit applies per run, not as an aggregate across child runs. It rides+ the explicit `OpenHumanRunContext`, which children inherit.- `journal.rs` is best-effort. A journal write failure logs `[journal]` anddoes not fail the turn.diff --git a/crates/openhuman-core/src/agent/artifacts/README.md b/crates/openhuman-core/src/agent/artifacts/README.mdindex 229c6d3a51..974a766ee0 100644--- a/crates/openhuman-core/src/agent/artifacts/README.md+++ b/crates/openhuman-core/src/agent/artifacts/README.md@@ -20,7 +20,7 @@ renders artifact content itself.| [`types.rs`](./types.rs) | `ArtifactKind` (presentation/document/image/other), `ArtifactStatus` (pending/ready/failed), `ArtifactMeta`. Enums serialize lowercase; `parse` is case-insensitive and never errors (unknown kind → `Other`, unknown status → `Pending`). `ArtifactMeta.error` and `.thread_id` are optional, `skip_serializing_if` none. || [`files.rs`](./files.rs) | Where the bytes live: `reserve_file` (claims `<stem>.<ext>`, then `<stem> (2).<ext>`, with `create_new` in the shared files folder), `resolve_file` + the escape guard, `resolve_ready_file` (`pub`: the one id → existing-file lookup for readers and the desktop Download command), `remove_empty_placeholder`, the "file missing" error. || [`migrate.rs`](./migrate.rs) | `migrate_legacy_artifacts`: the idempotent, crash-safe boot move of pre-#5505 files into the files folder (copy to `.<id>.partial` → claim a name and rename → atomic meta write → delete legacy bytes). Run per account from `config::ensure_agent_dirs`. |-| [`store.rs`](./store.rs) | All filesystem I/O over `tokio::fs`: `artifacts_root`, `create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes` (`pub`); `save_artifact_meta`, `save_artifact_args`, `read_artifact_args`, `list_artifacts`, `get_artifact`, `delete_artifact` (`pub(crate)`); `validate_artifact_id` / `assert_within_root` sandboxing; the `REGENERATE_TARGET_ID` task-local; `sanitize_filename_stem`. |+| [`store.rs`](./store.rs) | All filesystem I/O over `tokio::fs`: `artifacts_root`, `create_artifact`, `finalize_artifact`, `fail_artifact`, `read_artifact_bytes` (`pub`); `save_artifact_meta`, `save_artifact_args`, `read_artifact_args`, `list_artifacts`, `get_artifact`, `delete_artifact` (`pub(crate)`); `validate_artifact_id` / `assert_within_root` sandboxing; `create_artifact_regenerating` (explicit regenerate target); `sanitize_filename_stem`. || [`ops.rs`](./ops.rs) | RPC business logic returning `Outcome<Value>`: `ai_list_artifacts`, `ai_get_artifact`, `ai_delete_artifact`, `ai_regenerate`. `DEFAULT_LIMIT = 50`, `MAX_LIMIT = 200`. The regenerate path that re-runs `PresentationTool` is `#[cfg(feature = "documents")]`; without the feature `ai_regenerate` returns an error. || [`schemas.rs`](./schemas.rs) | `ControllerSchema`s and `handle_*` fns for the four `ai.*` controllers; param helpers `read_required`, `read_optional_u64`, `read_optional_string` (whitespace-only → absent), `type_name`. || [`tools.rs`](./tools.rs) | `ArtifactListTool`, `ArtifactGetTool`, `ArtifactDeleteTool`: shims over `ops` that unwrap the `Outcome` and return `outcome.value` as the `ToolResult` string. |@@ -30,7 +30,7 @@ renders artifact content itself.- `ArtifactKind`, `ArtifactMeta`, `ArtifactStatus`.- Producer API, `pub` and re-exported from `mod.rs`:- - `create_artifact(workspace_dir, kind, title, extension) -> (ArtifactMeta, PathBuf)`: mints a UUID (or reuses `REGENERATE_TARGET_ID`), creates `<root>/<id>/`, writes a `Pending` `meta.json`, publishes `ArtifactPending`, and returns the absolute path the producer should write to (`<id>/<sanitized-title>.<ext>`).+ - `create_artifact(workspace_dir, kind, title, extension) -> (ArtifactMeta, PathBuf)`: mints a UUID (`create_artifact_regenerating` reuses an explicit regenerate target), creates `<root>/<id>/`, writes a `Pending` `meta.json`, publishes `ArtifactPending`, and returns the absolute path the producer should write to (`<id>/<sanitized-title>.<ext>`).- `finalize_artifact(workspace_dir, id, size_bytes)`: `Pending → Ready`, publishes `ArtifactReady`; no-op if already `Ready` with the same size.- `fail_artifact(workspace_dir, id, reason)`: `→ Failed`, stores `meta.error`, publishes `ArtifactFailed`. Logs only `reason.len()`, not the reason.- `read_artifact_bytes(workspace_dir, id)`: the one sanctioned id → bytes path; refuses non-`Ready` records.@@ -53,8 +53,8 @@ and trim string params.| `ai.regenerate` | `artifact_id`, `thread_id`, `client_id` (all required) | `{ artifact_id, regenerated: true, is_error }` |`ai.regenerate` only accepts `kind == presentation`, reloads `args.json`,-and re-runs `PresentationTool` inside `REGENERATE_TARGET_ID.scope(id, ..)`-and `APPROVAL_CHAT_CONTEXT.scope({thread_id, client_id}, ..)` so the same id+and re-runs `PresentationTool::with_regenerate_target(id)` inside+ `APPROVAL_CHAT_CONTEXT.scope({thread_id, client_id}, ..)` so the same idis reused and the Pending/Ready/Failed events route back to the originatingchat. The RPC result is an ack; the card state comes from the socket events.When `thread_id` is given to `list_artifacts`, legacy records with no