agentic 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. checksums.yaml +4 -4
  2. data/.agentic.yml +2 -0
  3. data/.architecture/decisions/ArchitecturalFeatureBuilder.md +136 -0
  4. data/.architecture/decisions/ArchitectureConsiderations.md +200 -0
  5. data/.architecture/decisions/adr_001_observer_pattern_implementation.md +196 -0
  6. data/.architecture/decisions/adr_002_plan_orchestrator.md +320 -0
  7. data/.architecture/decisions/adr_003_plan_orchestrator_interface.md +179 -0
  8. data/.architecture/decisions/adrs/ADR-001-dependency-management.md +147 -0
  9. data/.architecture/decisions/adrs/ADR-002-system-boundaries.md +162 -0
  10. data/.architecture/decisions/adrs/ADR-003-content-safety.md +158 -0
  11. data/.architecture/decisions/adrs/ADR-004-agent-permissions.md +161 -0
  12. data/.architecture/decisions/adrs/ADR-005-adaptation-engine.md +127 -0
  13. data/.architecture/decisions/adrs/ADR-006-extension-system.md +273 -0
  14. data/.architecture/decisions/adrs/ADR-007-learning-system.md +156 -0
  15. data/.architecture/decisions/adrs/ADR-008-prompt-generation.md +325 -0
  16. data/.architecture/decisions/adrs/ADR-009-task-failure-handling.md +353 -0
  17. data/.architecture/decisions/adrs/ADR-010-task-input-handling.md +251 -0
  18. data/.architecture/decisions/adrs/ADR-011-task-observable-pattern.md +391 -0
  19. data/.architecture/decisions/adrs/ADR-012-task-output-handling.md +205 -0
  20. data/.architecture/decisions/adrs/ADR-013-architecture-alignment.md +211 -0
  21. data/.architecture/decisions/adrs/ADR-014-agent-capability-registry.md +80 -0
  22. data/.architecture/decisions/adrs/ADR-015-persistent-agent-store.md +100 -0
  23. data/.architecture/decisions/adrs/ADR-016-agent-assembly-engine.md +117 -0
  24. data/.architecture/decisions/adrs/ADR-017-streaming-observability.md +171 -0
  25. data/.architecture/decisions/capability_tools_distinction.md +150 -0
  26. data/.architecture/decisions/cli_command_structure.md +61 -0
  27. data/.architecture/implementation/agent_self_assembly_implementation.md +267 -0
  28. data/.architecture/implementation/agent_self_assembly_summary.md +138 -0
  29. data/.architecture/members.yml +187 -0
  30. data/.architecture/planning/self_implementation_exercise.md +295 -0
  31. data/.architecture/planning/session_compaction_rule.md +43 -0
  32. data/.architecture/planning/streaming_observability_feature.md +223 -0
  33. data/.architecture/principles.md +151 -0
  34. data/.architecture/recalibration/0-2-0.md +92 -0
  35. data/.architecture/recalibration/agent_self_assembly.md +238 -0
  36. data/.architecture/recalibration/cli_command_structure.md +91 -0
  37. data/.architecture/recalibration/implementation_roadmap_0-2-0.md +301 -0
  38. data/.architecture/recalibration/progress_tracking_0-2-0.md +114 -0
  39. data/.architecture/recalibration_process.md +127 -0
  40. data/.architecture/reviews/0-2-0.md +181 -0
  41. data/.architecture/reviews/cli_command_duplication.md +98 -0
  42. data/.architecture/templates/adr.md +105 -0
  43. data/.architecture/templates/implementation_roadmap.md +125 -0
  44. data/.architecture/templates/progress_tracking.md +89 -0
  45. data/.architecture/templates/recalibration_plan.md +70 -0
  46. data/.architecture/templates/version_comparison.md +124 -0
  47. data/.claude/settings.local.json +13 -0
  48. data/.claude-sessions/001-task-class-architecture-implementation.md +129 -0
  49. data/.claude-sessions/002-plan-orchestrator-interface-review.md +105 -0
  50. data/.claude-sessions/architecture-governance-implementation.md +37 -0
  51. data/.claude-sessions/architecture-review-session.md +27 -0
  52. data/ArchitecturalFeatureBuilder.md +136 -0
  53. data/ArchitectureConsiderations.md +229 -0
  54. data/CHANGELOG.md +57 -2
  55. data/CLAUDE.md +111 -0
  56. data/CONTRIBUTING.md +286 -0
  57. data/MAINTAINING.md +301 -0
  58. data/README.md +582 -28
  59. data/docs/agent_capabilities_api.md +259 -0
  60. data/docs/artifact_extension_points.md +757 -0
  61. data/docs/artifact_generation_architecture.md +323 -0
  62. data/docs/artifact_implementation_plan.md +596 -0
  63. data/docs/artifact_integration_points.md +345 -0
  64. data/docs/artifact_verification_strategies.md +581 -0
  65. data/docs/streaming_observability_architecture.md +510 -0
  66. data/exe/agentic +6 -1
  67. data/lefthook.yml +5 -0
  68. data/lib/agentic/adaptation_engine.rb +124 -0
  69. data/lib/agentic/agent.rb +181 -4
  70. data/lib/agentic/agent_assembly_engine.rb +442 -0
  71. data/lib/agentic/agent_capability_registry.rb +260 -0
  72. data/lib/agentic/agent_config.rb +63 -0
  73. data/lib/agentic/agent_specification.rb +46 -0
  74. data/lib/agentic/capabilities/examples.rb +530 -0
  75. data/lib/agentic/capabilities.rb +14 -0
  76. data/lib/agentic/capability_provider.rb +146 -0
  77. data/lib/agentic/capability_specification.rb +118 -0
  78. data/lib/agentic/cli/agent.rb +31 -0
  79. data/lib/agentic/cli/capabilities.rb +191 -0
  80. data/lib/agentic/cli/config.rb +134 -0
  81. data/lib/agentic/cli/execution_observer.rb +796 -0
  82. data/lib/agentic/cli.rb +1068 -0
  83. data/lib/agentic/default_agent_provider.rb +35 -0
  84. data/lib/agentic/errors/llm_error.rb +184 -0
  85. data/lib/agentic/execution_plan.rb +53 -0
  86. data/lib/agentic/execution_result.rb +91 -0
  87. data/lib/agentic/expected_answer_format.rb +46 -0
  88. data/lib/agentic/extension/domain_adapter.rb +109 -0
  89. data/lib/agentic/extension/plugin_manager.rb +163 -0
  90. data/lib/agentic/extension/protocol_handler.rb +116 -0
  91. data/lib/agentic/extension.rb +45 -0
  92. data/lib/agentic/factory_methods.rb +9 -1
  93. data/lib/agentic/generation_stats.rb +61 -0
  94. data/lib/agentic/learning/README.md +84 -0
  95. data/lib/agentic/learning/capability_optimizer.rb +613 -0
  96. data/lib/agentic/learning/execution_history_store.rb +251 -0
  97. data/lib/agentic/learning/pattern_recognizer.rb +500 -0
  98. data/lib/agentic/learning/strategy_optimizer.rb +706 -0
  99. data/lib/agentic/learning.rb +131 -0
  100. data/lib/agentic/llm_assisted_composition_strategy.rb +188 -0
  101. data/lib/agentic/llm_client.rb +215 -15
  102. data/lib/agentic/llm_config.rb +65 -1
  103. data/lib/agentic/llm_response.rb +163 -0
  104. data/lib/agentic/logger.rb +1 -1
  105. data/lib/agentic/observable.rb +51 -0
  106. data/lib/agentic/persistent_agent_store.rb +385 -0
  107. data/lib/agentic/plan_execution_result.rb +129 -0
  108. data/lib/agentic/plan_orchestrator.rb +464 -0
  109. data/lib/agentic/plan_orchestrator_config.rb +57 -0
  110. data/lib/agentic/retry_config.rb +63 -0
  111. data/lib/agentic/retry_handler.rb +125 -0
  112. data/lib/agentic/structured_outputs.rb +1 -1
  113. data/lib/agentic/task.rb +193 -0
  114. data/lib/agentic/task_definition.rb +39 -0
  115. data/lib/agentic/task_execution_result.rb +92 -0
  116. data/lib/agentic/task_failure.rb +66 -0
  117. data/lib/agentic/task_output_schemas.rb +112 -0
  118. data/lib/agentic/task_planner.rb +54 -19
  119. data/lib/agentic/task_result.rb +48 -0
  120. data/lib/agentic/ui.rb +244 -0
  121. data/lib/agentic/verification/critic_framework.rb +116 -0
  122. data/lib/agentic/verification/llm_verification_strategy.rb +60 -0
  123. data/lib/agentic/verification/schema_verification_strategy.rb +47 -0
  124. data/lib/agentic/verification/verification_hub.rb +62 -0
  125. data/lib/agentic/verification/verification_result.rb +50 -0
  126. data/lib/agentic/verification/verification_strategy.rb +26 -0
  127. data/lib/agentic/version.rb +1 -1
  128. data/lib/agentic.rb +74 -2
  129. data/plugins/README.md +41 -0
  130. metadata +245 -6
@@ -0,0 +1,205 @@
1
+ # Task Output Handling
2
+
3
+ ## Overview
4
+
5
+ This document specifies the architecture for handling task outputs within the Agentic framework, addressing how outputs are structured, processed, and utilized across the system.
6
+
7
+ ## Core Principles
8
+
9
+ 1. **Consistency**: Task outputs follow standardized formats for interoperability
10
+ 2. **Traceability**: Outputs maintain provenance information
11
+ 3. **Transformation**: Outputs can be transformed for different consumers
12
+ 4. **Verification**: Outputs include quality and confidence metrics
13
+ 5. **Persistence**: Outputs can be stored and retrieved as needed
14
+
15
+ ## Output Structure
16
+
17
+ Task outputs should adhere to a consistent structure:
18
+
19
+ ```
20
+ {
21
+ "result": {
22
+ // Domain-specific output content
23
+ },
24
+ "metadata": {
25
+ "task_id": "uuid",
26
+ "agent_id": "uuid",
27
+ "timestamp": "ISO8601",
28
+ "execution_time_ms": 1234,
29
+ "token_usage": {
30
+ "prompt": 123,
31
+ "completion": 456,
32
+ "total": 579
33
+ }
34
+ },
35
+ "verification": {
36
+ "confidence_score": 0.95,
37
+ "verification_results": [
38
+ {
39
+ "verifier": "schema_validation",
40
+ "passed": true,
41
+ "score": 1.0
42
+ },
43
+ {
44
+ "verifier": "content_quality",
45
+ "passed": true,
46
+ "score": 0.9
47
+ }
48
+ ]
49
+ }
50
+ }
51
+ ```
52
+
53
+ ## Output Usage Patterns
54
+
55
+ ### 1. Sequential Task Chaining
56
+
57
+ Outputs from one task serve as inputs to subsequent tasks, creating a workflow:
58
+
59
+ ```
60
+ TaskA.output → TaskB.input → TaskB.output → TaskC.input
61
+ ```
62
+
63
+ Implementation considerations:
64
+ - Output transformation between tasks may be required
65
+ - Schema validation ensures compatibility
66
+ - Context/state must be preserved across transitions
67
+ - Dependencies between tasks must be tracked
68
+
69
+ ### 2. Result Aggregation
70
+
71
+ Multiple task outputs are combined to create a comprehensive response:
72
+
73
+ ```
74
+ TaskA.output ─┐
75
+ TaskB.output ─┼─→ Aggregator → Final Result
76
+ TaskC.output ─┘
77
+ ```
78
+
79
+ Implementation considerations:
80
+ - Aggregation strategies vary by domain
81
+ - Conflict resolution may be required
82
+ - Quality metrics should influence weighting
83
+ - Provenance must be maintained
84
+
85
+ ### 3. Verification Process
86
+
87
+ Outputs undergo verification to ensure quality and correctness:
88
+
89
+ ```
90
+ Task.output → Verification Hub → Verification Strategies → Confidence Score
91
+ ```
92
+
93
+ Implementation considerations:
94
+ - Multiple verification strategies applied in parallel
95
+ - Weighted scoring based on strategy importance
96
+ - Threshold-based decision making
97
+ - Human intervention triggers based on confidence
98
+
99
+ ### 4. Learning System Integration
100
+
101
+ Historical task outputs feed back into the learning system:
102
+
103
+ ```
104
+ Task.output → ExecutionHistoryStore → PatternRecognizer → Strategy Optimization
105
+ ```
106
+
107
+ Implementation considerations:
108
+ - Anonymization of sensitive data
109
+ - Performance correlation analysis
110
+ - Success/failure pattern detection
111
+ - Agent selection improvement
112
+
113
+ ### 5. External Integration
114
+
115
+ Task outputs are transformed for external systems consumption:
116
+
117
+ ```
118
+ Task.output → OutputTransformer → External API/UI/Database
119
+ ```
120
+
121
+ Implementation considerations:
122
+ - Format conversion for different consumers
123
+ - Security and privacy filtering
124
+ - Rate limiting and batching
125
+ - Logging and auditing
126
+
127
+ ### 6. Feedback Loop
128
+
129
+ Task outputs inform plan adaptation and refinement:
130
+
131
+ ```
132
+ Task.output → AdaptationEngine → Plan Modification → New Tasks
133
+ ```
134
+
135
+ Implementation considerations:
136
+ - Detect needed refinements based on output quality
137
+ - Generate additional tasks to improve results
138
+ - Modify agent selection based on performance
139
+ - Adjust expectations for downstream tasks
140
+
141
+ ## Component Responsibilities
142
+
143
+ ### Task Class
144
+
145
+ - Generate structured output format
146
+ - Track output provenance
147
+ - Provide serialization support
148
+ - Maintain output history (for retries)
149
+
150
+ ### PlanOrchestrator
151
+
152
+ - Manage task output routing
153
+ - Handle output transformations between tasks
154
+ - Track overall plan output state
155
+ - Aggregate results as appropriate
156
+
157
+ ### VerificationHub
158
+
159
+ - Apply verification strategies to outputs
160
+ - Calculate confidence scores
161
+ - Trigger human intervention when needed
162
+ - Add verification metadata to outputs
163
+
164
+ ### OutputTransformer (New Component)
165
+
166
+ - Convert outputs between formats
167
+ - Apply domain-specific transformations
168
+ - Filter sensitive information
169
+ - Optimize for target consumers
170
+
171
+ ### ExecutionHistoryStore
172
+
173
+ - Persist task outputs with context
174
+ - Index outputs for efficient retrieval
175
+ - Support anonymization for learning
176
+ - Provide query interface for pattern recognition
177
+
178
+ ## Implementation Approach
179
+
180
+ 1. **Start Small**: Begin with a basic structured output format
181
+ 2. **Add Metadata**: Incorporate execution metrics and provenance
182
+ 3. **Implement Verification**: Add verification results and confidence
183
+ 4. **Enable Transformation**: Create output transformation capabilities
184
+ 5. **Support Persistence**: Add storage and retrieval functionality
185
+
186
+ ## Development Priorities
187
+
188
+ 1. Define the output schema interface
189
+ 2. Implement basic output generation in Task
190
+ 3. Create output transformation utilities
191
+ 4. Develop verification integration
192
+ 5. Implement persistence layer
193
+ 6. Add learning system integration
194
+
195
+ ## Considerations for Future Extensions
196
+
197
+ 1. **Schema Evolution**: Support versioning of output schemas
198
+ 2. **Real-time Streaming**: Enable streaming outputs for long-running tasks
199
+ 3. **Compression**: Handle large outputs efficiently
200
+ 4. **Encryption**: Protect sensitive output data
201
+ 5. **Distributed Storage**: Scale output handling across environments
202
+
203
+ ## Conclusion
204
+
205
+ A well-designed task output handling system is critical for the Agentic framework's effectiveness. By standardizing output formats, enabling various usage patterns, and supporting verification and learning, the system can deliver consistent, high-quality results while continuously improving over time.
@@ -0,0 +1,211 @@
1
+ # Architecture Alignment Analysis
2
+
3
+ ## Overview
4
+
5
+ This document reviews all architectural documentation created for the Agentic framework to ensure alignment, cohesiveness, and focus on core goals. It identifies strengths, gaps, and recommendations for maintaining a unified architectural vision.
6
+
7
+ ## Document Inventory
8
+
9
+ 1. **ArchitectureConsiderations.md**: Core architectural vision and system layers
10
+ 2. **ArchitecturalFeatureBuilder.md**: Implementation guidelines for features
11
+ 3. **Task Output Handling**: Detailed architecture for task output processing
12
+ 4. **Task Input Handling**: Detailed architecture for task input processing
13
+ 5. **Prompt Generation**: Architecture for generating prompts
14
+ 6. **Self-Implementation Exercise**: Meta-exercise using Agentic to build itself
15
+
16
+ ## Core Goals Alignment
17
+
18
+ All documentation consistently supports these core goals:
19
+
20
+ 1. **Domain Agnosticism**: Every document emphasizes building a framework that works across domains
21
+ 2. **Self-Improvement**: Learning capabilities are consistently included throughout
22
+ 3. **Extensibility**: Well-defined extension points appear in all documents
23
+ 4. **Verification**: Quality assurance is integrated at every level
24
+ 5. **Human Oversight**: Human intervention is carefully considered throughout
25
+
26
+ ## Strengths
27
+
28
+ 1. **Layered Architecture**: Clear separation of concerns across all documents
29
+ 2. **Consistent Design Patterns**: Registry, strategy, and observer patterns used consistently
30
+ 3. **Interface-First Approach**: All components define clear interfaces
31
+ 4. **Comprehensive Coverage**: All major aspects of the system are documented
32
+ 5. **Progressive Implementation**: Consistent phased approach to building features
33
+
34
+ ## Alignment Gaps
35
+
36
+ 1. **Terminology Inconsistencies**:
37
+ - "Feedback Loop" vs "Adaptation Engine" (same concept, different names)
38
+ - "Task Execution" vs "Task Performance" (same action, different terms)
39
+ - "Plugin" vs "Extension" (same concept, different terms)
40
+
41
+ 2. **Component Boundaries**:
42
+ - Some overlap between VerificationHub and AdaptationEngine responsibilities
43
+ - Unclear boundaries between TaskFactory and PlanOrchestrator
44
+ - Relationship between MetaLearningSystem and ExecutionHistoryStore needs clarification
45
+
46
+ 3. **Interface Definitions**:
47
+ - Some interfaces are well-defined (Task, Agent) while others are less detailed (PlanOrchestrator)
48
+ - Input/output transformation interfaces could be more specific
49
+
50
+ 4. **Implementation Priority**:
51
+ - Slight differences in implementation ordering between documents
52
+
53
+ ## Recommendations
54
+
55
+ ### 1. Terminology Standardization
56
+
57
+ Create a glossary of terms to ensure consistency:
58
+
59
+ | Term | Definition | Used For |
60
+ |------|------------|----------|
61
+ | Task Execution | The process of an agent performing a task | Core behavior of Task class |
62
+ | Adaptation | The process of modifying behavior based on feedback | Functionality of AdaptationEngine |
63
+ | Extension | A component that adds functionality to the system | Third-party additions to system |
64
+ | Plugin | Specific type of extension that follows the plugin API | Extensions that use PluginManager |
65
+
66
+ ### 2. Component Responsibility Clarification
67
+
68
+ | Component | Primary Responsibility | Secondary Responsibilities | NOT Responsible For |
69
+ |-----------|------------------------|----------------------------|---------------------|
70
+ | Task | Lifecycle management | Input/output handling, prompt building | Execution details, verification logic |
71
+ | VerificationHub | Coordinating verification strategies | Confidence scoring | Adaptation decisions |
72
+ | AdaptationEngine | Modifying plans based on verification | Feedback processing | Verification itself |
73
+ | PlanOrchestrator | Coordinating task execution | Task dependency resolution | Task creation |
74
+ | TaskFactory | Creating task instances | Task validation | Task execution |
75
+
76
+ ### 3. Interface Alignment
77
+
78
+ Ensure these key interfaces are consistently defined across all documents:
79
+
80
+ ```ruby
81
+ # Agent interface
82
+ class Agent
83
+ def execute(prompt, context = nil)
84
+ # Execute and return output
85
+ end
86
+
87
+ def get_capabilities
88
+ # Return agent capabilities
89
+ end
90
+ end
91
+
92
+ # Task interface
93
+ class Task
94
+ def perform(agent)
95
+ # Execute task using agent
96
+ end
97
+
98
+ def verify(context = nil)
99
+ # Verify task results
100
+ end
101
+
102
+ def to_h
103
+ # Return serializable representation
104
+ end
105
+ end
106
+
107
+ # Verification Strategy interface
108
+ module VerificationStrategy
109
+ def verify(task, context)
110
+ # Perform verification and return results
111
+ end
112
+
113
+ def applicable?(task)
114
+ # Determine if strategy applies to task
115
+ end
116
+ end
117
+ ```
118
+
119
+ ### 4. Implementation Priority Alignment
120
+
121
+ Standardize the implementation sequence across all documents:
122
+
123
+ 1. Core Task and Agent implementation
124
+ 2. Basic input/output handling
125
+ 3. Prompt generation
126
+ 4. Verification integration
127
+ 5. Plan orchestration
128
+ 6. Learning system components
129
+ 7. Human interface
130
+ 8. Extension system
131
+
132
+ ### 5. Data Structure Alignment
133
+
134
+ Ensure these key data structures are consistently defined:
135
+
136
+ ```ruby
137
+ # Task Input Structure
138
+ {
139
+ "parameters": { /* Domain-specific parameters */ },
140
+ "context": {
141
+ "plan_id": "uuid",
142
+ "goal": "description",
143
+ "previous_task_outputs": { /* References */ }
144
+ },
145
+ "constraints": { /* Limits and requirements */ },
146
+ "metadata": { /* Additional information */ }
147
+ }
148
+
149
+ # Task Output Structure
150
+ {
151
+ "result": { /* Domain-specific output */ },
152
+ "metadata": {
153
+ "task_id": "uuid",
154
+ "agent_id": "uuid",
155
+ "timestamp": "ISO8601",
156
+ /* Additional metadata */
157
+ },
158
+ "verification": {
159
+ "confidence_score": 0.95,
160
+ "verification_results": [ /* Verification details */ ]
161
+ }
162
+ }
163
+
164
+ # Prompt Structure
165
+ {
166
+ "system_instructions": "...",
167
+ "task_description": "...",
168
+ "context": "...",
169
+ "input_parameters": "...",
170
+ "output_requirements": "...",
171
+ "special_instructions": "..."
172
+ }
173
+ ```
174
+
175
+ ## Document-Specific Recommendations
176
+
177
+ ### ArchitectureConsiderations.md
178
+
179
+ - Add references to specialized architecture documents
180
+ - Expand data flow section to include input/output transformation
181
+ - Add component interaction diagrams
182
+
183
+ ### ArchitecturalFeatureBuilder.md
184
+
185
+ - Add specific examples for each implementation phase
186
+ - Include references to specialized architecture documents
187
+ - Expand testing strategy section
188
+
189
+ ### Task Output/Input Handling
190
+
191
+ - Align terminology with core architecture document
192
+ - Ensure component responsibilities match overall architecture
193
+ - Add more implementation examples
194
+
195
+ ### Prompt Generation
196
+
197
+ - Clarify relationship with Task and Agent components
198
+ - Ensure alignment with input handling architecture
199
+ - Add more examples of different prompt types
200
+
201
+ ### Self-Implementation Exercise
202
+
203
+ - Ensure all components mentioned match the core architecture
204
+ - Align task types with other documentation
205
+ - Add metrics for evaluating success
206
+
207
+ ## Conclusion
208
+
209
+ The architectural documentation for Agentic forms a comprehensive and largely cohesive vision for the framework. With the standardizations recommended above, it will provide an even stronger foundation for implementation. The documentation effectively balances high-level architectural vision with detailed component design, creating a blueprint for a powerful, extensible, and self-improving agent orchestration framework.
210
+
211
+ The architecture successfully achieves the core goals of domain agnosticism, extensibility, verification, learning capability, and human oversight, while providing practical guidance for implementation.
@@ -0,0 +1,80 @@
1
+ # ADR-014: Agent Capability Registry
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Context
8
+
9
+ As we develop the Agentic framework, we need a centralized system to manage, discover, and utilize agent capabilities. Capabilities are richer than simple tools, with versioning, dependencies, and composition possibilities. The system must support:
10
+
11
+ 1. Registration of capabilities with semantic versioning
12
+ 2. Discovery of capabilities based on name, version, or functionality
13
+ 3. Composition of capabilities into higher-order capabilities
14
+ 4. Runtime validation of capability inputs and outputs
15
+ 5. Management of capability providers (implementations)
16
+
17
+ Previously, we had a more limited "tool" concept which lacked versioning, composition, and formal interface definitions. We need to evolve this concept while maintaining backward compatibility.
18
+
19
+ ## Decision
20
+
21
+ We will implement an `AgentCapabilityRegistry` that serves as the central repository for all agent capabilities in the system. The registry will:
22
+
23
+ 1. Be implemented as a singleton to provide global access
24
+ 2. Maintain a collection of capability specifications and their providers
25
+ 3. Support semantic versioning for capability evolution
26
+ 4. Enable capability composition through dependency management
27
+ 5. Provide a rich API for capability discovery and filtering
28
+
29
+ Key classes:
30
+
31
+ - `CapabilitySpecification`: Defines the interface for a capability
32
+ - `CapabilityProvider`: Implements a capability interface
33
+ - `AgentCapabilityRegistry`: Manages capability specifications and providers
34
+
35
+ The registry will provide these core operations:
36
+
37
+ ```ruby
38
+ # Registration
39
+ registry.register(specification, provider)
40
+
41
+ # Discovery
42
+ registry.get(name, version = nil)
43
+ registry.list(filter = {})
44
+
45
+ # Provider access
46
+ registry.get_provider(name, version = nil)
47
+
48
+ # Composition
49
+ registry.compose(name, description, version, dependencies, implementation)
50
+ ```
51
+
52
+ ## Consequences
53
+
54
+ ### Positive
55
+
56
+ 1. Centralized management of capabilities improves discovery and reuse
57
+ 2. Semantic versioning enables capability evolution while maintaining compatibility
58
+ 3. Capability composition facilitates building complex capabilities from simpler ones
59
+ 4. Formal interface definitions improve capability documentation and usage
60
+ 5. Provider abstraction allows multiple implementations of the same capability
61
+
62
+ ### Negative
63
+
64
+ 1. Singleton pattern creates global state that may complicate testing
65
+ 2. Centralized registry could become a performance bottleneck at scale
66
+ 3. Version management adds complexity compared to simpler approaches
67
+ 4. Requires migration from previous tool-based approach
68
+
69
+ ### Neutral
70
+
71
+ 1. Requires agents to adopt capability-aware execution model
72
+ 2. Necessitates formal capability specification development
73
+
74
+ ## Implementation Notes
75
+
76
+ The registry will be implemented as a singleton class with thread-safe operations. Capability specifications will include name, version, description, inputs, outputs, and dependencies. Providers will encapsulate the actual implementation logic.
77
+
78
+ The registry will maintain an index of capabilities by name and version, allowing efficient lookups. It will also support finding the latest version of a capability when no specific version is requested.
79
+
80
+ For backward compatibility, existing tools will be automatically wrapped as capabilities with appropriate adapters.
@@ -0,0 +1,100 @@
1
+ # ADR-015: Persistent Agent Store
2
+
3
+ ## Status
4
+
5
+ Accepted
6
+
7
+ ## Context
8
+
9
+ To enable more efficient agent reuse and evolution, we need a mechanism to persistently store and retrieve agent configurations. This system should support:
10
+
11
+ 1. Storing complete agent configurations, including capabilities
12
+ 2. Retrieving agents by ID or name
13
+ 3. Versioning agent configurations as they evolve
14
+ 4. Filtering and searching for suitable agents based on capabilities or metadata
15
+ 5. Tracking agent provenance and usage history
16
+
17
+ Without a persistent store, agents must be recreated from scratch for each task, even when similar agents have been previously assembled. This leads to inefficiency and missed opportunities for improvement through agent evolution.
18
+
19
+ ## Decision
20
+
21
+ We will implement a `PersistentAgentStore` class that handles agent storage and retrieval. The store will:
22
+
23
+ 1. Use a file-based storage system with a configurable storage path
24
+ 2. Support semantic versioning for agent configurations
25
+ 3. Maintain an in-memory index for efficient lookup
26
+ 4. Store agent configurations as structured JSON
27
+ 5. Support rich filtering and querying capabilities
28
+
29
+ Key operations:
30
+
31
+ ```ruby
32
+ # Store an agent
33
+ store.store(agent, name: "my_agent", metadata: { category: "research" })
34
+
35
+ # Build an agent from stored configuration
36
+ store.build_agent("my_agent") # By name
37
+ store.build_agent(agent_id) # By ID
38
+ store.build_agent(id, version: "1.2.0") # Specific version
39
+
40
+ # List and filter agents
41
+ store.list_all() # All agents
42
+ store.all(filter: { capability: "web_search" }) # With specific capability
43
+ store.all(filter: { metadata: { category: "research" } }) # With metadata
44
+
45
+ # Get version history
46
+ store.version_history(agent_id)
47
+
48
+ # Delete agents
49
+ store.delete(agent_id)
50
+ store.delete(agent_id, version: "1.0.0") # Specific version
51
+ ```
52
+
53
+ We will use the following design:
54
+ - File-based storage with one directory per agent
55
+ - Each version stored as a separate JSON file
56
+ - An index file for quick lookup without loading all agent files
57
+ - Agent data will include capabilities, metadata, and configuration
58
+
59
+ ## Consequences
60
+
61
+ ### Positive
62
+
63
+ 1. Enables reuse of previously assembled agents for similar tasks
64
+ 2. Supports agent evolution through versioning
65
+ 3. Provides rich filtering for agent discovery
66
+ 4. Maintains complete agent provenance for auditing
67
+ 5. Simplifies integration with agent assembly system
68
+
69
+ ### Negative
70
+
71
+ 1. File-based storage has scalability limitations
72
+ 2. Limited transactional support compared to databases
73
+ 3. Requires additional synchronization in multi-process scenarios
74
+ 4. Increases code complexity with versioning logic
75
+
76
+ ### Neutral
77
+
78
+ 1. Requires filesystem access for storage
79
+ 2. Creates dependency on JSON serialization format
80
+ 3. May require migration strategies for major version changes
81
+
82
+ ## Implementation Notes
83
+
84
+ The store will create a directory structure like:
85
+
86
+ ```
87
+ storage_path/
88
+ index.json # Main index with all agents
89
+ agent_id_1/
90
+ 1.0.0.json # First version
91
+ 1.0.1.json # Second version
92
+ agent_id_2/
93
+ 1.0.0.json # First version
94
+ ```
95
+
96
+ The index will contain minimal information for quick lookups, while the full agent configuration will be stored in the version-specific files. The store will automatically rebuild the index if it becomes out of sync with the filesystem.
97
+
98
+ For thread safety, file operations will use appropriate locking mechanisms. The store will gracefully handle partial or corrupted data through validation and error recovery.
99
+
100
+ To support multiple storage backends in the future, the implementation will follow a repository pattern with a clear interface for storage operations.