jarviscore-framework 0.1.0__py3-none-any.whl
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.
- examples/calculator_agent_example.py +77 -0
- examples/multi_agent_workflow.py +132 -0
- examples/research_agent_example.py +76 -0
- jarviscore/__init__.py +54 -0
- jarviscore/cli/__init__.py +7 -0
- jarviscore/cli/__main__.py +33 -0
- jarviscore/cli/check.py +404 -0
- jarviscore/cli/smoketest.py +371 -0
- jarviscore/config/__init__.py +7 -0
- jarviscore/config/settings.py +128 -0
- jarviscore/core/__init__.py +7 -0
- jarviscore/core/agent.py +163 -0
- jarviscore/core/mesh.py +463 -0
- jarviscore/core/profile.py +64 -0
- jarviscore/docs/API_REFERENCE.md +932 -0
- jarviscore/docs/CONFIGURATION.md +753 -0
- jarviscore/docs/GETTING_STARTED.md +600 -0
- jarviscore/docs/TROUBLESHOOTING.md +424 -0
- jarviscore/docs/USER_GUIDE.md +983 -0
- jarviscore/execution/__init__.py +94 -0
- jarviscore/execution/code_registry.py +298 -0
- jarviscore/execution/generator.py +268 -0
- jarviscore/execution/llm.py +430 -0
- jarviscore/execution/repair.py +283 -0
- jarviscore/execution/result_handler.py +332 -0
- jarviscore/execution/sandbox.py +555 -0
- jarviscore/execution/search.py +281 -0
- jarviscore/orchestration/__init__.py +18 -0
- jarviscore/orchestration/claimer.py +101 -0
- jarviscore/orchestration/dependency.py +143 -0
- jarviscore/orchestration/engine.py +292 -0
- jarviscore/orchestration/status.py +96 -0
- jarviscore/p2p/__init__.py +23 -0
- jarviscore/p2p/broadcaster.py +353 -0
- jarviscore/p2p/coordinator.py +364 -0
- jarviscore/p2p/keepalive.py +361 -0
- jarviscore/p2p/swim_manager.py +290 -0
- jarviscore/profiles/__init__.py +6 -0
- jarviscore/profiles/autoagent.py +264 -0
- jarviscore/profiles/customagent.py +137 -0
- jarviscore_framework-0.1.0.dist-info/METADATA +136 -0
- jarviscore_framework-0.1.0.dist-info/RECORD +55 -0
- jarviscore_framework-0.1.0.dist-info/WHEEL +5 -0
- jarviscore_framework-0.1.0.dist-info/licenses/LICENSE +21 -0
- jarviscore_framework-0.1.0.dist-info/top_level.txt +3 -0
- tests/conftest.py +44 -0
- tests/test_agent.py +165 -0
- tests/test_autoagent.py +140 -0
- tests/test_autoagent_day4.py +186 -0
- tests/test_customagent.py +248 -0
- tests/test_integration.py +293 -0
- tests/test_llm_fallback.py +185 -0
- tests/test_mesh.py +356 -0
- tests/test_p2p_integration.py +375 -0
- tests/test_remote_sandbox.py +116 -0
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
# JarvisCore Configuration Guide
|
|
2
|
+
|
|
3
|
+
Complete guide to configuring JarvisCore framework.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Table of Contents
|
|
8
|
+
|
|
9
|
+
1. [Quick Start](#quick-start)
|
|
10
|
+
2. [Environment Variables](#environment-variables)
|
|
11
|
+
3. [LLM Configuration](#llm-configuration)
|
|
12
|
+
4. [Sandbox Configuration](#sandbox-configuration)
|
|
13
|
+
5. [Storage Configuration](#storage-configuration)
|
|
14
|
+
6. [P2P Configuration](#p2p-configuration)
|
|
15
|
+
7. [Execution Settings](#execution-settings)
|
|
16
|
+
8. [Logging Configuration](#logging-configuration)
|
|
17
|
+
9. [Configuration Examples](#configuration-examples)
|
|
18
|
+
10. [Troubleshooting](#troubleshooting)
|
|
19
|
+
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
JarvisCore uses environment variables for configuration with sensible defaults.
|
|
25
|
+
|
|
26
|
+
### Zero-Config Mode
|
|
27
|
+
|
|
28
|
+
No configuration required! Just install and run:
|
|
29
|
+
|
|
30
|
+
```python
|
|
31
|
+
from jarviscore import Mesh
|
|
32
|
+
from jarviscore.profiles import AutoAgent
|
|
33
|
+
|
|
34
|
+
mesh = Mesh()
|
|
35
|
+
# Uses default settings, tries to detect LLM providers
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Basic Configuration
|
|
39
|
+
|
|
40
|
+
Create a `.env` file in your project root:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Minimal configuration
|
|
44
|
+
CLAUDE_API_KEY=your-anthropic-api-key
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
That's it! The framework handles the rest.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Environment Variables
|
|
52
|
+
|
|
53
|
+
### Configuration File
|
|
54
|
+
|
|
55
|
+
Create `.env` file:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
cp .env.example .env
|
|
59
|
+
# Edit .env with your values
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Standard Names (No Prefix)
|
|
63
|
+
|
|
64
|
+
JarvisCore uses standard environment variable names without prefixes:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
# Good
|
|
68
|
+
CLAUDE_API_KEY=...
|
|
69
|
+
AZURE_API_KEY=...
|
|
70
|
+
|
|
71
|
+
# Not used (old format)
|
|
72
|
+
JARVISCORE_CLAUDE_API_KEY=...
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## LLM Configuration
|
|
78
|
+
|
|
79
|
+
Configure language model providers. The framework tries them in order:
|
|
80
|
+
**Claude → vLLM → Azure → Gemini**
|
|
81
|
+
|
|
82
|
+
### Anthropic Claude (Recommended)
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# Standard Anthropic API
|
|
86
|
+
CLAUDE_API_KEY=sk-ant-...
|
|
87
|
+
|
|
88
|
+
# Optional: Custom endpoint (Azure Claude, etc.)
|
|
89
|
+
CLAUDE_ENDPOINT=https://api.anthropic.com
|
|
90
|
+
|
|
91
|
+
# Optional: Model selection
|
|
92
|
+
CLAUDE_MODEL=claude-model # or claude-opus-4, claude-haiku-3.5
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
**Get API Key:** https://console.anthropic.com/
|
|
96
|
+
|
|
97
|
+
### vLLM (Self-Hosted)
|
|
98
|
+
|
|
99
|
+
Recommended for cost-effective production:
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
# vLLM server endpoint
|
|
103
|
+
LLM_ENDPOINT=http://localhost:8000
|
|
104
|
+
|
|
105
|
+
# Model name
|
|
106
|
+
LLM_MODEL=LLM-model
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
**Setup vLLM:**
|
|
110
|
+
```bash
|
|
111
|
+
# Install vLLM
|
|
112
|
+
pip install vllm
|
|
113
|
+
|
|
114
|
+
# Start server
|
|
115
|
+
python -m vllm.entrypoints.openai.api_server \
|
|
116
|
+
--model Qwen/Qwen2.5-Coder-32B-Instruct \
|
|
117
|
+
--port 8000
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Azure OpenAI
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
AZURE_API_KEY=your-azure-key
|
|
124
|
+
AZURE_ENDPOINT=https://your-resource.openai.azure.com
|
|
125
|
+
AZURE_DEPLOYMENT=gpt-4o
|
|
126
|
+
AZURE_API_VERSION=2025-01-01-preview
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
**Get Started:**
|
|
130
|
+
|
|
131
|
+
### Google Gemini
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
GEMINI_API_KEY=your-gemini-api-key
|
|
135
|
+
GEMINI_MODEL=gemini-2.0-flash
|
|
136
|
+
GEMINI_TEMPERATURE=0.1
|
|
137
|
+
GEMINI_TIMEOUT=30.0
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Get API Key:** https://ai.google.dev/
|
|
141
|
+
|
|
142
|
+
### Common LLM Settings
|
|
143
|
+
|
|
144
|
+
```bash
|
|
145
|
+
# Request timeout (seconds)
|
|
146
|
+
LLM_TIMEOUT=120.0
|
|
147
|
+
|
|
148
|
+
# Sampling temperature (0.0 - 1.0)
|
|
149
|
+
LLM_TEMPERATURE=0.7
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
### Provider Selection
|
|
153
|
+
|
|
154
|
+
The framework automatically selects providers:
|
|
155
|
+
|
|
156
|
+
1. **Tries Claude first** (if CLAUDE_API_KEY set)
|
|
157
|
+
2. **Falls back to vLLM** (if LLM_ENDPOINT set)
|
|
158
|
+
3. **Falls back to Azure** (if AZURE_API_KEY set)
|
|
159
|
+
4. **Falls back to Gemini** (if GEMINI_API_KEY set)
|
|
160
|
+
|
|
161
|
+
You only need to configure ONE provider.
|
|
162
|
+
|
|
163
|
+
---
|
|
164
|
+
|
|
165
|
+
## Sandbox Configuration
|
|
166
|
+
|
|
167
|
+
Configure code execution environment.
|
|
168
|
+
|
|
169
|
+
### Local Mode (Default)
|
|
170
|
+
|
|
171
|
+
In-process execution, fast, for development:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
SANDBOX_MODE=local
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
No additional configuration needed.
|
|
178
|
+
|
|
179
|
+
### Remote Mode (Production)
|
|
180
|
+
|
|
181
|
+
Azure Container Apps sandbox service:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
SANDBOX_MODE=remote
|
|
185
|
+
SANDBOX_SERVICE_URL=https://browser-task-executor.bravesea-3f5f7e75.eastus.azurecontainerapps.io
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Features:**
|
|
189
|
+
- Full process isolation
|
|
190
|
+
- Better security
|
|
191
|
+
- Hosted by JarvisCore (no setup required)
|
|
192
|
+
- Automatic fallback to local
|
|
193
|
+
|
|
194
|
+
**When to use:**
|
|
195
|
+
- Production deployments
|
|
196
|
+
- Untrusted code execution
|
|
197
|
+
- Multi-tenant systems
|
|
198
|
+
- High security requirements
|
|
199
|
+
|
|
200
|
+
### Sandbox Timeout
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
# Maximum execution time (seconds)
|
|
204
|
+
EXECUTION_TIMEOUT=300 # 5 minutes (default)
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
---
|
|
208
|
+
|
|
209
|
+
## Storage Configuration
|
|
210
|
+
|
|
211
|
+
Configure result storage and code registry.
|
|
212
|
+
|
|
213
|
+
### Storage Directory
|
|
214
|
+
|
|
215
|
+
```bash
|
|
216
|
+
# Base directory for logs and results
|
|
217
|
+
LOG_DIRECTORY=./logs
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
### Storage Structure
|
|
221
|
+
|
|
222
|
+
```
|
|
223
|
+
logs/
|
|
224
|
+
├── {agent_id}/ # Agent results
|
|
225
|
+
│ └── {result_id}.json
|
|
226
|
+
└── code_registry/ # Registered functions
|
|
227
|
+
├── index.json
|
|
228
|
+
└── functions/
|
|
229
|
+
└── {function_id}.py
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
### Result Storage
|
|
233
|
+
|
|
234
|
+
Results are automatically stored:
|
|
235
|
+
- **File storage**: Persistent JSON files
|
|
236
|
+
- **In-memory cache**: LRU cache (1000 results)
|
|
237
|
+
- **Zero dependencies**: No Redis, no database
|
|
238
|
+
|
|
239
|
+
### Code Registry
|
|
240
|
+
|
|
241
|
+
Generated code is automatically registered:
|
|
242
|
+
- **Searchable**: Find functions by keywords/capabilities
|
|
243
|
+
- **Reusable**: Share code between agents
|
|
244
|
+
- **Auditable**: Track all generated code
|
|
245
|
+
|
|
246
|
+
---
|
|
247
|
+
|
|
248
|
+
## P2P Configuration
|
|
249
|
+
|
|
250
|
+
Configure distributed mesh networking (optional).
|
|
251
|
+
|
|
252
|
+
### Enable P2P
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
# Enable P2P mesh
|
|
256
|
+
P2P_ENABLED=true
|
|
257
|
+
|
|
258
|
+
# Node identification
|
|
259
|
+
NODE_NAME=jarviscore-node-1
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Network Settings
|
|
263
|
+
|
|
264
|
+
```bash
|
|
265
|
+
# Bind address and port
|
|
266
|
+
BIND_HOST=0.0.0.0 # Listen on all interfaces
|
|
267
|
+
BIND_PORT=7946 # SWIM protocol port
|
|
268
|
+
|
|
269
|
+
# Seed nodes (comma-separated)
|
|
270
|
+
SEED_NODES=192.168.1.100:7946,192.168.1.101:7946
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### Transport Configuration
|
|
274
|
+
|
|
275
|
+
```bash
|
|
276
|
+
# ZeroMQ port offset
|
|
277
|
+
ZMQ_PORT_OFFSET=1000 # ZMQ will use BIND_PORT + 1000
|
|
278
|
+
|
|
279
|
+
# Transport type
|
|
280
|
+
TRANSPORT_TYPE=hybrid # udp, tcp, or hybrid
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
### Keepalive Settings
|
|
284
|
+
|
|
285
|
+
```bash
|
|
286
|
+
# Enable smart keepalive
|
|
287
|
+
KEEPALIVE_ENABLED=true
|
|
288
|
+
|
|
289
|
+
# Keepalive interval (seconds)
|
|
290
|
+
KEEPALIVE_INTERVAL=90
|
|
291
|
+
|
|
292
|
+
# Keepalive timeout (seconds)
|
|
293
|
+
KEEPALIVE_TIMEOUT=10
|
|
294
|
+
|
|
295
|
+
# Activity suppression window (seconds)
|
|
296
|
+
ACTIVITY_SUPPRESS_WINDOW=60
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
### When to Use P2P
|
|
300
|
+
|
|
301
|
+
**Use P2P (distributed mode) when:**
|
|
302
|
+
- Running agents across multiple machines
|
|
303
|
+
- Need high availability
|
|
304
|
+
- Load balancing required
|
|
305
|
+
- Geographic distribution
|
|
306
|
+
|
|
307
|
+
**Don't use P2P (autonomous mode) when:**
|
|
308
|
+
- Single machine deployment
|
|
309
|
+
- Development/testing
|
|
310
|
+
- Simple workflows
|
|
311
|
+
- Getting started
|
|
312
|
+
|
|
313
|
+
---
|
|
314
|
+
|
|
315
|
+
## Execution Settings
|
|
316
|
+
|
|
317
|
+
### Repair Attempts
|
|
318
|
+
|
|
319
|
+
```bash
|
|
320
|
+
# Maximum autonomous repair attempts
|
|
321
|
+
MAX_REPAIR_ATTEMPTS=3 # Default
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
When code execution fails, AutoAgent attempts to fix it automatically.
|
|
325
|
+
|
|
326
|
+
### Retry Settings
|
|
327
|
+
|
|
328
|
+
```bash
|
|
329
|
+
# Maximum retries for failed operations
|
|
330
|
+
MAX_RETRIES=3 # Default
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
Applies to LLM calls, HTTP requests, etc.
|
|
334
|
+
|
|
335
|
+
### Timeout Configuration
|
|
336
|
+
|
|
337
|
+
```bash
|
|
338
|
+
# Code execution timeout
|
|
339
|
+
EXECUTION_TIMEOUT=300 # 5 minutes (default)
|
|
340
|
+
|
|
341
|
+
# LLM request timeout
|
|
342
|
+
LLM_TIMEOUT=120 # 2 minutes (default)
|
|
343
|
+
```
|
|
344
|
+
|
|
345
|
+
---
|
|
346
|
+
|
|
347
|
+
## Logging Configuration
|
|
348
|
+
|
|
349
|
+
### Log Level
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
# Log verbosity
|
|
353
|
+
LOG_LEVEL=INFO # DEBUG, INFO, WARNING, ERROR, CRITICAL
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
### Log Formats
|
|
357
|
+
|
|
358
|
+
**Development:**
|
|
359
|
+
```bash
|
|
360
|
+
LOG_LEVEL=DEBUG
|
|
361
|
+
```
|
|
362
|
+
|
|
363
|
+
**Production:**
|
|
364
|
+
```bash
|
|
365
|
+
LOG_LEVEL=INFO
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
### Python Logging
|
|
369
|
+
|
|
370
|
+
```python
|
|
371
|
+
import logging
|
|
372
|
+
|
|
373
|
+
# Configure logging
|
|
374
|
+
logging.basicConfig(
|
|
375
|
+
level=logging.INFO,
|
|
376
|
+
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s'
|
|
377
|
+
)
|
|
378
|
+
|
|
379
|
+
# Get logger
|
|
380
|
+
logger = logging.getLogger('jarviscore')
|
|
381
|
+
logger.setLevel(logging.DEBUG)
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
---
|
|
385
|
+
|
|
386
|
+
## Configuration Examples
|
|
387
|
+
|
|
388
|
+
### Example 1: Local Development
|
|
389
|
+
|
|
390
|
+
```bash
|
|
391
|
+
# .env
|
|
392
|
+
CLAUDE_API_KEY=sk-ant-...
|
|
393
|
+
SANDBOX_MODE=local
|
|
394
|
+
LOG_LEVEL=DEBUG
|
|
395
|
+
P2P_ENABLED=false
|
|
396
|
+
```
|
|
397
|
+
|
|
398
|
+
**Use case:** Rapid prototyping, testing
|
|
399
|
+
|
|
400
|
+
### Example 2: vLLM Production
|
|
401
|
+
|
|
402
|
+
```bash
|
|
403
|
+
# .env
|
|
404
|
+
LLM_ENDPOINT=http://localhost:8000
|
|
405
|
+
LLM_MODEL=Qwen/Qwen2.5-Coder-32B-Instruct
|
|
406
|
+
SANDBOX_MODE=remote
|
|
407
|
+
SANDBOX_SERVICE_URL=https://browser-task-executor...
|
|
408
|
+
LOG_LEVEL=INFO
|
|
409
|
+
LOG_DIRECTORY=/var/log/jarviscore
|
|
410
|
+
P2P_ENABLED=false
|
|
411
|
+
```
|
|
412
|
+
|
|
413
|
+
**Use case:** Cost-effective single-node production
|
|
414
|
+
|
|
415
|
+
### Example 3: Azure OpenAI with P2P
|
|
416
|
+
|
|
417
|
+
```bash
|
|
418
|
+
# .env
|
|
419
|
+
AZURE_API_KEY=...
|
|
420
|
+
AZURE_ENDPOINT=https://my-resource.openai.azure.com
|
|
421
|
+
AZURE_DEPLOYMENT=gpt-4o
|
|
422
|
+
AZURE_API_VERSION=2025-01-01-preview
|
|
423
|
+
|
|
424
|
+
SANDBOX_MODE=remote
|
|
425
|
+
SANDBOX_SERVICE_URL=https://browser-task-executor...
|
|
426
|
+
|
|
427
|
+
P2P_ENABLED=true
|
|
428
|
+
BIND_HOST=0.0.0.0
|
|
429
|
+
BIND_PORT=7946
|
|
430
|
+
SEED_NODES=192.168.1.100:7946,192.168.1.101:7946
|
|
431
|
+
|
|
432
|
+
LOG_LEVEL=INFO
|
|
433
|
+
LOG_DIRECTORY=/var/log/jarviscore
|
|
434
|
+
```
|
|
435
|
+
|
|
436
|
+
**Use case:** Enterprise distributed deployment
|
|
437
|
+
|
|
438
|
+
### Example 4: Multi-Provider Fallback
|
|
439
|
+
|
|
440
|
+
```bash
|
|
441
|
+
# .env
|
|
442
|
+
# Primary: Claude
|
|
443
|
+
CLAUDE_API_KEY=sk-ant-...
|
|
444
|
+
|
|
445
|
+
# Fallback 1: Azure
|
|
446
|
+
AZURE_API_KEY=...
|
|
447
|
+
AZURE_ENDPOINT=https://...
|
|
448
|
+
AZURE_DEPLOYMENT=gpt-4o
|
|
449
|
+
|
|
450
|
+
# Fallback 2: Gemini
|
|
451
|
+
GEMINI_API_KEY=...
|
|
452
|
+
|
|
453
|
+
SANDBOX_MODE=local
|
|
454
|
+
LOG_LEVEL=INFO
|
|
455
|
+
```
|
|
456
|
+
|
|
457
|
+
**Use case:** High availability with provider redundancy
|
|
458
|
+
|
|
459
|
+
### Example 5: Zero-Config
|
|
460
|
+
|
|
461
|
+
```bash
|
|
462
|
+
# .env
|
|
463
|
+
# Empty file or just:
|
|
464
|
+
CLAUDE_API_KEY=sk-ant-...
|
|
465
|
+
```
|
|
466
|
+
|
|
467
|
+
Everything else uses defaults. Perfect for getting started!
|
|
468
|
+
|
|
469
|
+
---
|
|
470
|
+
|
|
471
|
+
## Environment-Specific Configuration
|
|
472
|
+
|
|
473
|
+
### Development
|
|
474
|
+
|
|
475
|
+
```bash
|
|
476
|
+
# .env.development
|
|
477
|
+
CLAUDE_API_KEY=...
|
|
478
|
+
SANDBOX_MODE=local
|
|
479
|
+
LOG_LEVEL=DEBUG
|
|
480
|
+
P2P_ENABLED=false
|
|
481
|
+
EXECUTION_TIMEOUT=60
|
|
482
|
+
MAX_REPAIR_ATTEMPTS=1
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### Staging
|
|
486
|
+
|
|
487
|
+
```bash
|
|
488
|
+
# .env.staging
|
|
489
|
+
AZURE_API_KEY=...
|
|
490
|
+
AZURE_ENDPOINT=...
|
|
491
|
+
SANDBOX_MODE=remote
|
|
492
|
+
SANDBOX_SERVICE_URL=https://...
|
|
493
|
+
LOG_LEVEL=INFO
|
|
494
|
+
P2P_ENABLED=true
|
|
495
|
+
EXECUTION_TIMEOUT=300
|
|
496
|
+
```
|
|
497
|
+
|
|
498
|
+
### Production
|
|
499
|
+
|
|
500
|
+
```bash
|
|
501
|
+
# .env.production
|
|
502
|
+
LLM_ENDPOINT=http://vllm-service:8000
|
|
503
|
+
SANDBOX_MODE=remote
|
|
504
|
+
SANDBOX_SERVICE_URL=https://...
|
|
505
|
+
LOG_LEVEL=WARNING
|
|
506
|
+
LOG_DIRECTORY=/var/log/jarviscore
|
|
507
|
+
P2P_ENABLED=true
|
|
508
|
+
BIND_HOST=0.0.0.0
|
|
509
|
+
EXECUTION_TIMEOUT=600
|
|
510
|
+
MAX_REPAIR_ATTEMPTS=3
|
|
511
|
+
```
|
|
512
|
+
|
|
513
|
+
### Load Configuration
|
|
514
|
+
|
|
515
|
+
```python
|
|
516
|
+
import os
|
|
517
|
+
from jarviscore import Mesh
|
|
518
|
+
|
|
519
|
+
# Set environment
|
|
520
|
+
env = os.getenv('ENVIRONMENT', 'development')
|
|
521
|
+
|
|
522
|
+
# Load config file
|
|
523
|
+
from dotenv import load_dotenv
|
|
524
|
+
load_dotenv(f'.env.{env}')
|
|
525
|
+
|
|
526
|
+
# Create mesh
|
|
527
|
+
mesh = Mesh()
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
---
|
|
531
|
+
|
|
532
|
+
## Programmatic Configuration
|
|
533
|
+
|
|
534
|
+
Override environment variables in code:
|
|
535
|
+
|
|
536
|
+
```python
|
|
537
|
+
from jarviscore import Mesh
|
|
538
|
+
|
|
539
|
+
config = {
|
|
540
|
+
'sandbox_mode': 'remote',
|
|
541
|
+
'sandbox_service_url': 'https://...',
|
|
542
|
+
'execution_timeout': 600,
|
|
543
|
+
'log_level': 'DEBUG'
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
mesh = Mesh(mode="autonomous", config=config)
|
|
547
|
+
```
|
|
548
|
+
|
|
549
|
+
**Note:** Programmatic config overrides environment variables.
|
|
550
|
+
|
|
551
|
+
---
|
|
552
|
+
|
|
553
|
+
## Validation
|
|
554
|
+
|
|
555
|
+
### Check Configuration
|
|
556
|
+
|
|
557
|
+
```python
|
|
558
|
+
from jarviscore.config import settings
|
|
559
|
+
|
|
560
|
+
# Print current settings
|
|
561
|
+
print(f"Sandbox Mode: {settings.sandbox_mode}")
|
|
562
|
+
print(f"Log Directory: {settings.log_directory}")
|
|
563
|
+
print(f"Claude Key: {'Set' if settings.claude_api_key else 'Not set'}")
|
|
564
|
+
```
|
|
565
|
+
|
|
566
|
+
### Verify LLM Providers
|
|
567
|
+
|
|
568
|
+
```python
|
|
569
|
+
from jarviscore.execution import create_llm_client
|
|
570
|
+
|
|
571
|
+
llm = create_llm_client()
|
|
572
|
+
|
|
573
|
+
# Test generation
|
|
574
|
+
response = await llm.generate("Hello")
|
|
575
|
+
print(f"Provider: {response['provider']}")
|
|
576
|
+
print(f"Model: {response['model']}")
|
|
577
|
+
```
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## Security Best Practices
|
|
582
|
+
|
|
583
|
+
### 1. Never Commit .env Files
|
|
584
|
+
|
|
585
|
+
```bash
|
|
586
|
+
# .gitignore
|
|
587
|
+
.env
|
|
588
|
+
.env.*
|
|
589
|
+
!.env.example
|
|
590
|
+
```
|
|
591
|
+
|
|
592
|
+
### 2. Use Secret Management
|
|
593
|
+
|
|
594
|
+
**Development:**
|
|
595
|
+
```bash
|
|
596
|
+
# .env file (gitignored)
|
|
597
|
+
CLAUDE_API_KEY=...
|
|
598
|
+
```
|
|
599
|
+
|
|
600
|
+
**Production:**
|
|
601
|
+
```bash
|
|
602
|
+
# AWS Secrets Manager
|
|
603
|
+
aws secretsmanager get-secret-value --secret-id jarviscore/claude-key
|
|
604
|
+
|
|
605
|
+
# Azure Key Vault
|
|
606
|
+
az keyvault secret show --vault-name myvault --name claude-key
|
|
607
|
+
|
|
608
|
+
# Kubernetes Secrets
|
|
609
|
+
kubectl create secret generic jarviscore-secrets \
|
|
610
|
+
--from-literal=CLAUDE_API_KEY=...
|
|
611
|
+
```
|
|
612
|
+
|
|
613
|
+
### 3. Restrict File Permissions
|
|
614
|
+
|
|
615
|
+
```bash
|
|
616
|
+
chmod 600 .env
|
|
617
|
+
```
|
|
618
|
+
|
|
619
|
+
### 4. Use Remote Sandbox in Production
|
|
620
|
+
|
|
621
|
+
```bash
|
|
622
|
+
# Production
|
|
623
|
+
SANDBOX_MODE=remote # Better isolation
|
|
624
|
+
|
|
625
|
+
# Development
|
|
626
|
+
SANDBOX_MODE=local # Faster iteration
|
|
627
|
+
```
|
|
628
|
+
|
|
629
|
+
### 5. Rotate API Keys Regularly
|
|
630
|
+
|
|
631
|
+
Set up key rotation every 90 days.
|
|
632
|
+
|
|
633
|
+
---
|
|
634
|
+
|
|
635
|
+
## Troubleshooting
|
|
636
|
+
|
|
637
|
+
### Issue: Configuration not loading
|
|
638
|
+
|
|
639
|
+
**Solution:**
|
|
640
|
+
```python
|
|
641
|
+
# Ensure .env is in correct location
|
|
642
|
+
import os
|
|
643
|
+
print(os.getcwd()) # Should contain .env
|
|
644
|
+
|
|
645
|
+
# Manual load
|
|
646
|
+
from dotenv import load_dotenv
|
|
647
|
+
load_dotenv('.env')
|
|
648
|
+
```
|
|
649
|
+
|
|
650
|
+
### Issue: LLM provider not found
|
|
651
|
+
|
|
652
|
+
**Solution:**
|
|
653
|
+
```bash
|
|
654
|
+
# Check at least one provider is configured
|
|
655
|
+
echo $CLAUDE_API_KEY
|
|
656
|
+
echo $LLM_ENDPOINT
|
|
657
|
+
echo $AZURE_API_KEY
|
|
658
|
+
echo $GEMINI_API_KEY
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
### Issue: Sandbox connection failed
|
|
662
|
+
|
|
663
|
+
**Solution:**
|
|
664
|
+
```bash
|
|
665
|
+
# Test remote sandbox URL
|
|
666
|
+
curl -X POST https://browser-task-executor... \
|
|
667
|
+
-H "Content-Type: application/json" \
|
|
668
|
+
-d '{"STEP_DATA": {...}, "TASK_CODE_B64": "..."}'
|
|
669
|
+
|
|
670
|
+
# Fallback to local
|
|
671
|
+
SANDBOX_MODE=local
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
### Issue: P2P connection failed
|
|
675
|
+
|
|
676
|
+
**Solution:**
|
|
677
|
+
```bash
|
|
678
|
+
# Check firewall
|
|
679
|
+
sudo ufw allow 7946/tcp
|
|
680
|
+
sudo ufw allow 7946/udp
|
|
681
|
+
sudo ufw allow 8946/tcp # ZMQ (BIND_PORT + 1000)
|
|
682
|
+
|
|
683
|
+
# Check seed nodes are reachable
|
|
684
|
+
nc -zv 192.168.1.100 7946
|
|
685
|
+
```
|
|
686
|
+
|
|
687
|
+
### Issue: Storage directory not writable
|
|
688
|
+
|
|
689
|
+
**Solution:**
|
|
690
|
+
```bash
|
|
691
|
+
# Create directory
|
|
692
|
+
mkdir -p ./logs
|
|
693
|
+
|
|
694
|
+
# Fix permissions
|
|
695
|
+
chmod 755 ./logs
|
|
696
|
+
|
|
697
|
+
# Or change location
|
|
698
|
+
LOG_DIRECTORY=/tmp/jarviscore-logs
|
|
699
|
+
```
|
|
700
|
+
|
|
701
|
+
---
|
|
702
|
+
|
|
703
|
+
## Configuration Reference
|
|
704
|
+
|
|
705
|
+
### All Variables
|
|
706
|
+
|
|
707
|
+
| Variable | Default | Description |
|
|
708
|
+
|----------|---------|-------------|
|
|
709
|
+
| `CLAUDE_API_KEY` | None | Anthropic API key |
|
|
710
|
+
| `CLAUDE_ENDPOINT` | https://api.anthropic.com | Claude API endpoint |
|
|
711
|
+
| `CLAUDE_MODEL` | claude-sonnet-4 | Claude model |
|
|
712
|
+
| `LLM_ENDPOINT` | None | vLLM server URL |
|
|
713
|
+
| `LLM_MODEL` | default | vLLM model name |
|
|
714
|
+
| `AZURE_API_KEY` | None | Azure OpenAI key |
|
|
715
|
+
| `AZURE_ENDPOINT` | None | Azure OpenAI endpoint |
|
|
716
|
+
| `AZURE_DEPLOYMENT` | None | Azure deployment name |
|
|
717
|
+
| `AZURE_API_VERSION` | 2024-02-15-preview | Azure API version |
|
|
718
|
+
| `GEMINI_API_KEY` | None | Google Gemini key |
|
|
719
|
+
| `GEMINI_MODEL` | gemini-1.5-flash | Gemini model |
|
|
720
|
+
| `LLM_TIMEOUT` | 120.0 | LLM timeout (seconds) |
|
|
721
|
+
| `LLM_TEMPERATURE` | 0.7 | Sampling temperature |
|
|
722
|
+
| `SANDBOX_MODE` | local | Execution mode |
|
|
723
|
+
| `SANDBOX_SERVICE_URL` | None | Remote sandbox URL |
|
|
724
|
+
| `EXECUTION_TIMEOUT` | 300 | Code timeout (seconds) |
|
|
725
|
+
| `MAX_REPAIR_ATTEMPTS` | 3 | Max repair attempts |
|
|
726
|
+
| `MAX_RETRIES` | 3 | Max retry attempts |
|
|
727
|
+
| `LOG_DIRECTORY` | ./logs | Storage directory |
|
|
728
|
+
| `LOG_LEVEL` | INFO | Log verbosity |
|
|
729
|
+
| `P2P_ENABLED` | false | Enable P2P mesh |
|
|
730
|
+
| `NODE_NAME` | jarviscore-node | Node identifier |
|
|
731
|
+
| `BIND_HOST` | 127.0.0.1 | P2P bind address |
|
|
732
|
+
| `BIND_PORT` | 7946 | P2P bind port |
|
|
733
|
+
| `SEED_NODES` | None | Seed nodes (CSV) |
|
|
734
|
+
| `ZMQ_PORT_OFFSET` | 1000 | ZMQ port offset |
|
|
735
|
+
| `TRANSPORT_TYPE` | hybrid | Transport type |
|
|
736
|
+
| `KEEPALIVE_ENABLED` | true | Enable keepalive |
|
|
737
|
+
| `KEEPALIVE_INTERVAL` | 90 | Keepalive interval |
|
|
738
|
+
|
|
739
|
+
---
|
|
740
|
+
|
|
741
|
+
## Next Steps
|
|
742
|
+
|
|
743
|
+
1. **Read the [User Guide](USER_GUIDE.md)** for practical examples
|
|
744
|
+
2. **Check the [API Reference](API_REFERENCE.md)** for detailed documentation
|
|
745
|
+
3. **Explore .env.example** for complete configuration template
|
|
746
|
+
|
|
747
|
+
---
|
|
748
|
+
|
|
749
|
+
## Version
|
|
750
|
+
|
|
751
|
+
Configuration Guide for JarvisCore v0.1.0
|
|
752
|
+
|
|
753
|
+
Last Updated: 2026-01-12
|