language-operator 0.1.38 → 0.1.39

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4476732244850657fb5161189ad68010e2ffdef4f4949361786893d119f0de89
4
- data.tar.gz: 5755720ffc0df24c88c5ec5ea223a4f8899c604f938422e420e878833d172de5
3
+ metadata.gz: a3674b7904fe01e280096b7e7c37ce8be922379d75a194e31ffd5239b082e7b8
4
+ data.tar.gz: 61cd4ab21b5495b537cb4babbe5e0a14c4890a93b9b1f2a1d4d4069c53c3ddc1
5
5
  SHA512:
6
- metadata.gz: a4408235ba4cc775fc175f7760e0632e78457630b263690efeb3ddc772c58facfcd7b7e0780a38d33bda5c4f9d3d12b46eed0f83d43631c94f1ddfe7180be61d
7
- data.tar.gz: 3ccbd9c8c91ef1d19ae467cafe3740cc84586853692cf46569d77b692b1cddf682fb21300bbb75244e71335b84a10fde768f6baff1016d18acf8b4c31a869862
6
+ metadata.gz: 33714e1bd58eb58d54101a038954a1fbd425ffa34904fdfc8cb3dcb9ba83b0090d445343071190b7bb48e599d8691d99b4918f8a9eab2ecf135634f92c7825ac
7
+ data.tar.gz: 235149dfa2f126e31b8450426d70ebb25f39badb30b343e274c7b50ab0d7b3674f224ffae251589967c4ea47022b171af3f0212cd466bc6c994171534e0b48ef
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- language-operator (0.1.38)
4
+ language-operator (0.1.39)
5
5
  faraday (~> 2.0)
6
6
  k8s-ruby (~> 0.17)
7
7
  mcp (~> 0.4)
@@ -445,15 +445,16 @@ module LanguageOperator
445
445
 
446
446
  # Execute the actual task implementation (neural or symbolic)
447
447
  #
448
+ # For hybrid tasks (both neural and symbolic), prefer symbolic execution
449
+ # as it's more efficient and deterministic.
450
+ #
448
451
  # @param task [TaskDefinition] The task definition
449
452
  # @param inputs [Hash] Input parameters
450
453
  # @return [Hash] Task outputs
451
454
  def execute_task_implementation(task, inputs)
452
- if task.neural?
453
- # Neural execution: LLM with tool access
454
- execute_neural(task, inputs)
455
- else
455
+ if task.symbolic?
456
456
  # Symbolic execution: Direct Ruby code within traced span
457
+ # This takes precedence over neural for hybrid tasks
457
458
  tracer.in_span('task_executor.symbolic', attributes: symbolic_task_attributes(task)) do |span|
458
459
  validated_inputs = task.validate_inputs(inputs)
459
460
  span.set_attribute('task.input.keys', validated_inputs.keys.map(&:to_s).join(','))
@@ -465,6 +466,12 @@ module LanguageOperator
465
466
  record_output_metadata(outputs, span) if outputs.is_a?(Hash)
466
467
  outputs
467
468
  end
469
+ elsif task.neural?
470
+ # Neural execution: LLM with tool access
471
+ # Only used for pure neural tasks (no symbolic implementation)
472
+ execute_neural(task, inputs)
473
+ else
474
+ raise ArgumentError, "Task '#{task.name}' has neither neural nor symbolic implementation"
468
475
  end
469
476
  end
470
477
 
@@ -191,9 +191,43 @@ module LanguageOperator
191
191
  logger.info('Main block execution completed',
192
192
  result: result)
193
193
 
194
+ # Call output handler if defined
195
+ if agent_def.output
196
+ logger.debug('Executing output handler', outputs: result)
197
+ execute_output_handler(agent_def, result, task_executor)
198
+ end
199
+
194
200
  result
195
201
  end
196
202
 
203
+ # Execute the output handler (neural or symbolic)
204
+ #
205
+ # @param agent_def [LanguageOperator::Dsl::AgentDefinition] The agent definition
206
+ # @param outputs [Hash] The outputs from main execution
207
+ # @param task_executor [LanguageOperator::Agent::TaskExecutor] Task executor for context
208
+ # @return [void]
209
+ def self.execute_output_handler(agent_def, outputs, task_executor)
210
+ output_config = agent_def.output
211
+
212
+ # If symbolic implementation exists, use it
213
+ if output_config.symbolic?
214
+ logger.debug('Executing symbolic output handler')
215
+ # execute_symbolic takes (inputs, context) - outputs are the inputs, task_executor is context
216
+ output_config.execute_symbolic(outputs, task_executor)
217
+ elsif output_config.neural?
218
+ # Neural output - would need LLM access to execute
219
+ # For now, just log the instruction
220
+ logger.info('Neural output handler',
221
+ instruction: output_config.instructions_text,
222
+ outputs: outputs)
223
+ logger.warn('Neural output execution not yet implemented - instruction logged only')
224
+ end
225
+ rescue StandardError => e
226
+ logger.error('Output handler failed',
227
+ error: e.message,
228
+ backtrace: e.backtrace[0..5])
229
+ end
230
+
197
231
  # Build executor configuration from agent definition constraints
198
232
  #
199
233
  # @param agent_def [LanguageOperator::Dsl::AgentDefinition] The agent definition
@@ -97,7 +97,14 @@ module LanguageOperator
97
97
  def create_resource(resource)
98
98
  resource_client = resource_client_for_resource(resource)
99
99
  # Convert hash to K8s::Resource if needed
100
- k8s_resource = resource.is_a?(K8s::Resource) ? resource : K8s::Resource.new(resource)
100
+ k8s_resource = if resource.is_a?(K8s::Resource)
101
+ resource
102
+ else
103
+ # Remove resourceVersion if present - it should not be set on new resources
104
+ resource_hash = resource.dup
105
+ resource_hash['metadata']&.delete('resourceVersion')
106
+ K8s::Resource.new(resource_hash)
107
+ end
101
108
  resource_client.create_resource(k8s_resource)
102
109
  end
103
110
 
@@ -2,7 +2,7 @@
2
2
  :openapi: 3.0.3
3
3
  :info:
4
4
  :title: Language Operator Agent API
5
- :version: 0.1.38
5
+ :version: 0.1.39
6
6
  :description: HTTP API endpoints exposed by Language Operator reactive agents
7
7
  :contact:
8
8
  :name: Language Operator
@@ -3,7 +3,7 @@
3
3
  "$id": "https://github.com/language-operator/language-operator-gem/schema/agent-dsl.json",
4
4
  "title": "Language Operator Agent DSL",
5
5
  "description": "Schema for defining autonomous AI agents using the Language Operator DSL",
6
- "version": "0.1.38",
6
+ "version": "0.1.39",
7
7
  "type": "object",
8
8
  "properties": {
9
9
  "name": {
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LanguageOperator
4
- VERSION = '0.1.38'
4
+ VERSION = '0.1.39'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: language-operator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.38
4
+ version: 0.1.39
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Ryan