MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_agent_memory_working_overflow_trims

Function test_agent_memory_working_overflow_trims

core/src/memory.rs:397–415  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

395
396 #[tokio::test]
397 async fn test_agent_memory_working_overflow_trims() {
398 let memory = AgentMemory {
399 store: Arc::new(InMemoryStore::new()),
400 short_term: Arc::new(RwLock::new(VecDeque::new())),
401 working: Arc::new(RwLock::new(Vec::new())),
402 max_short_term: 100,
403 max_working: 3,
404 relevance_config: RelevanceConfig::default(),
405 };
406 for i in 0..5 {
407 memory
408 .add_to_working(
409 MemoryItem::new(format!("task {i}")).with_importance(i as f32 * 0.2),
410 )
411 .await
412 .unwrap();
413 }
414 assert_eq!(memory.get_working().await.len(), 3);
415 }
416
417 #[tokio::test]
418 async fn test_agent_memory_recall_by_tags() {

Callers

nothing calls this directly

Calls 1

add_to_workingMethod · 0.80

Tested by

no test coverage detected