From bbbf422d0e617bab58d74d96b123c28fce4e1261 Mon Sep 17 00:00:00 2001 From: Cyber MacGeddon Date: Wed, 3 Sep 2025 17:51:34 +0100 Subject: [PATCH] Agent confidence --- .../schema/services/agent_confidence.py | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 trustgraph-base/trustgraph/schema/services/agent_confidence.py diff --git a/trustgraph-base/trustgraph/schema/services/agent_confidence.py b/trustgraph-base/trustgraph/schema/services/agent_confidence.py new file mode 100644 index 00000000..648c373d --- /dev/null +++ b/trustgraph-base/trustgraph/schema/services/agent_confidence.py @@ -0,0 +1,47 @@ +""" +Schema definitions for the confidence-based agent internal communication. + +These schemas are used internally between confidence agent modules and are not +part of the external API. The confidence agent uses the existing AgentRequest +and AgentResponse schemas for external communication. +""" + +from pulsar.schema import Record, String, Array, Map, Float, Integer, Boolean + +############################################################################ + +# Confidence evaluation schemas + +class ConfidenceMetrics(Record): + """Confidence evaluation metrics for execution results.""" + score = Float() # Confidence score (0.0 to 1.0) + reasoning = String() # Explanation of score calculation + retry_count = Integer() # Number of retries attempted + + +class ExecutionStep(Record): + """Individual step in an execution plan.""" + id = String() # Unique step identifier + function = String() # Tool/function to execute + arguments = Map(String()) # Arguments for the function + dependencies = Array(String()) # IDs of prerequisite steps + confidence_threshold = Float() # Minimum acceptable confidence + timeout_ms = Integer() # Execution timeout + + +class ExecutionPlan(Record): + """Complete execution plan with ordered steps.""" + id = String() # Plan identifier + steps = Array(ExecutionStep()) # Ordered execution steps + context = Map(String()) # Global context for plan + + +class StepResult(Record): + """Result of executing a single step.""" + step_id = String() # Reference to ExecutionStep + success = Boolean() # Execution success status + output = String() # Step execution output + confidence = ConfidenceMetrics() # Confidence evaluation + execution_time_ms = Integer() # Actual execution time + +############################################################################ \ No newline at end of file