Skip to content

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

chore: files changed AGENTS.md,Cargo.toml,crates/openhuman-embed/Cargo.toml,crates/openhuman-embed/R

Steven Enamakel751f6d75bdf6
diff --git a/AGENTS.md b/AGENTS.md
index 83db26fc7b..6909357a7a 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -15,6 +15,7 @@ Architecture: [overview](gitbooks/developing/architecture.md),
| `app/src/` | Vite and React frontend |
| `crates/openhuman-app/` | Thin desktop host |
| `crates/openhuman-core/` | Core package wrappers, transport, dispatch, auth, and runtime composition |
+| `crates/openhuman-embed/` | Stable library facade for embedding the core in another product |
| `crates/openhuman-tui/` | Standalone terminal frontend |
| `src/openhuman/` | Business domains |
| `crates/openhuman-core/src/main.rs` | `openhuman-core` CLI |
diff --git a/Cargo.toml b/Cargo.toml
index 4250e52c8e..14adac6638 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -4,7 +4,7 @@
# resolve against their own roots.
[workspace]
resolver = "2"
-members = ["crates/openhuman-core", "crates/openhuman-tui"]
+members = ["crates/openhuman-core", "crates/openhuman-embed", "crates/openhuman-tui"]
exclude = [
"vendor",
"worktrees",
diff --git a/crates/openhuman-embed/Cargo.toml b/crates/openhuman-embed/Cargo.toml
new file mode 100644
index 0000000000..d9e38f34b7
--- /dev/null
+++ b/crates/openhuman-embed/Cargo.toml
@@ -0,0 +1,38 @@
+[package]
+name = "openhuman-embed"
+description = "Stable library facade for embedding OpenHuman in another application"
+version.workspace = true
+edition.workspace = true
+license.workspace = true
+repository.workspace = true
+readme = "README.md"
+publish = false
+
+[features]
+default = ["openhuman-core/default"]
+http-server = ["openhuman-core/http-server"]
+inference = ["openhuman-core/inference"]
+documents = ["openhuman-core/documents"]
+hosting = ["openhuman-core/hosting"]
+modules = ["openhuman-core/modules"]
+voice = ["openhuman-core/voice"]
+web3 = ["openhuman-core/web3"]
+runtime-node = ["openhuman-core/runtime-node"]
+contacts = ["openhuman-core/contacts"]
+media = ["openhuman-core/media"]
+flows = ["openhuman-core/flows"]
+skills = ["openhuman-core/skills"]
+mcp = ["openhuman-core/mcp"]
+crash-reporting = ["openhuman-core/crash-reporting"]
+medulla = ["openhuman-core/medulla"]
+channels = ["openhuman-core/channels"]
+sandbox-landlock = ["openhuman-core/sandbox-landlock"]
+sandbox-bubblewrap = ["openhuman-core/sandbox-bubblewrap"]
+peripheral-rpi = ["openhuman-core/peripheral-rpi"]
+browser-native = ["openhuman-core/browser-native"]
+whatsapp-web = ["openhuman-core/whatsapp-web"]
+file-logging = ["openhuman-core/file-logging"]
+scheduler-gate = ["openhuman-core/scheduler-gate"]
+
+[dependencies]
+openhuman-core = { path = "../openhuman-core", package = "openhuman", default-features = false }
diff --git a/crates/openhuman-embed/README.md b/crates/openhuman-embed/README.md
new file mode 100644
index 0000000000..9bb8f5757d
--- /dev/null
+++ b/crates/openhuman-embed/README.md
@@ -0,0 +1,53 @@
+# `openhuman-embed`
+
+`openhuman-embed` is the host-facing library package for products that run the
+OpenHuman core in-process, including Medulla and OpenCompany. It re-exports the
+typed embedding facade and runtime builder while keeping the implementation in
+`openhuman-core`.
+
+Use the default contributor feature set:
+
+```toml
+[dependencies]
+openhuman-embed = { git = "https://github.com/tinyhumansai/openhuman", package = "openhuman-embed" }
+```
+
+Or select a narrow host build:
+
+```toml
+[dependencies]
+openhuman-embed = { git = "https://github.com/tinyhumansai/openhuman", package = "openhuman-embed", default-features = false, features = ["inference", "mcp"] }
+```
+
+```rust,no_run
+use std::sync::Arc;
+
+use openhuman_embed::{Core, CoreBuilder, DomainSet, HostKind, ServiceSet};
+
+# async fn run() -> Result<(), Box<dyn std::error::Error>> {
+let runtime = CoreBuilder::new(HostKind::Library)
+ .domains(DomainSet::embedded())
+ .services(ServiceSet::none())
+ .build()
+ .await?;
+let core = Core::from_runtime(Arc::new(runtime));
+let flags = core.config().runtime_flags().await?;
+println!("log_prompts={}", flags.log_prompts);
+# Ok(())
+# }
+```
+
+Embedding products should set their product identity once during startup,
+before constructing backend clients:
+
+```rust
+use openhuman_embed::{set_product_identity, ProductIdentity};
+
+if let Some(identity) = ProductIdentity::new("opencompany") {
+ set_product_identity(identity);
+}
+```
+
+Use `Core::raw()` only as a temporary escape hatch when the typed facade does
+not yet model a required call. A repeated raw call is a candidate for a typed
+embedding method in `openhuman-core`.
diff --git a/crates/openhuman-embed/src/lib.rs b/crates/openhuman-embed/src/lib.rs
new file mode 100644
index 0000000000..b507f63980
--- /dev/null
+++ b/crates/openhuman-embed/src/lib.rs
@@ -0,0 +1,34 @@
+//! Stable library facade for products that embed OpenHuman in-process.
+//!
+//! This package gives hosts such as Medulla and OpenCompany an intentionally
+//! small dependency surface while [`openhuman_core`] remains the implementation
+//! crate. Build a [`CoreRuntime`], wrap it in [`Core`], and call typed domain
+//! facades; or use [`Harness`] for the higher-level prompt-to-reply API.
+//!
+//! ```no_run
+//! # async fn example() -> Result<(), Box<dyn std::error::Error>> {
+//! use std::sync::Arc;
+//! use openhuman_embed::{Core, CoreBuilder, DomainSet, HostKind, ServiceSet};
+//!
+//! let runtime = CoreBuilder::new(HostKind::Library)
+//! .domains(DomainSet::embedded())
+//! .services(ServiceSet::none())
+//! .build()
+//! .await?;
+//! let core = Core::from_runtime(Arc::new(runtime));
+//! let flags = core.config().runtime_flags().await?;
+//! println!("log_prompts={}", flags.log_prompts);
+//! # Ok(())
+//! # }
+//! ```
+//!
+//! Cargo features forward to the implementation crate. Disable defaults for a
+//! narrow host and opt into only the domains it needs.
+
+pub use openhuman_core::agent_progress;
+pub use openhuman_core::embed::*;
+pub use openhuman_core::{
+ CoreBuilder, CoreRuntime, DaemonConfig, DomainSet, HostKind, ServiceSet, TokenSource,
+};
+
+pub use openhuman_core::api::{product_identity, set_product_identity, ProductIdentity};
diff --git a/crates/openhuman-embed/tests/public_api.rs b/crates/openhuman-embed/tests/public_api.rs
new file mode 100644
index 0000000000..aac65d4ab5
--- /dev/null
+++ b/crates/openhuman-embed/tests/public_api.rs
@@ -0,0 +1,30 @@
+use std::sync::Arc;
+
+use openhuman_embed::{
+ set_product_identity, Access, Core, CoreBuilder, CoreRuntime, DomainSet, Harness, HostKind,
+ ProductIdentity, Provider, ServiceSet, Workspace,
+};
+
+#[test]
+fn exposes_the_host_facing_embedding_contract() {
+ fn accepts_core(_: Core) {}
+ fn accepts_builder(_: CoreBuilder) {}
+ fn accepts_runtime(_: Arc<CoreRuntime>) {}
+ fn accepts_harness(_: Harness) {}
+ fn accepts_access(_: Access) {}
+ fn accepts_provider(_: Provider) {}
+ fn accepts_workspace(_: Workspace) {}
+
+ let _ = accepts_core;
+ let _ = accepts_builder;
+ let _ = accepts_runtime;
+ let _ = accepts_harness;
+ let _ = accepts_access;
+ let _ = accepts_provider;
+ let _ = accepts_workspace;
+ let _ = DomainSet::embedded;
+ let _ = ServiceSet::none;
+ let _ = HostKind::Library;
+ let _ = set_product_identity;
+ assert!(ProductIdentity::new("opencompany").is_some());
+}