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(embed): clarify agent teardown and MCP cleanup semantics
Steven Enamakel43cbf2f349dd
diff --git a/crates/openhuman-embed/src/agent/mod.rs b/crates/openhuman-embed/src/agent/mod.rsindex 011f8e2fa6..90970b7082 100644--- a/crates/openhuman-embed/src/agent/mod.rs+++ b/crates/openhuman-embed/src/agent/mod.rs@@ -144,9 +144,9 @@ pub(crate) struct AgentInner {}impl AgentInner {- /// Releases what the core keeps for this agent: parked approvals are- /// denied with `resolution`, its state slots and MCP host are dropped,- /// and its context leaves the registry. Runs once.+ /// Denies parked approvals, clears state slots and deregisters the context.+ /// Captures the original MCP owner's cleanup without creating a client;+ /// explicit removal awaits it and final drop schedules it. Runs once.pub(crate) fn teardown(&self, resolution: &str) {if !self.lifecycle.begin_teardown() {return;@@ -199,7 +199,7 @@ impl Drop for AgentInner {/// A handle to one agent on a runtime.////// Cheap to clone; every clone drives the same agent. The id is released for-/// reuse once the last clone is dropped. Dropping an agent does **not** remove+/// reuse after the last clone's MCP cleanup completes. Dropping an agent does **not** remove/// its directories — its transcripts and memory persist with the runtime's/// workspace.#[derive(Clone)]diff --git a/crates/openhuman-embed/src/runtime/lifecycle.rs b/crates/openhuman-embed/src/runtime/lifecycle.rsindex dfc49e4256..9c0f8e95f2 100644--- a/crates/openhuman-embed/src/runtime/lifecycle.rs+++ b/crates/openhuman-embed/src/runtime/lifecycle.rs@@ -83,10 +83,15 @@ impl Runtime {/// [`CoreError::AgentRemoved`](crate::CoreError::AgentRemoved); its parked/// approvals are denied with resolution `agent_removed`; turns in/// flight end with the same error, waited on for up to ten seconds; its- /// state slots and MCP host are dropped and its context deregistered, so+ /// state slots are cleared, its original MCP object is closed, and its context deregistered, so/// its cron jobs stay dormant. The id is free for reuse once cleanup ends./// Cancelling an already-started removal still tears down the old instance/// and performs a requested purge before releasing its id.+ /// A failed close returns [`AgentError::McpCleanup`] and leaves the id and+ /// purge intent reserved. Detached cleanup makes at most three attempts on+ /// the process executor. Call this method again to retry the captured owner,+ /// including after the last agent handle was dropped. Runtime drop does+ /// not execute the process signal's shutdown hooks.////// Cancellation is cooperative: a tool already executing when the agent/// is removed, or a sub-agent it detached, may finish after this returns.