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.
- checksums.yaml +4 -4
- data/.agentic.yml +2 -0
- data/.architecture/decisions/ArchitecturalFeatureBuilder.md +136 -0
- data/.architecture/decisions/ArchitectureConsiderations.md +200 -0
- data/.architecture/decisions/adr_001_observer_pattern_implementation.md +196 -0
- data/.architecture/decisions/adr_002_plan_orchestrator.md +320 -0
- data/.architecture/decisions/adr_003_plan_orchestrator_interface.md +179 -0
- data/.architecture/decisions/adrs/ADR-001-dependency-management.md +147 -0
- data/.architecture/decisions/adrs/ADR-002-system-boundaries.md +162 -0
- data/.architecture/decisions/adrs/ADR-003-content-safety.md +158 -0
- data/.architecture/decisions/adrs/ADR-004-agent-permissions.md +161 -0
- data/.architecture/decisions/adrs/ADR-005-adaptation-engine.md +127 -0
- data/.architecture/decisions/adrs/ADR-006-extension-system.md +273 -0
- data/.architecture/decisions/adrs/ADR-007-learning-system.md +156 -0
- data/.architecture/decisions/adrs/ADR-008-prompt-generation.md +325 -0
- data/.architecture/decisions/adrs/ADR-009-task-failure-handling.md +353 -0
- data/.architecture/decisions/adrs/ADR-010-task-input-handling.md +251 -0
- data/.architecture/decisions/adrs/ADR-011-task-observable-pattern.md +391 -0
- data/.architecture/decisions/adrs/ADR-012-task-output-handling.md +205 -0
- data/.architecture/decisions/adrs/ADR-013-architecture-alignment.md +211 -0
- data/.architecture/decisions/adrs/ADR-014-agent-capability-registry.md +80 -0
- data/.architecture/decisions/adrs/ADR-015-persistent-agent-store.md +100 -0
- data/.architecture/decisions/adrs/ADR-016-agent-assembly-engine.md +117 -0
- data/.architecture/decisions/adrs/ADR-017-streaming-observability.md +171 -0
- data/.architecture/decisions/capability_tools_distinction.md +150 -0
- data/.architecture/decisions/cli_command_structure.md +61 -0
- data/.architecture/implementation/agent_self_assembly_implementation.md +267 -0
- data/.architecture/implementation/agent_self_assembly_summary.md +138 -0
- data/.architecture/members.yml +187 -0
- data/.architecture/planning/self_implementation_exercise.md +295 -0
- data/.architecture/planning/session_compaction_rule.md +43 -0
- data/.architecture/planning/streaming_observability_feature.md +223 -0
- data/.architecture/principles.md +151 -0
- data/.architecture/recalibration/0-2-0.md +92 -0
- data/.architecture/recalibration/agent_self_assembly.md +238 -0
- data/.architecture/recalibration/cli_command_structure.md +91 -0
- data/.architecture/recalibration/implementation_roadmap_0-2-0.md +301 -0
- data/.architecture/recalibration/progress_tracking_0-2-0.md +114 -0
- data/.architecture/recalibration_process.md +127 -0
- data/.architecture/reviews/0-2-0.md +181 -0
- data/.architecture/reviews/cli_command_duplication.md +98 -0
- data/.architecture/templates/adr.md +105 -0
- data/.architecture/templates/implementation_roadmap.md +125 -0
- data/.architecture/templates/progress_tracking.md +89 -0
- data/.architecture/templates/recalibration_plan.md +70 -0
- data/.architecture/templates/version_comparison.md +124 -0
- data/.claude/settings.local.json +13 -0
- data/.claude-sessions/001-task-class-architecture-implementation.md +129 -0
- data/.claude-sessions/002-plan-orchestrator-interface-review.md +105 -0
- data/.claude-sessions/architecture-governance-implementation.md +37 -0
- data/.claude-sessions/architecture-review-session.md +27 -0
- data/ArchitecturalFeatureBuilder.md +136 -0
- data/ArchitectureConsiderations.md +229 -0
- data/CHANGELOG.md +57 -2
- data/CLAUDE.md +111 -0
- data/CONTRIBUTING.md +286 -0
- data/MAINTAINING.md +301 -0
- data/README.md +582 -28
- data/docs/agent_capabilities_api.md +259 -0
- data/docs/artifact_extension_points.md +757 -0
- data/docs/artifact_generation_architecture.md +323 -0
- data/docs/artifact_implementation_plan.md +596 -0
- data/docs/artifact_integration_points.md +345 -0
- data/docs/artifact_verification_strategies.md +581 -0
- data/docs/streaming_observability_architecture.md +510 -0
- data/exe/agentic +6 -1
- data/lefthook.yml +5 -0
- data/lib/agentic/adaptation_engine.rb +124 -0
- data/lib/agentic/agent.rb +181 -4
- data/lib/agentic/agent_assembly_engine.rb +442 -0
- data/lib/agentic/agent_capability_registry.rb +260 -0
- data/lib/agentic/agent_config.rb +63 -0
- data/lib/agentic/agent_specification.rb +46 -0
- data/lib/agentic/capabilities/examples.rb +530 -0
- data/lib/agentic/capabilities.rb +14 -0
- data/lib/agentic/capability_provider.rb +146 -0
- data/lib/agentic/capability_specification.rb +118 -0
- data/lib/agentic/cli/agent.rb +31 -0
- data/lib/agentic/cli/capabilities.rb +191 -0
- data/lib/agentic/cli/config.rb +134 -0
- data/lib/agentic/cli/execution_observer.rb +796 -0
- data/lib/agentic/cli.rb +1068 -0
- data/lib/agentic/default_agent_provider.rb +35 -0
- data/lib/agentic/errors/llm_error.rb +184 -0
- data/lib/agentic/execution_plan.rb +53 -0
- data/lib/agentic/execution_result.rb +91 -0
- data/lib/agentic/expected_answer_format.rb +46 -0
- data/lib/agentic/extension/domain_adapter.rb +109 -0
- data/lib/agentic/extension/plugin_manager.rb +163 -0
- data/lib/agentic/extension/protocol_handler.rb +116 -0
- data/lib/agentic/extension.rb +45 -0
- data/lib/agentic/factory_methods.rb +9 -1
- data/lib/agentic/generation_stats.rb +61 -0
- data/lib/agentic/learning/README.md +84 -0
- data/lib/agentic/learning/capability_optimizer.rb +613 -0
- data/lib/agentic/learning/execution_history_store.rb +251 -0
- data/lib/agentic/learning/pattern_recognizer.rb +500 -0
- data/lib/agentic/learning/strategy_optimizer.rb +706 -0
- data/lib/agentic/learning.rb +131 -0
- data/lib/agentic/llm_assisted_composition_strategy.rb +188 -0
- data/lib/agentic/llm_client.rb +215 -15
- data/lib/agentic/llm_config.rb +65 -1
- data/lib/agentic/llm_response.rb +163 -0
- data/lib/agentic/logger.rb +1 -1
- data/lib/agentic/observable.rb +51 -0
- data/lib/agentic/persistent_agent_store.rb +385 -0
- data/lib/agentic/plan_execution_result.rb +129 -0
- data/lib/agentic/plan_orchestrator.rb +464 -0
- data/lib/agentic/plan_orchestrator_config.rb +57 -0
- data/lib/agentic/retry_config.rb +63 -0
- data/lib/agentic/retry_handler.rb +125 -0
- data/lib/agentic/structured_outputs.rb +1 -1
- data/lib/agentic/task.rb +193 -0
- data/lib/agentic/task_definition.rb +39 -0
- data/lib/agentic/task_execution_result.rb +92 -0
- data/lib/agentic/task_failure.rb +66 -0
- data/lib/agentic/task_output_schemas.rb +112 -0
- data/lib/agentic/task_planner.rb +54 -19
- data/lib/agentic/task_result.rb +48 -0
- data/lib/agentic/ui.rb +244 -0
- data/lib/agentic/verification/critic_framework.rb +116 -0
- data/lib/agentic/verification/llm_verification_strategy.rb +60 -0
- data/lib/agentic/verification/schema_verification_strategy.rb +47 -0
- data/lib/agentic/verification/verification_hub.rb +62 -0
- data/lib/agentic/verification/verification_result.rb +50 -0
- data/lib/agentic/verification/verification_strategy.rb +26 -0
- data/lib/agentic/version.rb +1 -1
- data/lib/agentic.rb +74 -2
- data/plugins/README.md +41 -0
- metadata +245 -6
@@ -0,0 +1,117 @@
|
|
1
|
+
# ADR-016: Agent Assembly Engine
|
2
|
+
|
3
|
+
## Status
|
4
|
+
|
5
|
+
Accepted
|
6
|
+
|
7
|
+
## Context
|
8
|
+
|
9
|
+
A key requirement for the Agentic framework is the ability to dynamically assemble agents based on task requirements. Currently, agents are constructed manually or through predefined configurations, which:
|
10
|
+
|
11
|
+
1. Requires foreknowledge of task requirements
|
12
|
+
2. Results in either overly generic or overly specialized agents
|
13
|
+
3. Misses opportunities for capability reuse and optimization
|
14
|
+
4. Does not leverage knowledge from previous similar tasks
|
15
|
+
|
16
|
+
We need a system that can analyze task requirements, select appropriate capabilities, and assemble agents optimized for specific tasks. This system should also integrate with our persistent storage to reuse existing agents when appropriate.
|
17
|
+
|
18
|
+
## Decision
|
19
|
+
|
20
|
+
We will implement an `AgentAssemblyEngine` that handles the dynamic construction of agents based on task analysis. The engine will:
|
21
|
+
|
22
|
+
1. Analyze task requirements to determine needed capabilities
|
23
|
+
2. Select appropriate capabilities using pluggable selection strategies
|
24
|
+
3. Build agents with the selected capabilities
|
25
|
+
4. Store assembled agents for future reuse
|
26
|
+
5. Find and reuse suitable existing agents when possible
|
27
|
+
|
28
|
+
Key components:
|
29
|
+
|
30
|
+
```ruby
|
31
|
+
# Main engine
|
32
|
+
engine = AgentAssemblyEngine.new(registry, agent_store)
|
33
|
+
|
34
|
+
# Assemble an agent for a task
|
35
|
+
agent = engine.assemble_agent(task, strategy: strategy, store: true)
|
36
|
+
|
37
|
+
# Analyze task requirements
|
38
|
+
requirements = engine.analyze_requirements(task)
|
39
|
+
|
40
|
+
# Select capabilities based on requirements
|
41
|
+
capabilities = engine.select_capabilities(requirements, strategy)
|
42
|
+
|
43
|
+
# Build an agent with selected capabilities
|
44
|
+
agent = engine.build_agent(task, capabilities)
|
45
|
+
```
|
46
|
+
|
47
|
+
The engine will support multiple composition strategies through a Strategy pattern:
|
48
|
+
|
49
|
+
1. `DefaultCompositionStrategy`: Basic capability selection based on requirements
|
50
|
+
2. `LlmAssistedCompositionStrategy`: Uses an LLM to suggest optimal capabilities
|
51
|
+
3. Custom strategies can be implemented for specialized domains
|
52
|
+
|
53
|
+
## Consequences
|
54
|
+
|
55
|
+
### Positive
|
56
|
+
|
57
|
+
1. Enables task-optimized agent assembly
|
58
|
+
2. Supports agent reuse through integration with persistent store
|
59
|
+
3. Pluggable strategies allow domain-specific optimization
|
60
|
+
4. Reduces manual configuration requirements
|
61
|
+
5. Promotes capability-based agent design
|
62
|
+
|
63
|
+
### Negative
|
64
|
+
|
65
|
+
1. Increases system complexity
|
66
|
+
2. Requires accurate task requirement analysis
|
67
|
+
3. May lead to capability explosion without governance
|
68
|
+
4. LLM-assisted strategies add external dependencies
|
69
|
+
|
70
|
+
### Neutral
|
71
|
+
|
72
|
+
1. Changes agent construction paradigm from static to dynamic
|
73
|
+
2. Requires integration with the capability registry and agent store
|
74
|
+
3. May require adjustment of existing agent usage patterns
|
75
|
+
|
76
|
+
## Implementation Notes
|
77
|
+
|
78
|
+
### Task Requirement Analysis
|
79
|
+
|
80
|
+
The engine will analyze tasks using multiple approaches:
|
81
|
+
|
82
|
+
1. Task description analysis using pattern matching or NLP
|
83
|
+
2. Agent specification analysis for explicit capability requirements
|
84
|
+
3. Task input analysis for capability hints
|
85
|
+
4. LLM-assisted analysis for complex requirements
|
86
|
+
|
87
|
+
### Capability Selection
|
88
|
+
|
89
|
+
Selection strategies will consider:
|
90
|
+
- Capability relevance to the task
|
91
|
+
- Capability performance metrics from learning system
|
92
|
+
- Capability dependencies and compatibility
|
93
|
+
- Agent resource constraints
|
94
|
+
|
95
|
+
### Agent Matching
|
96
|
+
|
97
|
+
When finding existing agents for a task, the engine will:
|
98
|
+
1. Identify primary capabilities required for the task
|
99
|
+
2. Find agents with these capabilities
|
100
|
+
3. Score agents based on capability match
|
101
|
+
4. Return the best matching agent if score exceeds threshold
|
102
|
+
|
103
|
+
### Integration with Learning System
|
104
|
+
|
105
|
+
The engine will integrate with the learning system to:
|
106
|
+
1. Record capability selection decisions
|
107
|
+
2. Track assembled agent performance
|
108
|
+
3. Improve selection strategies based on outcomes
|
109
|
+
4. Optimize capability compositions
|
110
|
+
|
111
|
+
## Future Considerations
|
112
|
+
|
113
|
+
1. Support for agent composition constraints (e.g., maximum capabilities)
|
114
|
+
2. Advanced capability compatibility checking
|
115
|
+
3. Agent performance benchmarking for selection decisions
|
116
|
+
4. Multi-agent assembly for complex tasks
|
117
|
+
5. Capability governance and approval workflows
|
@@ -0,0 +1,171 @@
|
|
1
|
+
# ADR-017: Streaming Observability Architecture
|
2
|
+
|
3
|
+
## Status
|
4
|
+
|
5
|
+
Proposed
|
6
|
+
|
7
|
+
## Context
|
8
|
+
|
9
|
+
The Agentic framework currently provides basic observability through the Observable pattern and ExecutionObserver, but lacks real-time insights into intermediate execution steps. Users need visibility into:
|
10
|
+
|
11
|
+
1. **Task Execution Steps**: What happens during agent.execute() beyond start/end events
|
12
|
+
2. **Agent Assembly Process**: How capabilities are analyzed, selected, and assembled
|
13
|
+
3. **Plan Building**: How goals are analyzed and broken down into tasks
|
14
|
+
4. **Orchestration Decisions**: Task scheduling, dependency resolution, and resource allocation
|
15
|
+
5. **LLM Interactions**: Token usage, response times, and content flow
|
16
|
+
|
17
|
+
This visibility is crucial for debugging, performance optimization, and production monitoring. The current system provides only discrete lifecycle events without streaming intermediate states or progress updates.
|
18
|
+
|
19
|
+
## Decision Drivers
|
20
|
+
|
21
|
+
* **Debugging Complexity**: Complex multi-agent workflows are difficult to debug without intermediate visibility
|
22
|
+
* **Performance Optimization**: Real-time metrics needed to identify bottlenecks and optimize resource usage
|
23
|
+
* **Production Monitoring**: Operations teams need live insights into system behavior and health
|
24
|
+
* **Framework Adoption**: Better observability increases developer confidence and framework usability
|
25
|
+
* **Non-Breaking Requirement**: Must maintain backwards compatibility with existing Observable pattern
|
26
|
+
* **Performance Requirement**: Streaming must not significantly impact execution performance
|
27
|
+
|
28
|
+
## Decision
|
29
|
+
|
30
|
+
We will implement a **Streaming Observability Architecture** that extends the existing Observable pattern with real-time event streaming capabilities while maintaining full backwards compatibility.
|
31
|
+
|
32
|
+
**Architectural Components Affected:**
|
33
|
+
* Foundation Layer: StreamingObservabilityHub, Enhanced Observable pattern
|
34
|
+
* Runtime Layer: Task, PlanOrchestrator, AgentAssemblyEngine streaming integration
|
35
|
+
* Verification Layer: Real-time metrics aggregation and reporting
|
36
|
+
* Extension System: Pluggable stream processors and formatters
|
37
|
+
|
38
|
+
**Interface Changes:**
|
39
|
+
* New `StreamingObservable` module extending existing `Observable`
|
40
|
+
* New `ObservabilityStream` interface with multiple implementations
|
41
|
+
* New `StreamProcessor` interface for event filtering and transformation
|
42
|
+
* Enhanced lifecycle hooks in `PlanOrchestrator` with streaming support
|
43
|
+
* Optional streaming callbacks in task execution methods
|
44
|
+
|
45
|
+
## Consequences
|
46
|
+
|
47
|
+
### Positive
|
48
|
+
|
49
|
+
* **Enhanced Debugging**: Real-time visibility into all execution phases enables rapid issue identification
|
50
|
+
* **Performance Insights**: Live metrics help identify optimization opportunities and resource bottlenecks
|
51
|
+
* **Production Readiness**: Stream data enables external monitoring system integration
|
52
|
+
* **Framework Usability**: Better observability reduces learning curve and increases developer confidence
|
53
|
+
* **Future Extensibility**: Streaming infrastructure supports advanced features like dashboards and analytics
|
54
|
+
* **Community Value**: Open observability data enables community-driven improvements and integrations
|
55
|
+
|
56
|
+
### Negative
|
57
|
+
|
58
|
+
* **Implementation Complexity**: Adds significant code complexity across multiple system layers
|
59
|
+
* **Performance Overhead**: Event emission and processing may impact execution performance
|
60
|
+
* **Memory Usage**: Event buffering and stream management increases memory footprint
|
61
|
+
* **Testing Complexity**: Streaming behavior requires additional test scenarios and validation
|
62
|
+
* **Documentation Burden**: New observability features require comprehensive documentation and examples
|
63
|
+
* **Maintenance Cost**: Additional code surface area increases long-term maintenance requirements
|
64
|
+
|
65
|
+
### Neutral
|
66
|
+
|
67
|
+
* **Optional Feature**: Streaming is opt-in, so existing users unaffected until they choose to enable it
|
68
|
+
* **Backwards Compatibility**: All existing Observable behavior preserved without changes
|
69
|
+
* **Incremental Rollout**: Phased implementation allows gradual adoption and validation
|
70
|
+
* **Configuration Flexibility**: Multiple stream types and filtering options accommodate different use cases
|
71
|
+
|
72
|
+
## Implementation
|
73
|
+
|
74
|
+
**Phase 1: Core Infrastructure (3 weeks)**
|
75
|
+
* Implement `StreamingObservabilityHub` singleton for event coordination
|
76
|
+
* Create `ObservabilityStream` interface with `ConsoleStream`, `FileStream`, `MemoryStream`
|
77
|
+
* Extend `Observable` pattern with `StreamingObservable` mixin
|
78
|
+
* Integrate basic streaming with existing `ExecutionObserver`
|
79
|
+
|
80
|
+
**Phase 2: Task and Agent Streaming (4 weeks)**
|
81
|
+
* Enhance `Task#perform` with optional streaming callbacks
|
82
|
+
* Add streaming to `AgentAssemblyEngine` capability analysis and selection
|
83
|
+
* Implement LLM interaction streaming in agent execution
|
84
|
+
* Create enhanced real-time CLI feedback
|
85
|
+
|
86
|
+
**Phase 3: Orchestration and Planning Streaming (3 weeks)**
|
87
|
+
* Add streaming to `TaskPlanner` goal analysis and task generation
|
88
|
+
* Enhance `PlanOrchestrator` with dependency analysis and scheduling streams
|
89
|
+
* Implement `MetricsAggregator` for real-time performance metrics
|
90
|
+
* Create orchestration visualization and reporting
|
91
|
+
|
92
|
+
**Phase 4: Advanced Features (2 weeks)**
|
93
|
+
* Implement `WebSocketStream` for dashboard integration
|
94
|
+
* Add `StreamProcessor` framework for filtering and transformation
|
95
|
+
* Create configuration management and CLI integration
|
96
|
+
* Develop example dashboard and monitoring integrations
|
97
|
+
|
98
|
+
## Alternatives Considered
|
99
|
+
|
100
|
+
### Alternative 1: External Instrumentation
|
101
|
+
|
102
|
+
Use external instrumentation libraries (OpenTelemetry, StatsD) for observability.
|
103
|
+
|
104
|
+
**Pros:**
|
105
|
+
* Leverages existing infrastructure and tooling
|
106
|
+
* Standard metrics format for integration
|
107
|
+
* Proven performance characteristics
|
108
|
+
|
109
|
+
**Cons:**
|
110
|
+
* Less control over event structure and timing
|
111
|
+
* Limited ability to provide domain-specific insights
|
112
|
+
* Additional dependency on external libraries
|
113
|
+
* Doesn't provide real-time streaming within the framework
|
114
|
+
|
115
|
+
### Alternative 2: Callback-Based Hooks
|
116
|
+
|
117
|
+
Extend existing lifecycle hooks with detailed callback parameters.
|
118
|
+
|
119
|
+
**Pros:**
|
120
|
+
* Simpler implementation using existing patterns
|
121
|
+
* No new infrastructure required
|
122
|
+
* Maintains current performance characteristics
|
123
|
+
|
124
|
+
**Cons:**
|
125
|
+
* Limited to predefined hook points
|
126
|
+
* No support for intermediate streaming
|
127
|
+
* Difficult to add filtering and processing
|
128
|
+
* Poor scalability for complex observability needs
|
129
|
+
|
130
|
+
### Alternative 3: Event Sourcing Pattern
|
131
|
+
|
132
|
+
Implement full event sourcing with persistent event store.
|
133
|
+
|
134
|
+
**Pros:**
|
135
|
+
* Complete audit trail of all system events
|
136
|
+
* Enables replay and analysis capabilities
|
137
|
+
* Strong consistency guarantees
|
138
|
+
|
139
|
+
**Cons:**
|
140
|
+
* Significant implementation complexity
|
141
|
+
* Performance impact from persistent storage
|
142
|
+
* Overkill for real-time observability needs
|
143
|
+
* Changes fundamental system architecture
|
144
|
+
|
145
|
+
## Validation
|
146
|
+
|
147
|
+
**Acceptance Criteria:**
|
148
|
+
- [ ] Streaming adds <5% overhead to task execution performance
|
149
|
+
- [ ] All existing Observable behavior preserved without changes
|
150
|
+
- [ ] Real-time task execution steps visible in CLI
|
151
|
+
- [ ] Agent assembly process insights available
|
152
|
+
- [ ] Plan building and orchestration streaming functional
|
153
|
+
- [ ] WebSocket streaming supports external dashboards
|
154
|
+
- [ ] Comprehensive test coverage for all streaming scenarios
|
155
|
+
- [ ] Production-ready configuration and monitoring
|
156
|
+
|
157
|
+
**Testing Approach:**
|
158
|
+
* Performance benchmarks comparing execution with/without streaming
|
159
|
+
* Compatibility tests ensuring existing Observable behavior unchanged
|
160
|
+
* Integration tests validating end-to-end streaming flows
|
161
|
+
* Load testing for stream performance under high event volume
|
162
|
+
* Memory usage testing for event buffering and cleanup
|
163
|
+
* Thread safety testing for concurrent streaming operations
|
164
|
+
|
165
|
+
## References
|
166
|
+
|
167
|
+
* [Architectural Review: Streaming Observability](../reviews/streaming_observability_review.md)
|
168
|
+
* [Feature Planning: Streaming Observability](../planning/streaming_observability_feature.md)
|
169
|
+
* [System Architecture](../../ArchitectureConsiderations.md)
|
170
|
+
* [Observable Pattern Implementation](./ADR-011-task-observable-pattern.md)
|
171
|
+
* [Architectural Principles](../principles.md)
|
@@ -0,0 +1,150 @@
|
|
1
|
+
# Capability and Tools Distinction
|
2
|
+
|
3
|
+
## Overview
|
4
|
+
|
5
|
+
This document clarifies the distinction between "capabilities" and "tools" in the Agentic framework. While both concepts relate to agent functionality, they serve different purposes and have different characteristics.
|
6
|
+
|
7
|
+
## Capabilities
|
8
|
+
|
9
|
+
Capabilities represent rich, composable components that provide significant functionality to agents. They are formal, versioned interfaces with well-defined inputs and outputs.
|
10
|
+
|
11
|
+
### Key Characteristics
|
12
|
+
|
13
|
+
1. **Rich Interface Definition**
|
14
|
+
- Formal specification of inputs and outputs
|
15
|
+
- Type definitions and validation
|
16
|
+
- Required vs. optional parameters
|
17
|
+
|
18
|
+
2. **Semantic Versioning**
|
19
|
+
- Major.Minor.Patch versioning scheme
|
20
|
+
- Backward compatibility guarantees
|
21
|
+
- Version constraints for dependencies
|
22
|
+
|
23
|
+
3. **Dependency Management**
|
24
|
+
- Explicit declaration of dependencies
|
25
|
+
- Version constraints for dependencies
|
26
|
+
- Automatic resolution of dependency graphs
|
27
|
+
|
28
|
+
4. **Composition Support**
|
29
|
+
- Capabilities can be composed from other capabilities
|
30
|
+
- Higher-order capabilities encapsulate multiple capabilities
|
31
|
+
- Composition strategies for complex capability combinations
|
32
|
+
|
33
|
+
5. **Provider Implementation**
|
34
|
+
- Separation of interface (specification) from implementation
|
35
|
+
- Multiple providers can implement the same capability
|
36
|
+
- Providers can be swapped without affecting consumers
|
37
|
+
|
38
|
+
6. **Performance Tracking**
|
39
|
+
- Execution metrics collection
|
40
|
+
- Success/failure tracking
|
41
|
+
- Performance optimization based on historical data
|
42
|
+
|
43
|
+
### Example
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
# Define a capability specification
|
47
|
+
text_gen_capability = Agentic::CapabilitySpecification.new(
|
48
|
+
name: "text_generation",
|
49
|
+
description: "Generates text based on a prompt",
|
50
|
+
version: "1.0.0",
|
51
|
+
inputs: {
|
52
|
+
prompt: { type: "string", required: true, description: "The prompt to generate text from" },
|
53
|
+
max_tokens: { type: "integer", default: 100, description: "Maximum tokens to generate" }
|
54
|
+
},
|
55
|
+
outputs: {
|
56
|
+
response: { type: "string", description: "The generated text" }
|
57
|
+
}
|
58
|
+
)
|
59
|
+
|
60
|
+
# Create a provider for the capability
|
61
|
+
text_gen_provider = Agentic::CapabilityProvider.new(
|
62
|
+
capability: text_gen_capability,
|
63
|
+
implementation: ->(inputs) { { response: "Generated text for: #{inputs[:prompt]}" } }
|
64
|
+
)
|
65
|
+
|
66
|
+
# Register with the system
|
67
|
+
registry.register(text_gen_capability, text_gen_provider)
|
68
|
+
```
|
69
|
+
|
70
|
+
## Tools
|
71
|
+
|
72
|
+
Tools are simpler function-like utilities that agents can use for specific, focused tasks. They provide a lightweight mechanism for extending agent functionality without the formality of capabilities.
|
73
|
+
|
74
|
+
### Key Characteristics
|
75
|
+
|
76
|
+
1. **Simple Interface**
|
77
|
+
- Function-like calling convention
|
78
|
+
- Minimal parameter validation
|
79
|
+
- Limited formal documentation
|
80
|
+
|
81
|
+
2. **No Versioning**
|
82
|
+
- Single implementation at a time
|
83
|
+
- No formal backward compatibility guarantees
|
84
|
+
- No dependency management
|
85
|
+
|
86
|
+
3. **Direct Implementation**
|
87
|
+
- No separation between interface and implementation
|
88
|
+
- Direct execution without provider indirection
|
89
|
+
- Typically implemented as lambda functions or simple methods
|
90
|
+
|
91
|
+
4. **Limited Composition**
|
92
|
+
- No formal composition support
|
93
|
+
- Manual composition through function calls
|
94
|
+
- No dependency resolution
|
95
|
+
|
96
|
+
5. **Minimal Tracking**
|
97
|
+
- Basic usage logging only
|
98
|
+
- No formal performance metrics
|
99
|
+
- Limited optimization opportunities
|
100
|
+
|
101
|
+
### Example
|
102
|
+
|
103
|
+
```ruby
|
104
|
+
# Define a simple tool
|
105
|
+
agent.add_tool("calculate_sum") do |numbers|
|
106
|
+
numbers.sum
|
107
|
+
end
|
108
|
+
|
109
|
+
# Use the tool
|
110
|
+
result = agent.use_tool("calculate_sum", [1, 2, 3, 4, 5])
|
111
|
+
# => 15
|
112
|
+
```
|
113
|
+
|
114
|
+
## When to Use Each
|
115
|
+
|
116
|
+
### Use Capabilities When:
|
117
|
+
|
118
|
+
- The functionality is complex and reusable across multiple agent types
|
119
|
+
- Formal versioning and backward compatibility are important
|
120
|
+
- The functionality has dependencies on other capabilities
|
121
|
+
- Performance tracking and optimization are needed
|
122
|
+
- Multiple implementations might be required
|
123
|
+
- The functionality will evolve over time
|
124
|
+
|
125
|
+
### Use Tools When:
|
126
|
+
|
127
|
+
- The functionality is simple and focused
|
128
|
+
- Formal versioning isn't necessary
|
129
|
+
- The tool has no dependencies on other components
|
130
|
+
- Quick implementation is more important than formality
|
131
|
+
- The tool is specific to a particular agent or use case
|
132
|
+
- Performance tracking isn't critical
|
133
|
+
|
134
|
+
## Compatibility Layer
|
135
|
+
|
136
|
+
For backward compatibility, the framework provides a compatibility layer that allows tools to be used as capabilities and vice versa:
|
137
|
+
|
138
|
+
```ruby
|
139
|
+
# Convert a tool to a capability
|
140
|
+
capability = registry.tool_to_capability("calculate_sum", agent.tools["calculate_sum"])
|
141
|
+
|
142
|
+
# Convert a capability to a tool
|
143
|
+
agent.add_tool_from_capability("text_generation", registry.get("text_generation"))
|
144
|
+
```
|
145
|
+
|
146
|
+
## Future Direction
|
147
|
+
|
148
|
+
The framework is gradually moving toward a capability-centric approach, as capabilities provide richer functionality, better composition, and improved maintainability. However, tools will continue to be supported for simpler use cases and backward compatibility.
|
149
|
+
|
150
|
+
Over time, we expect more functionality to migrate from tools to capabilities, especially as the agent assembly system evolves to leverage capability-based composition more effectively.
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# Architectural Decision Record: CLI Command Structure
|
2
|
+
|
3
|
+
## Context
|
4
|
+
|
5
|
+
The Agentic CLI currently has duplicate command definitions appearing in the help output. Commands related to agent management and configuration appear both as top-level commands and as subcommands. This is causing confusion for users trying to understand the proper command structure.
|
6
|
+
|
7
|
+
Investigation revealed that two implementations of the same functionality exist:
|
8
|
+
1. Nested classes within the main CLI class (`AgentCommands` and `ConfigCommands` in cli.rb) with enhanced UI
|
9
|
+
2. Standalone files in the cli/ directory (`agent.rb` and `config.rb`) with simpler implementations
|
10
|
+
|
11
|
+
Both implementations are being loaded and registered, resulting in duplicate commands in the help output.
|
12
|
+
|
13
|
+
## Decision
|
14
|
+
|
15
|
+
We will standardize on the nested class implementation and remove the standalone file implementations. This approach:
|
16
|
+
|
17
|
+
1. Provides enhanced UI with colorization and box output for a better user experience
|
18
|
+
2. Maintains a clear hierarchy of commands
|
19
|
+
3. Eliminates duplicate commands in the help output
|
20
|
+
|
21
|
+
We will:
|
22
|
+
1. Remove or disable the standalone CLI command files (agent.rb, config.rb)
|
23
|
+
2. Update requires in agentic.rb to reflect this change
|
24
|
+
3. Ensure proper Thor subcommand registration
|
25
|
+
|
26
|
+
## Rationale
|
27
|
+
|
28
|
+
The nested class implementation provides a superior user experience with colorized output and formatted boxes. While moving to standalone files might provide better modularity in the long term, the current priority is to fix the command duplication and maintain the enhanced UI.
|
29
|
+
|
30
|
+
## Consequences
|
31
|
+
|
32
|
+
### Positive
|
33
|
+
- Elimination of duplicate commands in CLI help output
|
34
|
+
- Consistent, enhanced UI for all commands
|
35
|
+
- Clear command hierarchy
|
36
|
+
|
37
|
+
### Negative
|
38
|
+
- The CLI implementation remains in a single file, which may be less modular
|
39
|
+
- Future changes to the CLI may require more coordination
|
40
|
+
- Long-term maintenance might be more challenging
|
41
|
+
|
42
|
+
### Neutral
|
43
|
+
- This approach prioritizes user experience over code modularity
|
44
|
+
- A future refactoring to a hybrid approach may still be desirable
|
45
|
+
|
46
|
+
## Future Considerations
|
47
|
+
|
48
|
+
In future versions, we may want to consider:
|
49
|
+
1. Refactoring to a hybrid approach that maintains the enhanced UI while improving modularity
|
50
|
+
2. Separating UI presentation from command logic
|
51
|
+
3. Creating a more comprehensive testing framework for CLI commands
|
52
|
+
|
53
|
+
## Implementation Notes
|
54
|
+
|
55
|
+
The implementation will:
|
56
|
+
1. Remove or comment out requires for standalone CLI files in agentic.rb
|
57
|
+
2. Ensure only nested class implementations are being registered
|
58
|
+
3. Test all CLI commands to ensure they work as expected
|
59
|
+
4. Update documentation to reflect the command structure
|
60
|
+
|
61
|
+
Date: May 22, 2024
|