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
feat(tinyagents): add operation and run context to host
Steven Enamakelace000df7c25
diff --git a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rsindex 903eda75f7..1925bac406 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/operation_context.rs@@ -95,3 +95,18 @@ pub(crate) fn tool_context_with_approval(tinyagents_harness::ids::CallId::new("approval-test-call"),)}++/// A tool execution context for a run that acts on memory as `identity`: what+/// the harness hands a tool dispatched inside that run.+#[cfg(test)]+pub(crate) fn tool_context_with_memory_identity(+ identity: crate::memory::scope::MemoryIdentity,+) -> tinyagents_harness::tool::ToolExecutionContext {+ let mut host = super::OpenHumanRunContext::new();+ host.memory_identity = Some(identity);+ let run = host.into_tinyagents(tinyagents_harness::context::RunConfig::new("memory-identity-test"));+ tinyagents_harness::tool::ToolExecutionContext::from_run_context(+ &run,+ tinyagents_harness::ids::CallId::new("memory-identity-test-call"),+ )+}diff --git a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rsindex 10245d1741..719ca0a854 100644--- a/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs+++ b/crates/openhuman-core/src/agent/tinyagents/host/run_context.rs@@ -418,7 +418,9 @@ pub(crate) use super::operation_context::{approval_for_tool, memory_identity_for_tool, parent_agent_id_for_tool, sandbox_mode_for_tool, HostOperationContext,};#[cfg(test)]-pub(crate) use super::operation_context::tool_context_with_approval;+pub(crate) use super::operation_context::{+ tool_context_with_approval, tool_context_with_memory_identity,+};/// OpenHuman product values that tools read from the run through/// `ToolExecutionContext::host::<OpenHumanRunExt>()`, installed bydiff --git a/crates/openhuman-core/src/memory/tools_tests.rs b/crates/openhuman-core/src/memory/tools_tests.rsindex 94e7c4f0cb..d5d7927729 100644--- a/crates/openhuman-core/src/memory/tools_tests.rs+++ b/crates/openhuman-core/src/memory/tools_tests.rs@@ -732,3 +732,23 @@ async fn memory_activity_carries_the_calling_turns_chat() {);assert_eq!(seen["unrouted marker question"], (None, None));}++/// The memory tool acts as the identity its run carries, not as whatever task+/// it happens to be polled on: a team member's learnings land in the team's+/// layout under the member's own memory agent id.+#[test]+fn gather_acts_as_the_identity_the_run_carries() {+ let config = Config::default();+ let context = crate::agent::tinyagents::host::run_context::tool_context_with_memory_identity(+ MemoryIdentity::team_member("acme", "scout"),+ );+ let facts = CallFacts::gather(&config, Some(&context));+ assert_eq!(facts.agent_id.as_deref(), Some("scout"));+ assert_eq!(facts.reach, Reach::subtree("team:acme".parse().unwrap()));+ assert_eq!(facts.namespace.to_string(), "team:acme");++ // A run that carries none, and direct dispatch, act as the root.+ let bare = CallFacts::gather(&config, None);+ assert_eq!(bare.agent_id.as_deref(), Some(super::super::scope::DEFAULT_AGENT_ID));+ assert!(bare.reach.at.is_root());+}