-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathSAGE.spec.yaml
More file actions
84 lines (76 loc) · 3.62 KB
/
Copy pathSAGE.spec.yaml
File metadata and controls
84 lines (76 loc) · 3.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
protocol:
name: SAGE
full_name: Sequential Agent Goal Execution Protocol
version: 0.1.0
description: |
SAGE is a modular protocol for dynamically managing multi-LLM workflows. It decomposes user prompts into validated, goal-driven sub-tasks, routes them to the best local language models (via Ollama), and ensures each step meets a success threshold before proceeding. The protocol is designed for extensibility, reliability, and transparency in complex AI task orchestration.
components:
- name: DecomposerAgent
description: Breaks down the main user prompt into logical, meaningful sub-prompts (sub-tasks).
input: User prompt (string), optional context (dict)
output: List of SubPrompt objects
- name: RouterAgent
description: Selects the best local LLM/model (Ollama) for each sub-prompt based on task type and configuration, using a meta-router LLM.
input: SubPrompt object
output: ModelAssignment object
- name: ExecutionManager
description: Executes sub-prompts sequentially using the assigned local Ollama model, maintaining context.
input: SubPrompt object, ModelAssignment object
output: ExecutionResult object
- name: Evaluator
description: Evaluates the output of each sub-prompt against its expected goal using an LLM-based judgment protocol. The evaluator prompts a selected LLM (default: Deepseek, configurable) to act as an expert judge, returning YES/NO and a confidence score.
input: ExecutionResult object
output: EvaluationResult object
- name: Retry/Reassign Handler
description: Handles retries or reassignments if a sub-task does not meet the success threshold.
input: SubPrompt object, EvaluationResult object
output: ModelAssignment object (new or adjusted)
- name: Aggregator
description: Aggregates all sub-task results into a final, coherent response for the user.
input: List of ExecutionResult objects
output: AggregatedResponse object
workflow:
steps:
- Receive user prompt
- Decompose prompt into sub-prompts
- Assign each sub-prompt to the best local model (Ollama)
- Execute sub-prompts sequentially, chaining context
- After each execution:
- Evaluate output against expected goal using LLM-based judgment (YES/NO, confidence)
- If confidence >= threshold and answer is YES, proceed
- Else, retry or reassign
- Aggregate all results into a final response
- Return final response to user
configuration:
file: config/settings.yaml
parameters:
similarity_threshold: float (default: 0.9)
max_retries: int (default: 3)
default_model: string (e.g., 'gemma3:4b')
available_models: list of strings (e.g., ['gemma3:4b', 'deepseek-r1:1.5b'])
model_assignments: mapping of task type to model
model_parameters: per-model parameter settings
retry_strategy: max_attempts, backoff_factor, initial_delay
logging: level, format
evaluator_model: string (e.g., 'deepseek-r1:1.5b') # Model used for LLM-based evaluation
models:
- SubPrompt
- ModelAssignment
- ExecutionResult
- EvaluationResult
- AggregatedResponse
- SAGEConfig
extensibility:
- Add new agent types (e.g., for planning, validation, or post-processing)
- Integrate additional LLM providers (cloud or local)
- Customize decomposition, routing, or evaluation logic
- Plug in custom similarity metrics or feedback mechanisms
usage:
- Initialize SAGE with configuration
- Call process_prompt(prompt) to process a user prompt
- Receive AggregatedResponse with final result and details
supported_models:
- gemma3:4b (Ollama local)
- deepseek-r1:1.5b (Ollama local)
- qwen3:1.7b (Ollama local)
license: MIT