Skip to content

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

test(agent): cover memory block inheritance in core definitions

Steven Enamakelcaee4bb6f221
diff --git a/crates/openhuman-embed/src/agent/definition_tests.rs b/crates/openhuman-embed/src/agent/definition_tests.rs
index 75a1783dfd..479bc6c4f9 100644
--- a/crates/openhuman-embed/src/agent/definition_tests.rs
+++ b/crates/openhuman-embed/src/agent/definition_tests.rs
@@ -67,6 +67,33 @@ fn refresh_prompt_on_resume_reaches_the_core_definition_and_is_off_by_default()
);
}
+#[test]
+fn memory_block_reaches_the_core_definition_and_comes_from_a_template() {
+ let off = AgentDefinitionSpec::new().into_core("plain").unwrap();
+ assert_eq!(off.extensions.memory_block, None, "off unless asked for");
+
+ let template = AgentDefinitionSpec::new().memory_block(MemoryBlockSpec { max_tokens: 300 });
+ let inherited = AgentDefinitionSpec::new()
+ .inherit(template.clone())
+ .unwrap()
+ .into_core("inherits")
+ .unwrap();
+ assert_eq!(
+ inherited.extensions.memory_block.map(|block| block.max_tokens),
+ Some(300)
+ );
+ let own = AgentDefinitionSpec::new()
+ .memory_block(MemoryBlockSpec { max_tokens: 900 })
+ .inherit(template)
+ .unwrap()
+ .into_core("own")
+ .unwrap();
+ assert_eq!(
+ own.extensions.memory_block.map(|block| block.max_tokens),
+ Some(900)
+ );
+}
+
#[test]
fn refresh_prompt_on_resume_comes_from_a_template_or_base_unless_set() {
let template = AgentDefinitionSpec::new().refresh_prompt_on_resume(true);