Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

test: cover add_decision kwargs form and VectorStore inmemory backend

KaifAhmad1f8ec5ac01097
diff --git a/tests/context/test_agent_context_smoke.py b/tests/context/test_agent_context_smoke.py
index 51b03250..07813c47 100644
--- a/tests/context/test_agent_context_smoke.py
+++ b/tests/context/test_agent_context_smoke.py
@@ -39,6 +39,24 @@ def test_agent_context_minimal_decisions_and_chain():
assert len(chain) >= 1
+def test_agent_context_inmemory_store_and_retrieve():
+ """VectorStore(backend="inmemory") stores memories without faiss-cpu."""
+ vs = VectorStore(backend="inmemory")
+ ctx = AgentContext(
+ vector_store=vs,
+ knowledge_graph=ContextGraph(),
+ decision_tracking=True,
+ kg_algorithms=False,
+ vector_store_features=False,
+ )
+ memory_id = ctx.store(
+ "GPT-4 outperforms GPT-3.5 on reasoning benchmarks by 40%",
+ conversation_id="test_session",
+ )
+ assert isinstance(memory_id, str)
+ assert len(memory_id) > 0
+
+
def test_agent_context_policy_engine_with_graph_backend():
vs = VectorStore(backend="inmemory", dimension=64)
graph = ContextGraph()
diff --git a/tests/context/test_context_graph_decisions.py b/tests/context/test_context_graph_decisions.py
index 801634a7..f8dc9b4e 100644
--- a/tests/context/test_context_graph_decisions.py
+++ b/tests/context/test_context_graph_decisions.py
@@ -49,6 +49,38 @@ class TestContextGraphDecisions:
assert node.properties["confidence"] == sample_decision.confidence
assert node.properties["decision_maker"] == sample_decision.decision_maker
+ def test_add_decision_kwargs_form(self, context_graph):
+ """add_decision() accepts kwargs directly (no Decision object required)."""
+ decision_id = context_graph.add_decision(
+ category="loan_approval",
+ scenario="Mortgage application — 780 credit score",
+ reasoning="Strong credit history, low DTI",
+ outcome="approved",
+ confidence=0.95,
+ )
+
+ assert isinstance(decision_id, str)
+ assert len(decision_id) > 0
+ node = context_graph.nodes[decision_id]
+ assert node.node_type in ("Decision", "decision")
+ assert node.properties["category"] == "loan_approval"
+ assert node.properties["outcome"] == "approved"
+ assert node.properties["confidence"] == 0.95
+
+ def test_add_decision_kwargs_and_object_both_return_id(self, context_graph, sample_decision):
+ """Both call forms return a non-empty decision ID string."""
+ id_from_object = context_graph.add_decision(sample_decision)
+ id_from_kwargs = context_graph.add_decision(
+ category="test",
+ scenario="test scenario",
+ reasoning="test reasoning",
+ outcome="approved",
+ confidence=0.8,
+ )
+
+ assert isinstance(id_from_object, str) and len(id_from_object) > 0
+ assert isinstance(id_from_kwargs, str) and len(id_from_kwargs) > 0
+
def test_add_decision_with_embeddings(self, context_graph):
"""Test adding decision with embeddings."""
decision = Decision(