language-operator 0.1.67 → 0.1.71

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.
@@ -3,11 +3,15 @@
3
3
  module LanguageOperator
4
4
  module Dsl
5
5
  # Chat endpoint definition for agents
6
+ #
7
+ # DEPRECATED: This class is deprecated. All agents now automatically get
8
+ # identity-aware chat endpoints without configuration. The `as_chat_endpoint`
9
+ # DSL method is no longer needed.
6
10
  #
7
11
  # Allows agents to expose an OpenAI-compatible chat completion endpoint.
8
12
  # Other systems can treat the agent as a language model.
9
13
  #
10
- # @example Define chat endpoint in an agent
14
+ # @example Define basic chat endpoint
11
15
  # agent "github-expert" do
12
16
  # as_chat_endpoint do
13
17
  # system_prompt "You are a GitHub API expert"
@@ -15,9 +19,26 @@ module LanguageOperator
15
19
  # max_tokens 2000
16
20
  # end
17
21
  # end
22
+ #
23
+ # @example Define chat endpoint with identity awareness
24
+ # agent "support-bot" do
25
+ # as_chat_endpoint do
26
+ # system_prompt "You are a helpful customer support assistant"
27
+ #
28
+ # # Configure identity awareness and context injection
29
+ # identity_awareness do
30
+ # enabled true
31
+ # prompt_template :detailed
32
+ # context_injection :standard
33
+ # end
34
+ #
35
+ # temperature 0.8
36
+ # end
37
+ # end
18
38
  class ChatEndpointDefinition
19
39
  attr_reader :system_prompt, :temperature, :max_tokens, :model_name,
20
- :top_p, :frequency_penalty, :presence_penalty, :stop_sequences
40
+ :top_p, :frequency_penalty, :presence_penalty, :stop_sequences,
41
+ :identity_awareness_enabled, :prompt_template_level, :context_injection_level
21
42
 
22
43
  def initialize(agent_name)
23
44
  @agent_name = agent_name
@@ -29,6 +50,11 @@ module LanguageOperator
29
50
  @frequency_penalty = 0.0
30
51
  @presence_penalty = 0.0
31
52
  @stop_sequences = nil
53
+
54
+ # Identity awareness and context injection settings
55
+ @identity_awareness_enabled = true
56
+ @prompt_template_level = :standard
57
+ @context_injection_level = :standard
32
58
  end
33
59
 
34
60
  # Set system prompt for chat mode
@@ -110,6 +136,90 @@ module LanguageOperator
110
136
 
111
137
  @stop_sequences = sequences
112
138
  end
139
+
140
+ # Enable or disable identity awareness and context injection
141
+ #
142
+ # When enabled, the system prompt will be dynamically enhanced with
143
+ # agent identity, operational context, and environment information.
144
+ #
145
+ # @param enabled [Boolean] Whether to enable identity awareness
146
+ # @return [Boolean] Current setting
147
+ def enable_identity_awareness(enabled = nil)
148
+ return @identity_awareness_enabled if enabled.nil?
149
+
150
+ @identity_awareness_enabled = enabled
151
+ end
152
+
153
+ # Set the prompt template level for context injection
154
+ #
155
+ # Available levels:
156
+ # - :minimal - Basic agent identity only
157
+ # - :standard - Identity + basic operational context (default)
158
+ # - :detailed - Full context with capabilities
159
+ # - :comprehensive - All available context and guidelines
160
+ #
161
+ # @param level [Symbol] Template level
162
+ # @return [Symbol] Current template level
163
+ def prompt_template(level = nil)
164
+ return @prompt_template_level if level.nil?
165
+
166
+ valid_levels = [:minimal, :standard, :detailed, :comprehensive]
167
+ unless valid_levels.include?(level)
168
+ raise ArgumentError, "Invalid template level: #{level}. Must be one of: #{valid_levels.join(', ')}"
169
+ end
170
+
171
+ @prompt_template_level = level
172
+ end
173
+
174
+ # Set the context injection level for conversations
175
+ #
176
+ # Controls how much operational context is injected into ongoing conversations.
177
+ #
178
+ # Available levels:
179
+ # - :none - No context injection
180
+ # - :minimal - Basic status only
181
+ # - :standard - Standard operational context (default)
182
+ # - :detailed - Full context with metrics
183
+ #
184
+ # @param level [Symbol] Context injection level
185
+ # @return [Symbol] Current context injection level
186
+ def context_injection(level = nil)
187
+ return @context_injection_level if level.nil?
188
+
189
+ valid_levels = [:none, :minimal, :standard, :detailed]
190
+ unless valid_levels.include?(level)
191
+ raise ArgumentError, "Invalid context level: #{level}. Must be one of: #{valid_levels.join(', ')}"
192
+ end
193
+
194
+ @context_injection_level = level
195
+ end
196
+
197
+ # Configure identity awareness with options block
198
+ #
199
+ # @example
200
+ # identity_awareness do
201
+ # enabled true
202
+ # prompt_template :detailed
203
+ # context_injection :standard
204
+ # end
205
+ #
206
+ # @yield Block for configuring identity awareness options
207
+ def identity_awareness(&block)
208
+ if block_given?
209
+ instance_eval(&block)
210
+ else
211
+ {
212
+ enabled: @identity_awareness_enabled,
213
+ prompt_template: @prompt_template_level,
214
+ context_injection: @context_injection_level
215
+ }
216
+ end
217
+ end
218
+
219
+ # Alias methods for convenience
220
+ alias_method :enabled, :enable_identity_awareness
221
+ alias_method :template, :prompt_template
222
+ alias_method :context, :context_injection
113
223
  end
114
224
  end
115
225
  end
@@ -2,7 +2,7 @@
2
2
  :openapi: 3.0.3
3
3
  :info:
4
4
  :title: Language Operator Agent API
5
- :version: 0.1.67
5
+ :version: 0.1.71
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.67",
6
+ "version": "0.1.71",
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.67'
4
+ VERSION = '0.1.71'
5
5
  end
data/synth/003/Makefile CHANGED
@@ -27,11 +27,17 @@ inspect:
27
27
  learning-status:
28
28
  $(AICTL) learning status $(AGENT)
29
29
 
30
+ learn:
31
+ kubectl patch languageagent $(AGENT) --type='merge' -p='{"status":{"runsPendingLearning":10}}'
32
+
33
+
30
34
  logs:
31
35
  $(AICTL) logs $(AGENT)
32
36
 
33
37
  clean:
34
38
  $(AICTL) delete $(AGENT) --force
39
+ kubectl delete configmaps -l app.kubernetes.io/name=$(AGENT) --ignore-not-found=true
40
+ kubectl delete configmaps --field-selector metadata.name~=$(AGENT)-v --ignore-not-found=true
35
41
 
36
42
  save:
37
43
  $(AICTL) code $(AGENT) --raw > agent.rb
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.67
4
+ version: 0.1.71
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Ryan
@@ -65,6 +65,20 @@ dependencies:
65
65
  - - "~>"
66
66
  - !ruby/object:Gem::Version
67
67
  version: '1.3'
68
+ - !ruby/object:Gem::Dependency
69
+ name: json-schema
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.0'
75
+ type: :runtime
76
+ prerelease: false
77
+ version_requirements: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '5.0'
68
82
  - !ruby/object:Gem::Dependency
69
83
  name: puma
70
84
  requirement: !ruby/object:Gem::Requirement
@@ -503,11 +517,17 @@ files:
503
517
  - docs/how-agents-work.md
504
518
  - docs/installation.md
505
519
  - docs/observability.md
520
+ - docs/persona-driven-system-prompts.md
506
521
  - docs/quickstart.md
507
522
  - docs/schema-versioning.md
508
523
  - docs/understanding-generated-code.md
509
524
  - docs/using-tools.md
510
525
  - docs/webhooks.md
526
+ - examples/basic_agent_with_default_chat.rb
527
+ - examples/chat_endpoint_agent.rb
528
+ - examples/hybrid_agent.rb
529
+ - examples/identity_aware_chat_agent.rb
530
+ - examples/pure_agent_test.rb
511
531
  - examples/ux_helpers_demo.rb
512
532
  - lib/language_operator.rb
513
533
  - lib/language_operator/agent.rb
@@ -515,7 +535,9 @@ files:
515
535
  - lib/language_operator/agent/event_config.rb
516
536
  - lib/language_operator/agent/executor.rb
517
537
  - lib/language_operator/agent/instrumentation.rb
538
+ - lib/language_operator/agent/metadata_collector.rb
518
539
  - lib/language_operator/agent/metrics_tracker.rb
540
+ - lib/language_operator/agent/prompt_builder.rb
519
541
  - lib/language_operator/agent/safety/ast_validator.rb
520
542
  - lib/language_operator/agent/safety/audit_logger.rb
521
543
  - lib/language_operator/agent/safety/budget_tracker.rb