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,259 @@
1
+ # Agent Capabilities API
2
+
3
+ This document provides an overview of the Agent Capabilities API in Agentic, which enables the creation, registration, and management of agent capabilities.
4
+
5
+ ## Core Components
6
+
7
+ The capability system consists of these key components:
8
+
9
+ 1. **CapabilitySpecification**: Defines the interface of a capability
10
+ 2. **CapabilityProvider**: Implements the functionality of a capability
11
+ 3. **AgentCapabilityRegistry**: Central registry for discovering and managing capabilities
12
+ 4. **AgentAssemblyEngine**: Dynamically assembles agents with appropriate capabilities
13
+ 5. **PersistentAgentStore**: Stores and retrieves agent configurations
14
+
15
+ ## Using the Capability API
16
+
17
+ ### Registering a Capability
18
+
19
+ ```ruby
20
+ # Define a capability specification
21
+ text_gen_capability = Agentic::CapabilitySpecification.new(
22
+ name: "text_generation",
23
+ description: "Generates text based on a prompt",
24
+ version: "1.0.0",
25
+ inputs: {
26
+ prompt: { type: "string", required: true, description: "The prompt to generate text from" }
27
+ },
28
+ outputs: {
29
+ response: { type: "string", description: "The generated text" }
30
+ }
31
+ )
32
+
33
+ # Create a provider for the capability
34
+ text_gen_provider = Agentic::CapabilityProvider.new(
35
+ capability: text_gen_capability,
36
+ implementation: ->(inputs) {
37
+ # Implementation logic here
38
+ { response: "Generated text for: #{inputs[:prompt]}" }
39
+ }
40
+ )
41
+
42
+ # Register the capability with the system
43
+ Agentic.register_capability(text_gen_capability, text_gen_provider)
44
+ ```
45
+
46
+ ### Adding a Capability to an Agent
47
+
48
+ ```ruby
49
+ # Create an agent
50
+ agent = Agentic::Agent.new do |a|
51
+ a.role = "Assistant"
52
+ a.purpose = "Help users with their questions"
53
+ a.backstory = "I am an AI assistant designed to be helpful and informative."
54
+ end
55
+
56
+ # Add a capability to the agent
57
+ agent.add_capability("text_generation")
58
+ ```
59
+
60
+ ### Executing a Capability
61
+
62
+ ```ruby
63
+ # Execute a capability on an agent
64
+ result = agent.execute_capability("text_generation", { prompt: "Tell me about AI" })
65
+ puts result[:response]
66
+ ```
67
+
68
+ ### Creating an Agent with the Assembly Engine
69
+
70
+ ```ruby
71
+ # Define a task
72
+ task = Agentic::Task.new(
73
+ description: "Generate some text and search the web for information",
74
+ agent_spec: Agentic::AgentSpecification.new(
75
+ name: "Research Agent",
76
+ description: "An agent for research tasks",
77
+ instructions: "Perform research and generate text based on findings"
78
+ ),
79
+ input: {
80
+ query: "AI trends in 2023"
81
+ }
82
+ )
83
+
84
+ # Assemble an agent for the task
85
+ agent = Agentic.assemble_agent(task)
86
+ ```
87
+
88
+ ### Storing and Retrieving Agents
89
+
90
+ ```ruby
91
+ # Store an agent for future use
92
+ agent_id = Agentic.agent_store.store(agent, name: "research_agent")
93
+
94
+ # Later, retrieve the agent
95
+ stored_agent = Agentic.agent_store.build_agent("research_agent")
96
+
97
+ # Or retrieve by ID
98
+ stored_agent = Agentic.agent_store.build_agent(agent_id)
99
+ ```
100
+
101
+ ## API Reference
102
+
103
+ ### CapabilitySpecification
104
+
105
+ A capability specification defines the interface of a capability, including inputs, outputs, and metadata.
106
+
107
+ #### Attributes
108
+
109
+ - `name`: String - The name of the capability
110
+ - `description`: String - A description of the capability
111
+ - `version`: String - The version of the capability (semantic versioning)
112
+ - `inputs`: Hash - The inputs required by the capability
113
+ - `outputs`: Hash - The outputs produced by the capability
114
+ - `dependencies`: Array - Other capabilities this one depends on
115
+
116
+ #### Key Methods
117
+
118
+ - `compatible_with?(other)`: Checks if this capability is compatible with another
119
+ - `to_h`: Converts the specification to a hash
120
+ - `from_h(hash)`: Creates a specification from a hash
121
+ - `requirements_description`: Gets a human-readable description of the requirements
122
+
123
+ ### CapabilityProvider
124
+
125
+ A capability provider implements the functionality of a capability.
126
+
127
+ #### Attributes
128
+
129
+ - `capability`: CapabilitySpecification - The specification of the capability
130
+ - `implementation`: Proc or Class - The implementation of the capability
131
+
132
+ #### Key Methods
133
+
134
+ - `execute(inputs)`: Executes the capability with the given inputs
135
+ - `validate_inputs!(inputs)`: Validates inputs against the specification
136
+ - `validate_outputs!(outputs)`: Validates outputs against the specification
137
+
138
+ ### AgentCapabilityRegistry
139
+
140
+ The registry manages capability specifications and providers.
141
+
142
+ #### Key Methods
143
+
144
+ - `register(capability, provider)`: Registers a capability and provider
145
+ - `get(name, version)`: Gets a capability by name and version
146
+ - `get_provider(name, version)`: Gets a provider by name and version
147
+ - `list(include_providers)`: Lists all registered capabilities
148
+ - `find(criteria)`: Finds capabilities matching criteria
149
+ - `compose(name, description, version, capabilities, compose_fn)`: Composes multiple capabilities into a new one
150
+
151
+ ### AgentAssemblyEngine
152
+
153
+ The assembly engine dynamically builds agents with appropriate capabilities.
154
+
155
+ #### Key Methods
156
+
157
+ - `assemble_agent(task, strategy, store)`: Assembles an agent for a task
158
+ - `analyze_requirements(task)`: Analyzes a task to determine capability requirements
159
+ - `select_capabilities(requirements, strategy)`: Selects capabilities based on requirements
160
+ - `build_agent(task, capabilities)`: Builds an agent with selected capabilities
161
+
162
+ ### PersistentAgentStore
163
+
164
+ The agent store manages persistence of agent configurations.
165
+
166
+ #### Key Methods
167
+
168
+ - `store(agent, name, metadata)`: Stores an agent configuration
169
+ - `build_agent(id_or_name, version)`: Builds an agent from a stored configuration
170
+ - `all(filter)`: Lists all stored agent configurations
171
+ - `delete(id_or_name, version)`: Deletes an agent configuration
172
+ - `version_history(id)`: Gets the version history of an agent
173
+
174
+ ## Command Line Interface
175
+
176
+ The Agentic CLI provides commands for managing capabilities and agents:
177
+
178
+ ### Capability Commands
179
+
180
+ ```bash
181
+ # List available capabilities
182
+ agentic capabilities list
183
+
184
+ # Show details of a specific capability
185
+ agentic capabilities show text_generation
186
+
187
+ # Search for capabilities
188
+ agentic capabilities search generation
189
+ ```
190
+
191
+ ### Agent Commands
192
+
193
+ ```bash
194
+ # List available agents
195
+ agentic agent list
196
+
197
+ # Create a new agent
198
+ agentic agent create my_agent --role="Assistant" --purpose="Help users" --capabilities=text_generation,web_search
199
+
200
+ # Show details of a specific agent
201
+ agentic agent show my_agent
202
+
203
+ # Delete an agent
204
+ agentic agent delete my_agent
205
+
206
+ # Build an agent from storage
207
+ agentic agent build my_agent
208
+ ```
209
+
210
+ ## Advanced Usage
211
+
212
+ ### Creating Composite Capabilities
213
+
214
+ ```ruby
215
+ # Compose multiple capabilities into a new one
216
+ registry = Agentic.agent_capability_registry
217
+
218
+ registry.compose(
219
+ "advanced_research",
220
+ "Performs advanced research with text generation and web search",
221
+ "1.0.0",
222
+ [
223
+ { name: "text_generation", version: "1.0.0" },
224
+ { name: "web_search", version: "1.0.0" }
225
+ ],
226
+ ->(providers, inputs) {
227
+ # Implementation that uses both capabilities
228
+ search_results = providers[1].execute(query: inputs[:topic])[:results]
229
+ text = providers[0].execute(prompt: "Write about #{inputs[:topic]} using this information: #{search_results.join(', ')}")[:response]
230
+ { research_report: text, sources: search_results }
231
+ }
232
+ )
233
+ ```
234
+
235
+ ### Custom Composition Strategies
236
+
237
+ ```ruby
238
+ # Create a custom composition strategy
239
+ class MyCompositionStrategy < Agentic::AgentCompositionStrategy
240
+ def select_capabilities(requirements, registry)
241
+ # Custom logic to select capabilities
242
+ # ...
243
+ end
244
+ end
245
+
246
+ # Use the custom strategy
247
+ strategy = MyCompositionStrategy.new
248
+ agent = Agentic.assemble_agent(task, strategy: strategy)
249
+ ```
250
+
251
+ ## Best Practices
252
+
253
+ 1. **Atomic Capabilities**: Design capabilities to be focused on a single responsibility
254
+ 2. **Clear Interfaces**: Define clear input and output schemas for capabilities
255
+ 3. **Semantic Versioning**: Use semantic versioning for capability versions
256
+ 4. **Composition**: Compose simple capabilities into more complex ones
257
+ 5. **Dependency Management**: Explicitly declare dependencies between capabilities
258
+ 6. **Persistence**: Store assembled agents for reuse with similar tasks
259
+ 7. **Validation**: Validate inputs and outputs against the capability specification