language-operator 0.1.63 → 0.1.65
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/.plan.md +127 -0
- data/.rspec +3 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +4 -1
- data/Makefile +34 -80
- data/components/agent/Gemfile +1 -1
- data/docs/cheat-sheet.md +173 -0
- data/lib/language_operator/agent/base.rb +10 -1
- data/lib/language_operator/agent/event_config.rb +172 -0
- data/lib/language_operator/agent/safety/ast_validator.rb +1 -1
- data/lib/language_operator/agent/safety/safe_executor.rb +5 -1
- data/lib/language_operator/agent/task_executor.rb +87 -7
- data/lib/language_operator/agent/telemetry.rb +25 -3
- data/lib/language_operator/agent/web_server.rb +6 -9
- data/lib/language_operator/cli/commands/agent/base.rb +15 -17
- data/lib/language_operator/cli/commands/agent/learning.rb +156 -37
- data/lib/language_operator/cli/commands/cluster.rb +2 -2
- data/lib/language_operator/cli/commands/status.rb +2 -2
- data/lib/language_operator/cli/commands/system/synthesize.rb +1 -1
- data/lib/language_operator/cli/formatters/value_formatter.rb +1 -1
- data/lib/language_operator/cli/helpers/ux_helper.rb +3 -4
- data/lib/language_operator/config.rb +3 -3
- data/lib/language_operator/constants/kubernetes_labels.rb +2 -2
- data/lib/language_operator/dsl/task_definition.rb +18 -7
- data/lib/language_operator/instrumentation/task_tracer.rb +44 -3
- data/lib/language_operator/kubernetes/client.rb +111 -0
- data/lib/language_operator/templates/schema/CHANGELOG.md +28 -0
- data/lib/language_operator/templates/schema/agent_dsl_openapi.yaml +1 -1
- data/lib/language_operator/templates/schema/agent_dsl_schema.json +1 -1
- data/lib/language_operator/type_coercion.rb +22 -8
- data/lib/language_operator/version.rb +1 -1
- data/synth/002/agent.rb +23 -12
- data/synth/002/output.log +88 -15
- data/synth/003/Makefile +5 -2
- data/synth/004/Makefile +54 -0
- data/synth/004/README.md +281 -0
- data/synth/004/instructions.txt +1 -0
- metadata +8 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d7c2d32e32603ef4e3f33c04ded923e5c24d207f544a70c146034fa0d07c1f38
|
|
4
|
+
data.tar.gz: 64d778197bbcd3af3e3071db8954287912274fc9117838a8a320a8e5745956b1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e97cd6b388ac0a8965e0be894b0e22089b3139a7cadff32979ab5920516579003e2d686933737ad55aaa4c6ff51e0ff747601702d653bbc1e755b69c307410a8
|
|
7
|
+
data.tar.gz: e28c7f2db22231bfb41c6daac57154905acd11d6ab92c683146ec0e1bbe22fd3a109cff5af501fb86f9cc80b623342b1fca956a4d3ebb51b7bc7ba618581020b
|
data/.plan.md
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
# Implementation Plan: Fix 4 Symbolic Task Execution Test Failures
|
|
2
|
+
|
|
3
|
+
## Issue Analysis
|
|
4
|
+
|
|
5
|
+
Issue #121 claims "syntax errors" but the actual failures are:
|
|
6
|
+
|
|
7
|
+
1. **Word count assertion error** (line 106) - Test expects 8, got 9
|
|
8
|
+
2. **AST validator blocks `raise`** (line 227) - Security system rejects exception raising
|
|
9
|
+
3. **Missing input type validation** (line 261) - Type validation not enforced
|
|
10
|
+
4. **Missing output schema validation** (line 285) - Schema validation not enforced
|
|
11
|
+
|
|
12
|
+
## Root Causes
|
|
13
|
+
|
|
14
|
+
### Failure 1: Word Count Off-by-One
|
|
15
|
+
- Test text: `'Hello world! This is a test. How are you?'`
|
|
16
|
+
- Current split: `/\s+/` counts all whitespace-separated tokens
|
|
17
|
+
- Assertion expects 8 words, actual is 9 (likely counting punctuation)
|
|
18
|
+
- **Fix**: Adjust test expectation or word counting logic
|
|
19
|
+
|
|
20
|
+
### Failure 2: AST Validator Blocks `raise`
|
|
21
|
+
- Location: [ast_validator.rb:98](lib/language_operator/agent/safety/ast_validator.rb#L98)
|
|
22
|
+
- `raise` is in DANGEROUS_METHODS list
|
|
23
|
+
- Test intentionally uses `raise ArgumentError, "Cannot divide by zero"`
|
|
24
|
+
- **Options**:
|
|
25
|
+
- A) Allow `raise` for standard Ruby exceptions (safe)
|
|
26
|
+
- B) Rewrite test to not use `raise` (changes test intent)
|
|
27
|
+
- **Recommendation**: Option A - `raise` is essential for error handling
|
|
28
|
+
|
|
29
|
+
### Failure 3 & 4: Wrong Exception Type in Validation
|
|
30
|
+
- Type/schema validation IS implemented in TaskDefinition.validate_inputs/validate_outputs
|
|
31
|
+
- TypeCoercion.validate_array raises `ArgumentError: "Expected array, got String"` ✅
|
|
32
|
+
- TaskDefinition.coerce_value catches and re-raises `ArgumentError` with context
|
|
33
|
+
- **Problem**: Tests expect `TaskValidationError`, but code raises `ArgumentError`
|
|
34
|
+
- **Fix**: TaskDefinition.coerce_value should raise `TaskValidationError` instead
|
|
35
|
+
- **Location**: [lib/language_operator/dsl/task_definition.rb:279-284](lib/language_operator/dsl/task_definition.rb#L279-L284)
|
|
36
|
+
|
|
37
|
+
## Investigation Plan
|
|
38
|
+
|
|
39
|
+
1. ✅ Verify test failures (all 4 failures confirmed)
|
|
40
|
+
2. ✅ Check AST validator - `raise` is in DANGEROUS_METHODS list
|
|
41
|
+
3. ✅ Check TaskExecutor validation - calls task.validate_inputs/validate_outputs
|
|
42
|
+
4. ✅ Check TypeCoercion - raises ArgumentError, not TaskValidationError
|
|
43
|
+
5. ✅ Check word count - split by /\s+/ gives 9 words (punctuation attached)
|
|
44
|
+
|
|
45
|
+
## Implementation Approach
|
|
46
|
+
|
|
47
|
+
### Fix 1: Word Count Test (Line 106)
|
|
48
|
+
**File**: spec/integration/symbolic_task_execution_spec.rb
|
|
49
|
+
**Change**: Update expectation from `eq(8)` to `eq(9)`
|
|
50
|
+
**Reason**: `'Hello world! This is a test. How are you?'.split(/\s+/)` produces 9 tokens
|
|
51
|
+
**Tokens**: ["Hello", "world!", "This", "is", "a", "test.", "How", "are", "you?"]
|
|
52
|
+
|
|
53
|
+
### Fix 2: Allow `raise` in AST Validator (Line 227)
|
|
54
|
+
**File**: lib/language_operator/agent/safety/ast_validator.rb
|
|
55
|
+
**Change**: Remove `raise` and `fail` from DANGEROUS_METHODS list (line 28)
|
|
56
|
+
**Reason**:
|
|
57
|
+
- `raise` is essential for proper Ruby error handling
|
|
58
|
+
- Used to raise standard exceptions (ArgumentError, TypeError, etc.)
|
|
59
|
+
- Cannot escape sandbox - exceptions propagate up to agent runtime
|
|
60
|
+
- No security risk - just control flow
|
|
61
|
+
**Alternative**: Could allow only standard library exceptions, but removing entirely is simpler
|
|
62
|
+
|
|
63
|
+
### Fix 3 & 4: Raise TaskValidationError (Lines 261, 285)
|
|
64
|
+
**File**: lib/language_operator/dsl/task_definition.rb
|
|
65
|
+
**Change**: In `coerce_value` method (line 279-284), catch `ArgumentError` and raise `TaskValidationError`
|
|
66
|
+
**Current**:
|
|
67
|
+
```ruby
|
|
68
|
+
def coerce_value(value, type, context)
|
|
69
|
+
TypeCoercion.coerce(value, type)
|
|
70
|
+
rescue ArgumentError => e
|
|
71
|
+
raise ArgumentError, "#{e.message} for #{context}"
|
|
72
|
+
end
|
|
73
|
+
```
|
|
74
|
+
**New**:
|
|
75
|
+
```ruby
|
|
76
|
+
def coerce_value(value, type, context)
|
|
77
|
+
TypeCoercion.coerce(value, type)
|
|
78
|
+
rescue ArgumentError => e
|
|
79
|
+
raise TaskValidationError.new(@name, "#{e.message} for #{context}", e)
|
|
80
|
+
end
|
|
81
|
+
```
|
|
82
|
+
**Impact**: Changes exception type from ArgumentError to TaskValidationError for validation failures
|
|
83
|
+
|
|
84
|
+
## Files to Modify
|
|
85
|
+
|
|
86
|
+
### 1. lib/language_operator/agent/safety/ast_validator.rb
|
|
87
|
+
- Line 28: Remove `raise fail` from DANGEROUS_METHODS
|
|
88
|
+
- Impact: Allows error handling in symbolic tasks
|
|
89
|
+
|
|
90
|
+
### 2. lib/language_operator/dsl/task_definition.rb
|
|
91
|
+
- Lines 279-284: Change exception type in `coerce_value` method
|
|
92
|
+
- Add: `require_relative '../agent/task_executor'` at top
|
|
93
|
+
- Impact: Validation errors now use correct exception class
|
|
94
|
+
|
|
95
|
+
### 3. spec/integration/symbolic_task_execution_spec.rb
|
|
96
|
+
- Line 106: Change `eq(8)` to `eq(9)`
|
|
97
|
+
- Impact: Fixes off-by-one word count assertion
|
|
98
|
+
|
|
99
|
+
## Risks & Considerations
|
|
100
|
+
|
|
101
|
+
### Security - Allowing `raise`
|
|
102
|
+
- **Risk**: Could `raise` be used to escape sandbox?
|
|
103
|
+
- **Analysis**: No. Exceptions propagate through call stack to agent runtime
|
|
104
|
+
- Sandbox boundary is AST validation + binding restrictions, not exception handling
|
|
105
|
+
- Standard exceptions (ArgumentError, etc.) are safe
|
|
106
|
+
- **Decision**: Safe to allow. Essential for error handling.
|
|
107
|
+
|
|
108
|
+
### Backward Compatibility - TaskValidationError
|
|
109
|
+
- **Risk**: Existing agents may catch `ArgumentError` for validation failures
|
|
110
|
+
- **Impact**: Low - internal validation, most code doesn't catch this
|
|
111
|
+
- TaskValidationError is a subclass of TaskExecutionError (StandardError)
|
|
112
|
+
- Most exception handling uses generic `rescue` or `rescue StandardError`
|
|
113
|
+
- **Decision**: Safe. Tests already expect this behavior.
|
|
114
|
+
|
|
115
|
+
### Performance
|
|
116
|
+
- No performance impact - only changes exception class, not validation logic
|
|
117
|
+
|
|
118
|
+
## Testing Strategy
|
|
119
|
+
|
|
120
|
+
1. **Fix 1** → Run test at line 106 → Should pass
|
|
121
|
+
2. **Fix 2** → Run test at line 227 → Should pass
|
|
122
|
+
3. **Fix 3** → Run tests at lines 261, 285 → Should pass
|
|
123
|
+
4. **All fixes** → Run full integration suite
|
|
124
|
+
5. **Unit tests** → Verify no regressions
|
|
125
|
+
6. **Linter** → Run RuboCop
|
|
126
|
+
7. **Manual test** → Create agent with symbolic task that raises exception
|
|
127
|
+
# Test fixes completed
|
data/.rspec
ADDED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
PATH
|
|
2
2
|
remote: .
|
|
3
3
|
specs:
|
|
4
|
-
language-operator (0.1.
|
|
4
|
+
language-operator (0.1.65)
|
|
5
5
|
faraday (~> 2.0)
|
|
6
6
|
k8s-ruby (~> 0.17)
|
|
7
7
|
lru_redux (~> 1.1)
|
|
@@ -151,6 +151,8 @@ GEM
|
|
|
151
151
|
opentelemetry-api (~> 1.0)
|
|
152
152
|
ostruct (0.6.3)
|
|
153
153
|
parallel (1.27.0)
|
|
154
|
+
parallel_tests (5.5.0)
|
|
155
|
+
parallel
|
|
154
156
|
parser (3.3.10.0)
|
|
155
157
|
ast (~> 2.4.1)
|
|
156
158
|
racc
|
|
@@ -272,6 +274,7 @@ DEPENDENCIES
|
|
|
272
274
|
bundler (~> 2.0)
|
|
273
275
|
language-operator!
|
|
274
276
|
memory_profiler (~> 1.0)
|
|
277
|
+
parallel_tests (~> 5.5)
|
|
275
278
|
pry (~> 0.14)
|
|
276
279
|
rack-test (~> 2.1)
|
|
277
280
|
rake (~> 13.0)
|
data/Makefile
CHANGED
|
@@ -7,111 +7,65 @@ ITERATE_PROMPT := "/task iterate"
|
|
|
7
7
|
PRIORITIZE_PROMPT := "/task prioritize"
|
|
8
8
|
DISTILL_PROMPT := "/task distill"
|
|
9
9
|
|
|
10
|
-
# Distill Claude's SCRATCH.md file
|
|
11
|
-
distill:
|
|
12
|
-
@claude --dangerously-skip-permissions $(DISTILL_PROMPT)
|
|
13
|
-
|
|
14
|
-
# Use claude to prioritize the backlog
|
|
15
|
-
prioritize:
|
|
16
|
-
@claude --dangerously-skip-permissions $(PRIORITIZE_PROMPT)
|
|
17
|
-
|
|
18
|
-
# Use claude to iterate on the backlog
|
|
19
|
-
iterate:
|
|
20
|
-
@claude --dangerously-skip-permissions $(ITERATE_PROMPT)
|
|
21
|
-
|
|
22
|
-
# Use claude to find bugs
|
|
23
|
-
qa:
|
|
24
|
-
@claude --dangerously-skip-permissions $(QA_PROMPT)
|
|
25
|
-
|
|
26
|
-
|
|
27
10
|
help: ## Show this help message
|
|
28
11
|
@echo 'Usage: make [target]'
|
|
29
12
|
@echo ''
|
|
30
13
|
@echo 'Available targets:'
|
|
31
|
-
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST)
|
|
14
|
+
@awk 'BEGIN {FS = ":.*?## "} /^[a-zA-Z_-]+:.*?## / {printf " %-20s %s\n", $$1, $$2}' $(MAKEFILE_LIST) | sort
|
|
32
15
|
|
|
33
16
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
@bundle exec rake schema:generate
|
|
37
|
-
@echo "✅ Schema artifacts generated"
|
|
17
|
+
# Claude development tasks
|
|
18
|
+
# ------------------------
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
@
|
|
41
|
-
@gem build language-operator.gemspec
|
|
42
|
-
@echo "✅ Gem built successfully"
|
|
20
|
+
distill: ## Distill SCRATCH.md
|
|
21
|
+
@claude --dangerously-skip-permissions $(DISTILL_PROMPT)
|
|
43
22
|
|
|
44
|
-
|
|
45
|
-
@
|
|
46
|
-
@bundle exec rspec --exclude-pattern "spec/integration/**/*_spec.rb" || [ $$? -eq 1 ]
|
|
47
|
-
@echo "✅ All unit tests passed"
|
|
23
|
+
prioritize: ## Prioritize the backlog and queue work
|
|
24
|
+
@claude --dangerously-skip-permissions $(PRIORITIZE_PROMPT)
|
|
48
25
|
|
|
49
|
-
|
|
50
|
-
@
|
|
51
|
-
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=false bundle exec rspec spec/integration/ --tag type:integration
|
|
52
|
-
@echo "✅ All integration tests passed"
|
|
26
|
+
iterate: ## Do the next right thing
|
|
27
|
+
@claude $(ITERATE_PROMPT)
|
|
53
28
|
|
|
54
|
-
|
|
55
|
-
@
|
|
56
|
-
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=true bundle exec rspec spec/integration/performance_benchmarks_spec.rb --tag type:integration
|
|
57
|
-
@echo "✅ Performance benchmarks completed"
|
|
29
|
+
qa: ## Find bugs and file GitHub issues
|
|
30
|
+
@claude $(QA_PROMPT)
|
|
58
31
|
|
|
59
|
-
test-all: test test-integration ## Run all tests (unit + integration)
|
|
60
32
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
@gem install language-operator-*.gem
|
|
64
|
-
@echo "✅ Gem installed successfully"
|
|
33
|
+
## Standard development tasks
|
|
34
|
+
# ---------------------------
|
|
65
35
|
|
|
66
36
|
console: ## Open an IRB console with the gem loaded
|
|
67
37
|
@bundle exec rake console
|
|
68
38
|
|
|
69
|
-
|
|
70
|
-
@
|
|
71
|
-
|
|
72
|
-
|
|
39
|
+
build: schema ## Build the gem
|
|
40
|
+
@gem build language-operator.gemspec
|
|
41
|
+
|
|
42
|
+
install: clean build ## Build and install the gem locally
|
|
43
|
+
@gem install language-operator-*.gem
|
|
73
44
|
|
|
74
45
|
lint: ## Run RuboCop linter
|
|
75
|
-
@echo "Running RuboCop..."
|
|
76
46
|
@bundle exec rubocop || [ $$? -eq 1 ]
|
|
77
|
-
@echo "✅ Linting complete"
|
|
78
47
|
|
|
79
|
-
lint-fix: ##
|
|
80
|
-
@echo "Auto-fixing RuboCop issues..."
|
|
48
|
+
lint-fix: ## Run Rubocop and auto-fix issues
|
|
81
49
|
@bundle exec rubocop --autocorrect-all
|
|
82
50
|
|
|
83
|
-
|
|
84
|
-
@
|
|
85
|
-
@rm -f language-operator-*.gem
|
|
86
|
-
@rm -rf doc/
|
|
87
|
-
@rm -rf .yardoc/
|
|
88
|
-
@echo "✅ Cleaned"
|
|
89
|
-
|
|
90
|
-
version-bump: ## Bump version (usage: make version-bump TYPE=patch|minor|major)
|
|
91
|
-
@if [ -z "$(TYPE)" ]; then \
|
|
92
|
-
echo "❌ Error: TYPE not specified"; \
|
|
93
|
-
echo "Usage: make version-bump TYPE=patch|minor|major"; \
|
|
94
|
-
exit 1; \
|
|
95
|
-
fi
|
|
96
|
-
@./bin/bump-version $(TYPE)
|
|
51
|
+
schema: ## Generate schema artifacts (JSON Schema and OpenAPI)
|
|
52
|
+
@bundle exec rake schema:generate
|
|
97
53
|
|
|
98
|
-
|
|
99
|
-
|
|
54
|
+
test: ## Run the unit test suite (use VERBOSE=1 to show all output)
|
|
55
|
+
@bundle exec rspec spec/language_operator/ --format progress
|
|
100
56
|
|
|
101
|
-
|
|
102
|
-
|
|
57
|
+
test-integration: ## Run integration tests for DSL v1 task execution
|
|
58
|
+
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=false bundle exec rspec spec/integration/ --tag type:integration
|
|
103
59
|
|
|
104
|
-
|
|
105
|
-
|
|
60
|
+
test-performance: ## Run performance benchmarks
|
|
61
|
+
@INTEGRATION_MOCK_LLM=true INTEGRATION_BENCHMARK=true bundle exec rspec spec/integration/performance_benchmarks_spec.rb --tag type:integration
|
|
106
62
|
|
|
107
|
-
|
|
108
|
-
ci-test: test test-integration lint ## Run CI test suite (unit tests + integration tests + linting)
|
|
63
|
+
test-all: test test-integration ## Run all tests (unit + integration)
|
|
109
64
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
@echo "Installing dependencies..."
|
|
113
|
-
@bundle install
|
|
114
|
-
@echo "✅ Development environment ready"
|
|
65
|
+
yard-docs: ## Generate YARD documentation
|
|
66
|
+
@bundle exec yard doc
|
|
115
67
|
|
|
116
|
-
|
|
117
|
-
@
|
|
68
|
+
clean: ## Clean build artifacts
|
|
69
|
+
@rm -f language-operator-*.gem
|
|
70
|
+
@rm -rf doc/
|
|
71
|
+
@rm -rf .yardoc/
|
data/components/agent/Gemfile
CHANGED
data/docs/cheat-sheet.md
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# aictl Cheat Sheet
|
|
2
|
+
|
|
3
|
+
Quick reference for the `aictl` command-line interface.
|
|
4
|
+
|
|
5
|
+
## General Commands
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
aictl --help # Show general help
|
|
9
|
+
aictl version # Display aictl and operator version information
|
|
10
|
+
aictl status # Show system status and cluster overview
|
|
11
|
+
aictl quickstart # Launch interactive setup wizard for first-time users
|
|
12
|
+
aictl completion bash # Install bash shell completions
|
|
13
|
+
aictl completion zsh # Install zsh shell completions
|
|
14
|
+
aictl completion fish # Install fish shell completions
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## Cluster Management
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
aictl cluster create <name> # Create a new language cluster
|
|
21
|
+
aictl cluster list # List all configured clusters
|
|
22
|
+
aictl cluster current # Show current active cluster
|
|
23
|
+
aictl cluster inspect <name> # Show detailed cluster information
|
|
24
|
+
aictl cluster delete <name> # Delete a cluster
|
|
25
|
+
aictl use <cluster> # Switch to a different cluster
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
## Agent Management
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
aictl agent create "<description>" # Create agent from natural language description
|
|
32
|
+
aictl agent create --wizard # Create agent using interactive wizard
|
|
33
|
+
aictl agent list # List all agents in current cluster
|
|
34
|
+
aictl agent inspect <name> # Show detailed agent information
|
|
35
|
+
aictl agent delete <name> # Delete an agent
|
|
36
|
+
aictl agent versions <name> # Show ConfigMap versions for agent learning history
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
## Agent Operations
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
aictl agent logs <name> # View agent execution logs
|
|
43
|
+
aictl agent logs <name> -f # Follow agent logs in real-time
|
|
44
|
+
aictl agent code <name> # Show synthesized agent code
|
|
45
|
+
aictl agent workspace <name> # Access agent's persistent workspace
|
|
46
|
+
aictl agent learning status <name> # Show agent learning optimization status
|
|
47
|
+
aictl agent learning enable <name> # Enable automatic learning for agent
|
|
48
|
+
aictl agent learning disable <name> # Disable automatic learning for agent
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Model Management
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
aictl model create <name> # Create model using interactive wizard
|
|
55
|
+
aictl model create <name> --provider openai --model gpt-4 # Create model with specific config
|
|
56
|
+
aictl model list # List all available models
|
|
57
|
+
aictl model inspect <name> # Show detailed model information
|
|
58
|
+
aictl model delete <name> # Delete a model
|
|
59
|
+
aictl model edit <name> # Edit model configuration in YAML
|
|
60
|
+
aictl model test <name> # Test model connectivity and basic functionality
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Tool Management
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
aictl tool install <name> # Install a tool from registry
|
|
67
|
+
aictl tool search <query> # Search available tools in registry
|
|
68
|
+
aictl tool list # List installed tools
|
|
69
|
+
aictl tool inspect <name> # Show detailed tool information and MCP capabilities
|
|
70
|
+
aictl tool delete <name> # Delete a tool
|
|
71
|
+
aictl tool test <name> # Test tool health and connectivity
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Persona Management
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
aictl persona create <name> # Create persona using interactive editor
|
|
78
|
+
aictl persona create <name> --from <existing> # Create persona based on existing one
|
|
79
|
+
aictl persona list # List all available personas
|
|
80
|
+
aictl persona show <name> # Display full persona details and system prompt
|
|
81
|
+
aictl persona edit <name> # Edit persona definition in YAML editor
|
|
82
|
+
aictl persona delete <name> # Delete a persona
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Installation & Deployment
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
aictl install # Install language-operator to cluster using Helm
|
|
89
|
+
aictl install --dry-run # Preview installation without applying changes
|
|
90
|
+
aictl upgrade # Upgrade existing operator installation
|
|
91
|
+
aictl uninstall # Remove operator from cluster
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## System Utilities
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
aictl system schema # Display current DSL JSON schema
|
|
98
|
+
aictl system validate-template <file> # Validate agent template file syntax
|
|
99
|
+
aictl system synthesize <template> # Synthesize agent code from template
|
|
100
|
+
aictl system synthesis-template <name> # Show synthesis template used for agent
|
|
101
|
+
aictl system exec <agent> -- <cmd> # Execute command inside agent pod
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Common Options
|
|
105
|
+
|
|
106
|
+
All commands support these common options:
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
--cluster <name> # Override current cluster context
|
|
110
|
+
--dry-run # Preview changes without applying
|
|
111
|
+
--force # Skip confirmation prompts
|
|
112
|
+
--help # Show command-specific help
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## Examples
|
|
116
|
+
|
|
117
|
+
### Quick Start
|
|
118
|
+
```bash
|
|
119
|
+
# First-time setup
|
|
120
|
+
aictl quickstart # Interactive setup wizard
|
|
121
|
+
aictl install # Install operator to cluster
|
|
122
|
+
aictl cluster create production # Create your first cluster
|
|
123
|
+
|
|
124
|
+
# Create and deploy an agent
|
|
125
|
+
aictl agent create "monitor my website and alert me if it goes down"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Daily Operations
|
|
129
|
+
```bash
|
|
130
|
+
# Check system status
|
|
131
|
+
aictl status # Overview of cluster and resources
|
|
132
|
+
aictl agent list # See all running agents
|
|
133
|
+
aictl agent logs my-agent -f # Monitor agent activity
|
|
134
|
+
|
|
135
|
+
# Manage resources
|
|
136
|
+
aictl model list # Available AI models
|
|
137
|
+
aictl tool install github # Add new capabilities
|
|
138
|
+
aictl persona create helper --from technical-writer # Customize agent personalities
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### Development & Debugging
|
|
142
|
+
```bash
|
|
143
|
+
# Inspect resources
|
|
144
|
+
aictl agent inspect my-agent # Detailed agent status and configuration
|
|
145
|
+
aictl agent code my-agent # View synthesized code
|
|
146
|
+
aictl agent workspace my-agent # Access persistent data
|
|
147
|
+
|
|
148
|
+
# Troubleshooting
|
|
149
|
+
aictl model test gpt-4 # Verify model connectivity
|
|
150
|
+
aictl tool test github # Check tool health
|
|
151
|
+
aictl system validate-template agent.yaml # Validate configuration files
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Multi-Cluster Management
|
|
155
|
+
```bash
|
|
156
|
+
# Working with multiple environments
|
|
157
|
+
aictl cluster create staging
|
|
158
|
+
aictl cluster create production
|
|
159
|
+
aictl use staging # Switch contexts
|
|
160
|
+
aictl agent list --all-clusters # View agents across all clusters
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
## Quick Tips
|
|
164
|
+
|
|
165
|
+
- Use `--dry-run` to preview changes before applying them
|
|
166
|
+
- Add `--help` to any command for detailed usage information
|
|
167
|
+
- Agent descriptions in quotes support natural language
|
|
168
|
+
- Use `--wizard` flag for interactive guidance on complex operations
|
|
169
|
+
- Commands auto-complete with shell completions installed
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
For complete documentation, see: [Language Operator Documentation](../README.md)
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
require_relative '../client'
|
|
4
4
|
require_relative '../constants'
|
|
5
|
+
require_relative '../kubernetes/client'
|
|
5
6
|
require_relative 'telemetry'
|
|
6
7
|
require_relative 'instrumentation'
|
|
7
8
|
|
|
@@ -21,7 +22,7 @@ module LanguageOperator
|
|
|
21
22
|
class Base < LanguageOperator::Client::Base
|
|
22
23
|
include Instrumentation
|
|
23
24
|
|
|
24
|
-
attr_reader :workspace_path, :mode
|
|
25
|
+
attr_reader :workspace_path, :mode, :kubernetes_client
|
|
25
26
|
|
|
26
27
|
# Initialize the agent
|
|
27
28
|
#
|
|
@@ -40,6 +41,14 @@ module LanguageOperator
|
|
|
40
41
|
@workspace_path = ENV.fetch('WORKSPACE_PATH', '/workspace')
|
|
41
42
|
@mode = agent_mode_with_default
|
|
42
43
|
@executor = nil
|
|
44
|
+
|
|
45
|
+
# Initialize Kubernetes client for event emission (only in K8s environments)
|
|
46
|
+
@kubernetes_client = begin
|
|
47
|
+
LanguageOperator::Kubernetes::Client.instance if ENV.fetch('KUBERNETES_SERVICE_HOST', nil)
|
|
48
|
+
rescue StandardError => e
|
|
49
|
+
logger.warn('Failed to initialize Kubernetes client', error: e.message)
|
|
50
|
+
nil
|
|
51
|
+
end
|
|
43
52
|
end
|
|
44
53
|
|
|
45
54
|
# Run the agent in its configured mode
|