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

Function test_agent_build_augmented_system_prompt

core/src/agent/tests.rs:1661–1692  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1659
1660#[tokio::test]
1661async fn test_agent_build_augmented_system_prompt() {
1662 let mock_client = Arc::new(MockLlmClient::new(vec![MockLlmClient::text_response("OK")]));
1663
1664 let tool_executor = Arc::new(ToolExecutor::new("/tmp".to_string()));
1665
1666 let provider = MockContextProvider::new("test").with_items(vec![ContextItem::new(
1667 "doc-1",
1668 ContextType::Resource,
1669 "Auth uses JWT tokens.",
1670 )
1671 .with_source("viking://docs/auth")]);
1672
1673 let config = AgentConfig {
1674 prompt_slots: SystemPromptSlots {
1675 extra: Some("You are helpful.".to_string()),
1676 ..Default::default()
1677 },
1678 context_providers: vec![Arc::new(provider)],
1679 ..Default::default()
1680 };
1681
1682 let agent = AgentLoop::new(mock_client, tool_executor, test_tool_context(), config);
1683
1684 // Test building augmented prompt
1685 let context_results = agent.resolve_context("test", None).await;
1686 let augmented = agent.build_augmented_system_prompt(&context_results);
1687
1688 let augmented_str = augmented.unwrap();
1689 assert!(augmented_str.contains("You are helpful."));
1690 assert!(augmented_str.contains("<context source=\"viking://docs/auth\" type=\"Resource\">"));
1691 assert!(augmented_str.contains("Auth uses JWT tokens."));
1692}
1693
1694// ========================================================================
1695// Agentic Loop Integration Tests

Callers

nothing calls this directly

Calls 4

resolve_contextMethod · 0.80
test_tool_contextFunction · 0.70
with_itemsMethod · 0.45

Tested by

no test coverage detected