language-operator 0.0.1 → 0.1.31

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 (120) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +125 -0
  3. data/CHANGELOG.md +88 -0
  4. data/Gemfile +8 -0
  5. data/Gemfile.lock +284 -0
  6. data/LICENSE +229 -21
  7. data/Makefile +82 -0
  8. data/README.md +3 -11
  9. data/Rakefile +63 -0
  10. data/bin/aictl +7 -0
  11. data/completions/_aictl +232 -0
  12. data/completions/aictl.bash +121 -0
  13. data/completions/aictl.fish +114 -0
  14. data/docs/architecture/agent-runtime.md +585 -0
  15. data/docs/dsl/SCHEMA_VERSION.md +250 -0
  16. data/docs/dsl/agent-reference.md +604 -0
  17. data/docs/dsl/best-practices.md +1078 -0
  18. data/docs/dsl/chat-endpoints.md +895 -0
  19. data/docs/dsl/constraints.md +671 -0
  20. data/docs/dsl/mcp-integration.md +1177 -0
  21. data/docs/dsl/webhooks.md +932 -0
  22. data/docs/dsl/workflows.md +744 -0
  23. data/lib/language_operator/agent/base.rb +110 -0
  24. data/lib/language_operator/agent/executor.rb +440 -0
  25. data/lib/language_operator/agent/instrumentation.rb +54 -0
  26. data/lib/language_operator/agent/metrics_tracker.rb +183 -0
  27. data/lib/language_operator/agent/safety/ast_validator.rb +272 -0
  28. data/lib/language_operator/agent/safety/audit_logger.rb +104 -0
  29. data/lib/language_operator/agent/safety/budget_tracker.rb +175 -0
  30. data/lib/language_operator/agent/safety/content_filter.rb +93 -0
  31. data/lib/language_operator/agent/safety/manager.rb +207 -0
  32. data/lib/language_operator/agent/safety/rate_limiter.rb +150 -0
  33. data/lib/language_operator/agent/safety/safe_executor.rb +127 -0
  34. data/lib/language_operator/agent/scheduler.rb +183 -0
  35. data/lib/language_operator/agent/telemetry.rb +116 -0
  36. data/lib/language_operator/agent/web_server.rb +610 -0
  37. data/lib/language_operator/agent/webhook_authenticator.rb +226 -0
  38. data/lib/language_operator/agent.rb +149 -0
  39. data/lib/language_operator/cli/commands/agent.rb +1205 -0
  40. data/lib/language_operator/cli/commands/cluster.rb +371 -0
  41. data/lib/language_operator/cli/commands/install.rb +404 -0
  42. data/lib/language_operator/cli/commands/model.rb +266 -0
  43. data/lib/language_operator/cli/commands/persona.rb +393 -0
  44. data/lib/language_operator/cli/commands/quickstart.rb +22 -0
  45. data/lib/language_operator/cli/commands/status.rb +143 -0
  46. data/lib/language_operator/cli/commands/system.rb +772 -0
  47. data/lib/language_operator/cli/commands/tool.rb +537 -0
  48. data/lib/language_operator/cli/commands/use.rb +47 -0
  49. data/lib/language_operator/cli/errors/handler.rb +180 -0
  50. data/lib/language_operator/cli/errors/suggestions.rb +176 -0
  51. data/lib/language_operator/cli/formatters/code_formatter.rb +77 -0
  52. data/lib/language_operator/cli/formatters/log_formatter.rb +288 -0
  53. data/lib/language_operator/cli/formatters/progress_formatter.rb +49 -0
  54. data/lib/language_operator/cli/formatters/status_formatter.rb +37 -0
  55. data/lib/language_operator/cli/formatters/table_formatter.rb +163 -0
  56. data/lib/language_operator/cli/formatters/value_formatter.rb +113 -0
  57. data/lib/language_operator/cli/helpers/cluster_context.rb +62 -0
  58. data/lib/language_operator/cli/helpers/cluster_validator.rb +101 -0
  59. data/lib/language_operator/cli/helpers/editor_helper.rb +58 -0
  60. data/lib/language_operator/cli/helpers/kubeconfig_validator.rb +167 -0
  61. data/lib/language_operator/cli/helpers/pastel_helper.rb +24 -0
  62. data/lib/language_operator/cli/helpers/resource_dependency_checker.rb +74 -0
  63. data/lib/language_operator/cli/helpers/schedule_builder.rb +108 -0
  64. data/lib/language_operator/cli/helpers/user_prompts.rb +69 -0
  65. data/lib/language_operator/cli/main.rb +236 -0
  66. data/lib/language_operator/cli/templates/tools/generic.yaml +66 -0
  67. data/lib/language_operator/cli/wizards/agent_wizard.rb +246 -0
  68. data/lib/language_operator/cli/wizards/quickstart_wizard.rb +588 -0
  69. data/lib/language_operator/client/base.rb +214 -0
  70. data/lib/language_operator/client/config.rb +136 -0
  71. data/lib/language_operator/client/cost_calculator.rb +37 -0
  72. data/lib/language_operator/client/mcp_connector.rb +123 -0
  73. data/lib/language_operator/client.rb +19 -0
  74. data/lib/language_operator/config/cluster_config.rb +101 -0
  75. data/lib/language_operator/config/tool_patterns.yaml +57 -0
  76. data/lib/language_operator/config/tool_registry.rb +96 -0
  77. data/lib/language_operator/config.rb +138 -0
  78. data/lib/language_operator/dsl/adapter.rb +124 -0
  79. data/lib/language_operator/dsl/agent_context.rb +90 -0
  80. data/lib/language_operator/dsl/agent_definition.rb +427 -0
  81. data/lib/language_operator/dsl/chat_endpoint_definition.rb +115 -0
  82. data/lib/language_operator/dsl/config.rb +119 -0
  83. data/lib/language_operator/dsl/context.rb +50 -0
  84. data/lib/language_operator/dsl/execution_context.rb +47 -0
  85. data/lib/language_operator/dsl/helpers.rb +109 -0
  86. data/lib/language_operator/dsl/http.rb +184 -0
  87. data/lib/language_operator/dsl/mcp_server_definition.rb +73 -0
  88. data/lib/language_operator/dsl/parameter_definition.rb +124 -0
  89. data/lib/language_operator/dsl/registry.rb +36 -0
  90. data/lib/language_operator/dsl/schema.rb +1102 -0
  91. data/lib/language_operator/dsl/shell.rb +125 -0
  92. data/lib/language_operator/dsl/tool_definition.rb +112 -0
  93. data/lib/language_operator/dsl/webhook_authentication.rb +114 -0
  94. data/lib/language_operator/dsl/webhook_definition.rb +106 -0
  95. data/lib/language_operator/dsl/workflow_definition.rb +259 -0
  96. data/lib/language_operator/dsl.rb +161 -0
  97. data/lib/language_operator/errors.rb +60 -0
  98. data/lib/language_operator/kubernetes/client.rb +279 -0
  99. data/lib/language_operator/kubernetes/resource_builder.rb +194 -0
  100. data/lib/language_operator/loggable.rb +47 -0
  101. data/lib/language_operator/logger.rb +141 -0
  102. data/lib/language_operator/retry.rb +123 -0
  103. data/lib/language_operator/retryable.rb +132 -0
  104. data/lib/language_operator/templates/README.md +23 -0
  105. data/lib/language_operator/templates/examples/agent_synthesis.tmpl +115 -0
  106. data/lib/language_operator/templates/examples/persona_distillation.tmpl +19 -0
  107. data/lib/language_operator/templates/schema/.gitkeep +0 -0
  108. data/lib/language_operator/templates/schema/CHANGELOG.md +93 -0
  109. data/lib/language_operator/templates/schema/agent_dsl_openapi.yaml +306 -0
  110. data/lib/language_operator/templates/schema/agent_dsl_schema.json +452 -0
  111. data/lib/language_operator/tool_loader.rb +242 -0
  112. data/lib/language_operator/validators.rb +170 -0
  113. data/lib/language_operator/version.rb +1 -1
  114. data/lib/language_operator.rb +65 -3
  115. data/requirements/tasks/challenge.md +9 -0
  116. data/requirements/tasks/iterate.md +36 -0
  117. data/requirements/tasks/optimize.md +21 -0
  118. data/requirements/tasks/tag.md +5 -0
  119. data/test_agent_dsl.rb +108 -0
  120. metadata +507 -20
@@ -0,0 +1,604 @@
1
+ # Agent DSL Reference
2
+
3
+ Complete reference guide for the Language Operator agent DSL.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Schema Version](#schema-version)
8
+ - [Agent Definition](#agent-definition)
9
+ - [Execution Modes](#execution-modes)
10
+ - [Schedule Configuration](#schedule-configuration)
11
+ - [Objectives](#objectives)
12
+ - [Persona](#persona)
13
+ - [Workflows](#workflows)
14
+ - [Constraints](#constraints)
15
+ - [Output Configuration](#output-configuration)
16
+ - [Complete Examples](#complete-examples)
17
+
18
+ ## Schema Version
19
+
20
+ The Language Operator DSL schema is versioned using semantic versioning. The schema version is identical to the gem version.
21
+
22
+ **Access schema version:**
23
+
24
+ ```ruby
25
+ LanguageOperator::Dsl::Schema.version # => "0.1.30"
26
+ ```
27
+
28
+ For detailed information about schema versioning policy, version semantics, and compatibility, see [Schema Versioning Policy](./SCHEMA_VERSION.md).
29
+
30
+ ## Agent Definition
31
+
32
+ The basic structure of an agent definition:
33
+
34
+ ```ruby
35
+ agent "agent-name" do
36
+ description "What this agent does"
37
+
38
+ mode :autonomous # or :scheduled, :reactive
39
+
40
+ # Additional configuration...
41
+ end
42
+ ```
43
+
44
+ ### Required Fields
45
+
46
+ - **name** (String): Unique identifier for the agent (passed as argument to `agent`)
47
+ - **description** (String): Human-readable description of the agent's purpose
48
+
49
+ ### Optional Fields
50
+
51
+ - **mode** (Symbol): Execution mode (`:autonomous`, `:scheduled`, `:reactive`) - defaults to `:autonomous`
52
+ - **persona** (String): System prompt defining the agent's behavior and expertise
53
+ - **schedule** (String): Cron expression for scheduled execution (only used when `mode: :scheduled`)
54
+ - **objectives** (Array): List of goals the agent should accomplish
55
+ - **workflow** (Block): Step-by-step workflow definition
56
+ - **constraints** (Block): Resource and behavior limits
57
+ - **output** (Block): Output formatting and delivery configuration
58
+
59
+ ## Execution Modes
60
+
61
+ Agents support three execution modes:
62
+
63
+ ### Autonomous Mode
64
+
65
+ Continuous execution with objectives-based behavior.
66
+
67
+ ```ruby
68
+ agent "autonomous-researcher" do
69
+ description "Continuously researches and reports on tech trends"
70
+
71
+ mode :autonomous
72
+
73
+ objectives [
74
+ "Monitor technology news sources",
75
+ "Identify emerging trends",
76
+ "Generate weekly summaries"
77
+ ]
78
+
79
+ # Agent runs continuously, guided by objectives
80
+ end
81
+ ```
82
+
83
+ **Use cases:**
84
+ - Monitoring and alerting
85
+ - Continuous data processing
86
+ - Real-time analysis
87
+
88
+ ### Scheduled Mode
89
+
90
+ Executes on a defined schedule using cron expressions.
91
+
92
+ ```ruby
93
+ agent "daily-reporter" do
94
+ description "Generate daily reports"
95
+
96
+ mode :scheduled
97
+ schedule "0 9 * * *" # 9 AM every day
98
+
99
+ workflow do
100
+ # Define workflow steps
101
+ end
102
+ end
103
+ ```
104
+
105
+ **Cron Expression Format:**
106
+ ```
107
+ ┌───────────── minute (0 - 59)
108
+ │ ┌───────────── hour (0 - 23)
109
+ │ │ ┌───────────── day of month (1 - 31)
110
+ │ │ │ ┌───────────── month (1 - 12)
111
+ │ │ │ │ ┌───────────── day of week (0 - 6) (Sunday to Saturday)
112
+ │ │ │ │ │
113
+ * * * * *
114
+ ```
115
+
116
+ **Common Examples:**
117
+ - `"0 9 * * *"` - Daily at 9 AM
118
+ - `"0 */4 * * *"` - Every 4 hours
119
+ - `"0 9 * * 1"` - Every Monday at 9 AM
120
+ - `"0 0 1 * *"` - First day of every month at midnight
121
+ - `"*/15 * * * *"` - Every 15 minutes
122
+
123
+ **Use cases:**
124
+ - Daily/weekly reporting
125
+ - Scheduled maintenance tasks
126
+ - Periodic data synchronization
127
+
128
+ ### Reactive Mode
129
+
130
+ Responds to external events (webhooks, triggers).
131
+
132
+ ```ruby
133
+ agent "github-pr-reviewer" do
134
+ description "Reviews pull requests when opened"
135
+
136
+ mode :reactive
137
+
138
+ # Webhook configuration required (see webhooks.md)
139
+ webhook "/github/pr-opened" do
140
+ method :post
141
+ # Authentication and handling...
142
+ end
143
+
144
+ on_webhook_event do |event|
145
+ # Process the webhook event
146
+ end
147
+ end
148
+ ```
149
+
150
+ **Use cases:**
151
+ - Webhook handlers (GitHub, Stripe, etc.)
152
+ - Event-driven workflows
153
+ - Integration with external systems
154
+
155
+ ## Schedule Configuration
156
+
157
+ For scheduled agents, you can configure execution timing.
158
+
159
+ ### Cron Expressions
160
+
161
+ ```ruby
162
+ agent "scheduled-agent" do
163
+ mode :scheduled
164
+ schedule "0 */2 * * *" # Every 2 hours
165
+ end
166
+ ```
167
+
168
+ ### Natural Language Helpers
169
+
170
+ While the DSL accepts cron expressions directly, the CLI includes helpers for natural language time parsing:
171
+
172
+ ```bash
173
+ # CLI supports natural language (converts to cron internally)
174
+ aictl agent wizard
175
+ # Prompts: "What time should this run?"
176
+ # Input: "4pm daily"
177
+ # Converts to: "0 16 * * *"
178
+ ```
179
+
180
+ ### Future: Event-Based Triggers
181
+
182
+ Event-based scheduling is planned but not yet implemented:
183
+
184
+ ```ruby
185
+ # FUTURE FEATURE - Not yet available
186
+ agent "event-driven" do
187
+ mode :scheduled
188
+
189
+ trigger :on_event do
190
+ source "kubernetes"
191
+ event_type "pod.failed"
192
+ end
193
+ end
194
+ ```
195
+
196
+ ## Objectives
197
+
198
+ Objectives guide the agent's behavior, especially in autonomous mode.
199
+
200
+ ### Single Objective
201
+
202
+ ```ruby
203
+ agent "simple-agent" do
204
+ objective "Monitor system health and alert on issues"
205
+ end
206
+ ```
207
+
208
+ ### Multiple Objectives
209
+
210
+ ```ruby
211
+ agent "multi-objective-agent" do
212
+ objectives [
213
+ "Collect daily metrics from all services",
214
+ "Analyze metrics for anomalies",
215
+ "Generate summary reports",
216
+ "Alert on critical issues"
217
+ ]
218
+ end
219
+ ```
220
+
221
+ ### Best Practices
222
+
223
+ **Good Objectives:**
224
+ - Specific and actionable
225
+ - Measurable outcomes
226
+ - Clear success criteria
227
+
228
+ ```ruby
229
+ objectives [
230
+ "Fetch sales data from Salesforce API every hour",
231
+ "Calculate conversion rates by product category",
232
+ "Email report to team@company.com if conversion drops below 5%"
233
+ ]
234
+ ```
235
+
236
+ **Poor Objectives:**
237
+ - Too vague
238
+ - Unmeasurable
239
+ - No clear completion criteria
240
+
241
+ ```ruby
242
+ # Avoid this:
243
+ objectives [
244
+ "Be helpful",
245
+ "Do good work",
246
+ "Monitor things"
247
+ ]
248
+ ```
249
+
250
+ ## Persona
251
+
252
+ The persona defines the agent's system prompt, expertise, and behavioral characteristics.
253
+
254
+ ### Basic Persona
255
+
256
+ ```ruby
257
+ agent "support-agent" do
258
+ persona "You are a helpful customer support agent specializing in technical troubleshooting"
259
+ end
260
+ ```
261
+
262
+ ### Detailed Persona
263
+
264
+ ```ruby
265
+ agent "kubernetes-expert" do
266
+ persona <<~PERSONA
267
+ You are a Kubernetes expert with deep knowledge of:
268
+ - Cluster administration and troubleshooting
269
+ - Workload optimization and best practices
270
+ - Security and RBAC configuration
271
+ - Monitoring and observability
272
+
273
+ When helping users:
274
+ - Provide clear, step-by-step guidance
275
+ - Include relevant kubectl commands
276
+ - Explain the reasoning behind recommendations
277
+ - Always consider security implications
278
+
279
+ Your responses should be concise but complete.
280
+ PERSONA
281
+ end
282
+ ```
283
+
284
+ ### Persona with Role and Constraints
285
+
286
+ ```ruby
287
+ agent "financial-analyst" do
288
+ persona <<~PERSONA
289
+ You are a financial analyst specializing in quarterly earnings analysis.
290
+
291
+ Your expertise includes:
292
+ - Reading and interpreting 10-Q and 10-K filings
293
+ - Calculating key financial ratios
294
+ - Identifying trends and anomalies
295
+
296
+ Guidelines:
297
+ - Base all analysis on factual data from SEC filings
298
+ - Clearly distinguish between facts and interpretations
299
+ - Use industry-standard financial terminology
300
+ - Never provide investment advice
301
+ PERSONA
302
+ end
303
+ ```
304
+
305
+ ### Best Practices
306
+
307
+ - **Be specific** about the agent's expertise domain
308
+ - **Include behavioral guidelines** for how the agent should respond
309
+ - **Set boundaries** on what the agent should/shouldn't do
310
+ - **Define tone and style** appropriate for the use case
311
+
312
+ ## Workflows
313
+
314
+ See [workflows.md](workflows.md) for complete workflow documentation.
315
+
316
+ Quick example:
317
+
318
+ ```ruby
319
+ agent "data-processor" do
320
+ workflow do
321
+ step :fetch_data do
322
+ tool 'database_query'
323
+ params query: 'SELECT * FROM metrics WHERE date = CURRENT_DATE'
324
+ end
325
+
326
+ step :analyze do
327
+ depends_on :fetch_data
328
+ prompt "Analyze this data: {fetch_data.output}"
329
+ end
330
+
331
+ step :report do
332
+ depends_on :analyze
333
+ tool 'send_email'
334
+ params(
335
+ to: 'team@company.com',
336
+ subject: 'Daily Analysis',
337
+ body: '{analyze.output}'
338
+ )
339
+ end
340
+ end
341
+ end
342
+ ```
343
+
344
+ ## Constraints
345
+
346
+ See [constraints.md](constraints.md) for complete constraints documentation.
347
+
348
+ Quick example:
349
+
350
+ ```ruby
351
+ agent "resource-limited-agent" do
352
+ constraints do
353
+ timeout '30m'
354
+ max_iterations 50
355
+
356
+ daily_budget 1000 # Max daily cost in cents
357
+ requests_per_minute 10
358
+
359
+ blocked_topics ['violence', 'illegal-content']
360
+ end
361
+ end
362
+ ```
363
+
364
+ ## Output Configuration
365
+
366
+ Configure how the agent formats and delivers output.
367
+
368
+ ### Format
369
+
370
+ ```ruby
371
+ agent "reporting-agent" do
372
+ output do
373
+ format :json # or :text, :markdown, :html
374
+ end
375
+ end
376
+ ```
377
+
378
+ ### Delivery
379
+
380
+ ```ruby
381
+ agent "alert-agent" do
382
+ output do
383
+ deliver_to 'team@company.com'
384
+ format :markdown
385
+ end
386
+ end
387
+ ```
388
+
389
+ ## Complete Examples
390
+
391
+ ### Scheduled Report Generator
392
+
393
+ ```ruby
394
+ agent "weekly-sales-report" do
395
+ description "Generate weekly sales analysis reports"
396
+
397
+ mode :scheduled
398
+ schedule "0 9 * * 1" # Every Monday at 9 AM
399
+
400
+ persona <<~PERSONA
401
+ You are a sales analyst who creates clear, actionable reports.
402
+ Focus on trends, anomalies, and actionable insights.
403
+ PERSONA
404
+
405
+ objectives [
406
+ "Fetch sales data for the past week",
407
+ "Calculate key metrics (revenue, conversion, avg order value)",
408
+ "Identify top performing products and regions",
409
+ "Highlight any concerning trends",
410
+ "Generate executive summary"
411
+ ]
412
+
413
+ workflow do
414
+ step :fetch_sales_data do
415
+ tool 'database_query'
416
+ params(
417
+ query: "SELECT * FROM sales WHERE date >= CURRENT_DATE - INTERVAL '7 days'"
418
+ )
419
+ end
420
+
421
+ step :analyze_trends do
422
+ depends_on :fetch_sales_data
423
+ prompt "Analyze these sales figures and identify key trends: {fetch_sales_data.output}"
424
+ end
425
+
426
+ step :send_report do
427
+ depends_on :analyze_trends
428
+ tool 'send_email'
429
+ params(
430
+ to: 'executives@company.com',
431
+ subject: 'Weekly Sales Report',
432
+ body: '{analyze_trends.output}'
433
+ )
434
+ end
435
+ end
436
+
437
+ constraints do
438
+ timeout '15m'
439
+ max_iterations 10
440
+ daily_budget 500 # 500 cents = $5
441
+ end
442
+
443
+ output do
444
+ format :markdown
445
+ end
446
+ end
447
+ ```
448
+
449
+ ### Autonomous Monitoring Agent
450
+
451
+ ```ruby
452
+ agent "system-health-monitor" do
453
+ description "Continuously monitors system health and alerts on issues"
454
+
455
+ mode :autonomous
456
+
457
+ persona <<~PERSONA
458
+ You are a site reliability engineer monitoring production systems.
459
+ You are proactive, detail-oriented, and know when to escalate issues.
460
+ PERSONA
461
+
462
+ objectives [
463
+ "Check system metrics every 5 minutes",
464
+ "Identify anomalies (CPU >80%, memory >90%, disk >85%)",
465
+ "Check application error rates",
466
+ "Alert team immediately if critical issues detected",
467
+ "Generate hourly summary reports"
468
+ ]
469
+
470
+ constraints do
471
+ requests_per_minute 12 # Every 5 minutes = 12/hour
472
+ daily_budget 2000 # $20/day
473
+
474
+ blocked_patterns [] # No content filtering needed
475
+ end
476
+ end
477
+ ```
478
+
479
+ ### Reactive Webhook Handler
480
+
481
+ ```ruby
482
+ agent "github-pr-reviewer" do
483
+ description "Automatically reviews pull requests"
484
+
485
+ mode :reactive
486
+
487
+ persona <<~PERSONA
488
+ You are a senior software engineer conducting code reviews.
489
+ Focus on: correctness, security, performance, and maintainability.
490
+ Be constructive and specific in feedback.
491
+ PERSONA
492
+
493
+ webhook "/github/pull-request" do
494
+ method :post
495
+
496
+ authenticate do
497
+ verify_signature(
498
+ header: 'X-Hub-Signature-256',
499
+ secret: ENV['GITHUB_WEBHOOK_SECRET'],
500
+ algorithm: :sha256
501
+ )
502
+ end
503
+ end
504
+
505
+ on_webhook_event do |event|
506
+ # Extract PR details from event
507
+ pr_number = event.dig('pull_request', 'number')
508
+ pr_diff = event.dig('pull_request', 'diff_url')
509
+
510
+ # Review workflow executes when webhook received
511
+ end
512
+
513
+ workflow do
514
+ step :fetch_diff do
515
+ tool 'http_get'
516
+ params url: '{event.pull_request.diff_url}'
517
+ end
518
+
519
+ step :review_code do
520
+ depends_on :fetch_diff
521
+ prompt "Review this code change and provide feedback: {fetch_diff.output}"
522
+ end
523
+
524
+ step :post_comment do
525
+ depends_on :review_code
526
+ tool 'github_api'
527
+ params(
528
+ action: 'create_comment',
529
+ issue_number: '{event.pull_request.number}',
530
+ body: '{review_code.output}'
531
+ )
532
+ end
533
+ end
534
+
535
+ constraints do
536
+ timeout '10m'
537
+ requests_per_hour 100 # Rate limit webhook processing
538
+ end
539
+ end
540
+ ```
541
+
542
+ ## Environment Variables
543
+
544
+ Agents access configuration through environment variables injected by the operator:
545
+
546
+ ### LLM Configuration
547
+
548
+ - `LLM_PROVIDER` - Provider name (default: `'anthropic'`)
549
+ - `LLM_MODEL` - Model name (default: `'claude-3-5-sonnet-20241022'`)
550
+ - `ANTHROPIC_API_KEY` - API key for Anthropic
551
+ - `OPENAI_API_KEY` - API key for OpenAI (if using OpenAI provider)
552
+
553
+ ### Runtime Configuration
554
+
555
+ - `AGENT_NAME` - Name of this agent instance
556
+ - `AGENT_CODE_PATH` - Path to synthesized agent code (usually `/config/agent.rb`)
557
+ - `AGENT_MODE` - Execution mode (`autonomous`, `scheduled`, `reactive`)
558
+ - `CONFIG_PATH` - Path to YAML configuration file
559
+ - `WORKSPACE_PATH` - Path to persistent workspace directory
560
+
561
+ ### Tool/MCP Configuration
562
+
563
+ - `MODEL_ENDPOINTS` - Comma-separated list of LLM endpoint URLs
564
+ - `MCP_SERVERS` - Comma-separated list of MCP tool server endpoints
565
+ - `TOOL_ENDPOINTS` - (Alternative name for MCP_SERVERS)
566
+
567
+ ### Example Pod Environment
568
+
569
+ ```yaml
570
+ env:
571
+ - name: AGENT_NAME
572
+ value: "weekly-sales-report"
573
+ - name: AGENT_CODE_PATH
574
+ value: "/config/agent.rb"
575
+ - name: AGENT_MODE
576
+ value: "scheduled"
577
+ - name: LLM_PROVIDER
578
+ value: "anthropic"
579
+ - name: LLM_MODEL
580
+ value: "claude-3-5-sonnet-20241022"
581
+ - name: ANTHROPIC_API_KEY
582
+ valueFrom:
583
+ secretKeyRef:
584
+ name: llm-credentials
585
+ key: anthropic-api-key
586
+ - name: WORKSPACE_PATH
587
+ value: "/workspace"
588
+ ```
589
+
590
+ ## Next Steps
591
+
592
+ - Learn about [Workflows](workflows.md) for step-by-step task execution
593
+ - Understand [Constraints](constraints.md) for resource and behavior limits
594
+ - Explore [Webhooks](webhooks.md) for reactive agents
595
+ - Review [Best Practices](best-practices.md) for production deployments
596
+
597
+ ## See Also
598
+
599
+ - [Workflow Guide](workflows.md)
600
+ - [Constraints Reference](constraints.md)
601
+ - [Webhook Guide](webhooks.md)
602
+ - [MCP Integration](mcp-integration.md)
603
+ - [Chat Endpoints](chat-endpoints.md)
604
+ - [Best Practices](best-practices.md)