Skip to content

Graph-Native Infrastructure for Context and Accountable AI Systems

Replace cross-system input placeholder with backend capture path

KaifAhmad189d60301ce96
diff --git a/semantica/context/agent_context.py b/semantica/context/agent_context.py
index e7d41883..9d4a5230 100644
--- a/semantica/context/agent_context.py
+++ b/semantica/context/agent_context.py
@@ -1957,17 +1957,44 @@ class AgentContext:
Returns:
Cross-system context
"""
- # This is a placeholder for cross-system context capture
- # In practice, this would integrate with various systems
context = {}
-
+
for system in systems:
- context[system] = {
+ captured_at = datetime.now().isoformat()
+ payload: Dict[str, Any] = {
"entity_id": entity_id,
"system_name": system,
- "captured_at": datetime.now().isoformat(),
- "status": "captured"
+ "captured_at": captured_at,
}
+
+ try:
+ # GraphStore-backed capture path
+ if self.knowledge_graph and hasattr(self.knowledge_graph, "execute_query"):
+ query = """
+ MATCH (c:CrossSystemContext {system_name: $system_name})
+ WHERE c.context_data IS NOT NULL
+ RETURN c
+ ORDER BY c.created_at DESC
+ LIMIT 5
+ """
+ result = self.knowledge_graph.execute_query(
+ query, {"system_name": system}
+ )
+ records = result.get("records", []) if isinstance(result, dict) else result
+ payload["status"] = "captured"
+ payload["records_found"] = len(records) if isinstance(records, list) else 0
+ payload["records"] = records if isinstance(records, list) else []
+ else:
+ payload["status"] = "captured_without_backend"
+ payload["records_found"] = 0
+ payload["records"] = []
+ except Exception as e:
+ payload["status"] = "capture_failed"
+ payload["error"] = str(e)
+ payload["records_found"] = 0
+ payload["records"] = []
+
+ context[system] = payload
return context