primus.documentation.test_documentation_kb_integration module

End-to-end integration test for the agent documentation knowledge base.

This test wires a real Tactus agent to the primus.documentation.repository.DocumentationRepository through the same primitives that production procedures use:

The model defaults to gpt-5.4-mini and can be overridden via PRIMUS_DOC_KB_TEST_MODEL.

The agent is given exactly three tools - docs_list, docs_get, and done - and a system prompt that instructs it to discover a topic from the index, fetch its body, and then signal completion via done. We then assert that the agent actually exercised the docs tools (rather than hallucinating an answer) and that its final done.reason references the canonical topic id from the loaded markdown.

The test is marked integration and is skipped automatically when OPENAI_API_KEY is not present, so it does not run in default CI but can be invoked explicitly with:

pytest -m integration primus/documentation/test_documentation_kb_integration.py
primus.documentation.test_documentation_kb_integration.doc_tools(repo: DocumentationRepository)
primus.documentation.test_documentation_kb_integration.repo() → DocumentationRepository
primus.documentation.test_documentation_kb_integration.test_console_chat_prompt_drives_real_agent_to_use_docs(repo)

Live: the built-in Console chat prompt makes gpt-5.4-mini consult primus.docs.

primus.documentation.test_documentation_kb_integration.test_tactus_agent_can_explain_how_to_set_up_a_new_score(doc_tools, repo: DocumentationRepository)

A real Tactus agent should consult the docs to walk through a how-to.

primus.documentation.test_documentation_kb_integration.test_tactus_agent_can_look_up_score_authoring_topic(doc_tools)

A real Tactus agent should discover the score YAML topic via docs_list.