File size: 21,291 Bytes
df47251
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
# βš™οΈ Dashboard Settings

## Table of Contents
1. [Overview](#overview)
2. [Memory Settings](#memory-settings)
3. [API & Model Settings](#api--model-settings)
4. [MCP Server Management](#mcp-server-management)
5. [Agent Behavior](#agent-behavior)
6. [Search Engine Configuration](#search-engine-configuration)
7. [Network & Proxy](#network--proxy)
8. [Cost Control](#cost-control)
9. [Performance Tuning](#performance-tuning)
10. [Import/Export](#importexport)

---

## Overview

The **Settings Dashboard** provides comprehensive configuration for all aspects of the WebScraper environment, models, MCPs, agents, and observability.

### Settings Structure

```
Settings
β”œβ”€β”€ Memory
β”‚   β”œβ”€β”€ Short-Term Memory
β”‚   β”œβ”€β”€ Working Memory
β”‚   β”œβ”€β”€ Long-Term Memory
β”‚   └── Shared Memory
β”œβ”€β”€ API & Models
β”‚   β”œβ”€β”€ OpenAI
β”‚   β”œβ”€β”€ Anthropic
β”‚   β”œβ”€β”€ Google
β”‚   β”œβ”€β”€ Groq
β”‚   β”œβ”€β”€ Custom Providers
β”‚   └── Model Routing
β”œβ”€β”€ MCP Servers
β”‚   β”œβ”€β”€ Installed Servers
β”‚   β”œβ”€β”€ Available Servers
β”‚   └── Custom Servers
β”œβ”€β”€ Agent Behavior
β”‚   β”œβ”€β”€ Exploration vs Exploitation
β”‚   β”œβ”€β”€ Retry Strategy
β”‚   β”œβ”€β”€ Planning Depth
β”‚   └── Risk Tolerance
β”œβ”€β”€ Search Engines
β”‚   β”œβ”€β”€ Google Search
β”‚   β”œβ”€β”€ Bing Search
β”‚   β”œβ”€β”€ Brave Search
β”‚   └── DuckDuckGo
β”œβ”€β”€ Network & Proxy
β”‚   β”œβ”€β”€ Proxy Pool
β”‚   β”œβ”€β”€ VPN Configuration
β”‚   β”œβ”€β”€ Rate Limiting
β”‚   └── User Agent Rotation
β”œβ”€β”€ Cost Control
β”‚   β”œβ”€β”€ Daily Budget
β”‚   β”œβ”€β”€ Model Costs
β”‚   └── Alerts
└── Performance
    β”œβ”€β”€ Batch Processing
    β”œβ”€β”€ Parallel Execution
    β”œβ”€β”€ Caching
    └── Context Optimization
```

---

## Memory Settings

### Configuration

```typescript
interface MemorySettings {
  // Layer toggles
  enableShortTerm: boolean;          // Episode memory
  enableWorking: boolean;            // Reasoning buffer
  enableLongTerm: boolean;           // Persistent patterns
  enableShared: boolean;             // Multi-agent memory
  
  // Size limits
  maxEpisodeMemoryMB: number;        // Default: 10
  maxWorkingMemoryItems: number;     // Default: 50
  maxLongTermPatterns: number;       // Default: 10000
  
  // Vector database
  vectorDB: {
    provider: 'faiss' | 'qdrant' | 'pinecone' | 'weaviate';
    embeddingModel: string;          // Default: 'text-embedding-3-small'
    dimension: number;               // Default: 1536
    similarityMetric: 'cosine' | 'euclidean' | 'dot_product';
  };
  
  // Storage backend
  storage: {
    backend: 'filesystem' | 'postgresql' | 'mongodb' | 'redis';
    path: string;                    // For filesystem
    connectionString?: string;        // For databases
  };
  
  // Optimization
  autoPrune: boolean;                // Default: true
  pruneThreshold: number;            // Default: 0.3 (keep if score > 0.3)
  pruneIntervalHours: number;        // Default: 24
  autoSummarize: boolean;            // Default: true
  maxContextTokens: number;          // Default: 4000
}
```

### UI Component

```jsx
<MemorySettings>
  <Section title="Memory Layers">
    <Toggle label="Short-Term Memory (Episode)" value={enableShortTerm} />
    <Toggle label="Working Memory (Reasoning)" value={enableWorking} />
    <Toggle label="Long-Term Memory (Persistent)" value={enableLongTerm} />
    <Toggle label="Shared Memory (Multi-Agent)" value={enableShared} />
  </Section>
  
  <Section title="Size Limits">
    <NumberInput label="Episode Memory (MB)" value={maxEpisodeMemoryMB} min={1} max={100} />
    <NumberInput label="Working Memory Items" value={maxWorkingMemoryItems} min={10} max={500} />
    <NumberInput label="Long-Term Patterns" value={maxLongTermPatterns} min={100} max={100000} />
  </Section>
  
  <Section title="Vector Database">
    <Select label="Provider" options={['FAISS', 'Qdrant', 'Pinecone', 'Weaviate']} />
    <Select label="Embedding Model" options={['text-embedding-3-small', 'text-embedding-3-large', 'custom']} />
    <NumberInput label="Dimension" value={dimension} disabled />
    <Select label="Similarity Metric" options={['Cosine', 'Euclidean', 'Dot Product']} />
  </Section>
  
  <Section title="Auto-Optimization">
    <Toggle label="Auto-Prune Low-Value Memories" value={autoPrune} />
    <Slider label="Prune Threshold" value={pruneThreshold} min={0} max={1} step={0.1} />
    <NumberInput label="Prune Interval (hours)" value={pruneIntervalHours} />
    <Toggle label="Auto-Summarize Episodes" value={autoSummarize} />
    <NumberInput label="Max Context Tokens" value={maxContextTokens} />
  </Section>
</MemorySettings>
```

---

## API & Model Settings

### Multi-Provider Configuration

```typescript
interface APISettings {
  providers: {
    openai?: {
      apiKey: string;
      organization?: string;
      models: {
        default: string;
        reasoning: string;
        fast: string;
      };
      temperature: number;
      maxTokens: number;
    };
    
    anthropic?: {
      apiKey: string;
      models: {
        default: string;
        reasoning: string;
        fast: string;
      };
      temperature: number;
      maxTokens: number;
    };
    
    google?: {
      apiKey: string;
      models: {
        default: string;
        reasoning: string;
        fast: string;
      };
      temperature: number;
      maxOutputTokens: number;
    };
    
    groq?: {
      apiKey: string;
      models: {
        default: string;
        reasoning: string;
        fast: string;
      };
      temperature: number;
      maxTokens: number;
    };
    
    custom?: {
      baseURL: string;
      apiKey: string;
      models: Record<string, string>;
    };
  };
  
  // Smart routing
  router: {
    enabled: boolean;
    strategy: 'task_based' | 'cost_optimized' | 'speed_optimized' | 'quality_optimized';
    fallbackOrder: string[];
    autoRetry: boolean;
    maxRetries: number;
  };
  
  // Ensemble
  ensemble: {
    enabled: boolean;
    strategy: 'voting' | 'ranking' | 'fusion' | 'verification';
    models: string[];
    minAgreement: number;
  };
}
```

### UI Component

```jsx
<APISettings>
  <Tabs>
    <Tab label="OpenAI">
      <TextInput label="API Key" type="password" value={openaiKey} />
      <TextInput label="Organization (optional)" value={openaiOrg} />
      <Select label="Default Model" options={['gpt-4o-mini', 'gpt-4-turbo', 'gpt-4o']} />
      <Select label="Reasoning Model" options={['gpt-4-turbo', 'gpt-4o']} />
      <Select label="Fast Model" options={['gpt-4o-mini', 'gpt-3.5-turbo']} />
      <Button onClick={testConnection}>Test Connection</Button>
    </Tab>
    
    <Tab label="Anthropic">
      <TextInput label="API Key" type="password" value={anthropicKey} />
      <Select label="Default Model" options={['claude-3-5-sonnet', 'claude-3-opus']} />
      <Button onClick={testConnection}>Test Connection</Button>
    </Tab>
    
    <Tab label="Google">
      <TextInput label="API Key" type="password" value={googleKey} />
      <Select label="Default Model" options={['gemini-1.5-flash', 'gemini-1.5-pro']} />
      <Button onClick={testConnection}>Test Connection</Button>
    </Tab>
    
    <Tab label="Groq">
      <TextInput label="API Key" type="password" value={groqKey} />
      <Select label="Default Model" options={['llama-3.1-70b-versatile', 'llama-3.1-405b']} />
      <Button onClick={testConnection}>Test Connection</Button>
    </Tab>
    
    <Tab label="Custom">
      <TextInput label="Base URL" value={customBaseURL} placeholder="http://localhost:11434/v1" />
      <TextInput label="API Key" type="password" value={customKey} />
      <DynamicList label="Models" items={customModels} />
      <Button onClick={testConnection}>Test Connection</Button>
    </Tab>
  </Tabs>
  
  <Section title="Smart Model Routing">
    <Toggle label="Enable Smart Routing" value={routerEnabled} />
    <Select label="Strategy" options={['Task-Based', 'Cost Optimized', 'Speed Optimized', 'Quality Optimized']} />
    <SortableList label="Fallback Order" items={fallbackOrder} />
    <Toggle label="Auto-Retry on Failure" value={autoRetry} />
    <NumberInput label="Max Retries" value={maxRetries} min={1} max={10} />
  </Section>
  
  <Section title="Model Ensemble">
    <Toggle label="Enable Ensemble (⚠️ Increases Cost)" value={ensembleEnabled} />
    <Select label="Strategy" options={['Voting', 'Ranking', 'Fusion', 'Verification']} />
    <MultiSelect label="Models" options={allModels} selected={ensembleModels} />
    <Slider label="Min Agreement (%)" value={minAgreement} min={50} max={100} />
  </Section>
</APISettings>
```

---

## MCP Server Management

### Configuration

```typescript
interface MCPSettings {
  servers: Record<string, MCPServerConfig>;
  
  autoDiscoverTools: boolean;
  toolTimeout: number;              // Seconds
  maxConcurrentCalls: number;
  retryFailedCalls: boolean;
  cacheToolResults: boolean;
  cacheTTL: number;                 // Seconds
}

interface MCPServerConfig {
  command: string;
  args: string[];
  enabled: boolean;
  autoDownload: boolean;
  config: Record<string, any>;
  
  // Metadata
  name: string;
  description: string;
  category: string;
  installSize: string;
  status: 'installed' | 'not_installed' | 'downloading' | 'error';
}
```

### UI Component

```jsx
<MCPServerManagement>
  <Tabs>
    <Tab label="Installed">
      <ServerList>
        {installedServers.map(server => (
          <ServerCard key={server.name}>
            <ServerIcon category={server.category} />
            <ServerInfo>
              <Title>{server.name}</Title>
              <Description>{server.description}</Description>
              <Meta>
                <Badge>{ server.category}</Badge>
                <Badge>{server.toolCount} tools</Badge>
              </Meta>
            </ServerInfo>
            <Actions>
              <Toggle value={server.enabled} onChange={toggleServer} />
              <Button onClick={() => testServer(server)}>Test</Button>
              <Button onClick={() => uninstallServer(server)}>Uninstall</Button>
            </Actions>
          </ServerCard>
        ))}
      </ServerList>
    </Tab>
    
    <Tab label="Available">
      <SearchInput placeholder="Search MCP servers..." />
      <FilterBar>
        <Filter label="All" />
        <Filter label="Parsing" />
        <Filter label="Browser" />
        <Filter label="Database" />
        <Filter label="Search" />
      </FilterBar>
      
      <ServerGallery>
        {availableServers.map(server => (
          <ServerCard key={server.name}>
            <ServerIcon category={server.category} />
            <Title>{server.name}</Title>
            <Description>{server.description}</Description>
            <InstallSize>{server.installSize}</InstallSize>
            <Button onClick={() => installServer(server)}>
              Install
            </Button>
          </ServerCard>
        ))}
      </ServerGallery>
    </Tab>
    
    <Tab label="Custom">
      <Form onSubmit={addCustomServer}>
        <TextInput label="Server Name" required />
        <TextInput label="Command" placeholder="python" required />
        <TextInput label="Arguments" placeholder="-m mcp_server" required />
        <JsonEditor label="Config (JSON)" />
        <Button type="submit">Add Server</Button>
      </Form>
    </Tab>
  </Tabs>
  
  <Section title="Global MCP Settings">
    <Toggle label="Auto-Discover Tools on Startup" value={autoDiscoverTools} />
    <NumberInput label="Tool Timeout (seconds)" value={toolTimeout} />
    <NumberInput label="Max Concurrent Calls" value={maxConcurrentCalls} />
    <Toggle label="Retry Failed Calls" value={retryFailedCalls} />
    <Toggle label="Cache Tool Results" value={cacheToolResults} />
    <NumberInput label="Cache TTL (seconds)" value={cacheTTL} />
  </Section>
</MCPServerManagement>
```

---

## Agent Behavior

### Configuration

```typescript
interface AgentBehaviorSettings {
  // Exploration vs Exploitation
  explorationRate: number;           // 0.0 = exploit only, 1.0 = explore only
  explorationDecay: number;          // Decay rate per episode
  
  // Planning
  planningDepth: number;             // How many steps ahead to plan
  replanThreshold: number;           // Replan if reward drops by X%
  
  // Retry strategy
  maxRetries: number;                // Per action
  retryDelay: number;                // Seconds
  adaptiveRetry: boolean;            // Increase delay after each failure
  
  // Risk tolerance
  riskTolerance: 'conservative' | 'balanced' | 'aggressive';
  
  // Memory usage
  memoryIntensity: 'low' | 'medium' | 'high';
  
  // Learning
  learningRate: number;
  enableOnlineLearning: boolean;
  updateMemoryAfterEpisode: boolean;
}
```

### UI Component

```jsx
<AgentBehaviorSettings>
  <Section title="Exploration Strategy">
    <Slider label="Exploration Rate" value={explorationRate} min={0} max={1} step={0.1} />
    <HelpText>
      0.0 = Always use best known strategy (exploit)
      1.0 = Always try new approaches (explore)
    </HelpText>
    <Slider label="Exploration Decay" value={explorationDecay} min={0} max={0.1} step={0.01} />
  </Section>
  
  <Section title="Planning">
    <Slider label="Planning Depth" value={planningDepth} min={1} max={10} />
    <HelpText>How many steps ahead the agent plans (higher = slower but smarter)</HelpText>
    <NumberInput label="Replan Threshold (%)" value={replanThreshold} min={0} max={100} />
  </Section>
  
  <Section title="Retry Strategy">
    <NumberInput label="Max Retries" value={maxRetries} min={0} max={10} />
    <NumberInput label="Retry Delay (seconds)" value={retryDelay} min={0} max={60} />
    <Toggle label="Adaptive Retry (exponential backoff)" value={adaptiveRetry} />
  </Section>
  
  <Section title="Risk Tolerance">
    <RadioGroup value={riskTolerance}>
      <Radio value="conservative">
        <Label>Conservative</Label>
        <Description>Prefer proven patterns, avoid risky actions</Description>
      </Radio>
      <Radio value="balanced">
        <Label>Balanced</Label>
        <Description>Balance exploration and exploitation</Description>
      </Radio>
      <Radio value="aggressive">
        <Label>Aggressive</Label>
        <Description>Try new approaches quickly, higher failure tolerance</Description>
      </Radio>
    </RadioGroup>
  </Section>
  
  <Section title="Memory & Learning">
    <Select label="Memory Intensity" options={['Low', 'Medium', 'High']} />
    <Toggle label="Enable Online Learning" value={enableOnlineLearning} />
    <Toggle label="Update Memory After Each Episode" value={updateMemoryAfterEpisode} />
  </Section>
</AgentBehaviorSettings>
```

---

## Search Engine Configuration

### Configuration

```typescript
interface SearchEngineSettings {
  default: 'google' | 'bing' | 'brave' | 'duckduckgo' | 'perplexity';
  
  google?: {
    apiKey: string;
    searchEngineId: string;
    region: string;
    safeSearch: boolean;
  };
  
  bing?: {
    apiKey: string;
    market: string;
  };
  
  brave?: {
    apiKey: string;
    country: string;
  };
  
  duckduckgo?: {
    region: string;
    safeSearch: boolean;
  };
  
  perplexity?: {
    apiKey: string;
    model: string;
  };
  
  // Global settings
  maxResults: number;
  timeout: number;
  cacheResults: boolean;
  cacheTTL: number;
}
```

### UI Component

```jsx
<SearchEngineSettings>
  <Select label="Default Search Engine" options={['Google', 'Bing', 'Brave', 'DuckDuckGo', 'Perplexity']} />
  
  <Tabs>
    <Tab label="Google">
      <TextInput label="API Key" type="password" />
      <TextInput label="Search Engine ID" />
      <Select label="Region" options={regions} />
      <Toggle label="Safe Search" />
      <Button onClick={testGoogle}>Test</Button>
    </Tab>
    
    <Tab label="Bing">
      <TextInput label="API Key" type="password" />
      <Select label="Market" options={markets} />
      <Button onClick={testBing}>Test</Button>
    </Tab>
    
    <Tab label="Brave">
      <TextInput label="API Key" type="password" />
      <Select label="Country" options={countries} />
      <Button onClick={testBrave}>Test</Button>
    </Tab>
    
    <Tab label="DuckDuckGo">
      <Info>No API key required (free)</Info>
      <Select label="Region" options={regions} />
      <Toggle label="Safe Search" />
    </Tab>
    
    <Tab label="Perplexity">
      <TextInput label="API Key" type="password" />
      <Select label="Model" options={['pplx-70b-online', 'pplx-7b-online']} />
      <Button onClick={testPerplexity}>Test</Button>
    </Tab>
  </Tabs>
  
  <Section title="Global Settings">
    <NumberInput label="Max Results" value={maxResults} min={1} max={100} />
    <NumberInput label="Timeout (seconds)" value={timeout} min={5} max={60} />
    <Toggle label="Cache Results" value={cacheResults} />
    <NumberInput label="Cache TTL (seconds)" value={cacheTTL} />
  </Section>
</SearchEngineSettings>
```

---

## Network & Proxy

### Configuration

```typescript
interface NetworkSettings {
  proxy: {
    enabled: boolean;
    pools: ProxyPool[];
    rotationStrategy: 'round_robin' | 'random' | 'health_based';
    maxRetries: number;
  };
  
  vpn: {
    enabled: boolean;
    provider: string;
    server: string;
    credentials: {
      username: string;
      password: string;
    };
  };
  
  rateLimiting: {
    enabled: boolean;
    requestsPerSecond: number;
    burstSize: number;
  };
  
  userAgent: {
    rotationEnabled: boolean;
    customUserAgents: string[];
  };
  
  timeout: {
    connect: number;
    read: number;
  };
}
```

### UI - See [proxy-vpn.md](./WebScraper_OpenEnv_SoftwareDoc.md#9-network-layer--vpn--proxy) for full details

---

## Cost Control

### Configuration

```typescript
interface CostControlSettings {
  dailyBudget: number;               // USD
  monthlyBudget: number;             // USD
  alertThresholds: number[];         // [0.5, 0.8, 0.9] = 50%, 80%, 90%
  
  modelCosts: Record<string, { input: number; output: number }>;
  
  enforcements: {
    stopOnBudgetExceeded: boolean;
    downgradeToCheaperModel: boolean;
    notifyOnHighCost: boolean;
  };
}
```

### UI Component

```jsx
<CostControlSettings>
  <Section title="Budgets">
    <NumberInput label="Daily Budget (USD)" value={dailyBudget} prefix="$" />
    <NumberInput label="Monthly Budget (USD)" value={monthlyBudget} prefix="$" />
    
    <CurrentUsage>
      <Stat>
        <Label>Today</Label>
        <Value>${todayCost.toFixed(2)} / ${dailyBudget.toFixed(2)}</Value>
        <ProgressBar value={todayCost / dailyBudget} />
      </Stat>
      <Stat>
        <Label>This Month</Label>
        <Value>${monthCost.toFixed(2)} / ${monthlyBudget.toFixed(2)}</Value>
        <ProgressBar value={monthCost / monthlyBudget} />
      </Stat>
    </CurrentUsage>
  </Section>
  
  <Section title="Alerts">
    <TagInput label="Alert Thresholds (%)" values={alertThresholds} />
    <HelpText>Get notified at these percentages of budget</HelpText>
  </Section>
  
  <Section title="Enforcement">
    <Toggle label="Stop Execution on Budget Exceeded" value={stopOnBudgetExceeded} />
    <Toggle label="Auto-Downgrade to Cheaper Model" value={downgradeToCheaperModel} />
    <Toggle label="Notify on High-Cost Requests" value={notifyOnHighCost} />
  </Section>
  
  <Section title="Model Costs">
    <Table>
      <thead>
        <tr>
          <th>Model</th>
          <th>Input (per 1M tokens)</th>
          <th>Output (per 1M tokens)</th>
          <th>Estimated Cost/Episode</th>
        </tr>
      </thead>
      <tbody>
        {models.map(model => (
          <tr key={model.name}>
            <td>{model.name}</td>
            <td>${model.inputCost.toFixed(2)}</td>
            <td>${model.outputCost.toFixed(2)}</td>
            <td>${model.estimatedCostPerEpisode.toFixed(4)}</td>
          </tr>
        ))}
      </tbody>
    </Table>
  </Section>
</CostControlSettings>
```

---

## Performance Tuning

### Configuration

```typescript
interface PerformanceSettings {
  batchProcessing: {
    enabled: boolean;
    batchSize: number;
    maxConcurrent: number;
  };
  
  parallelExecution: {
    enabled: boolean;
    maxWorkers: number;
  };
  
  caching: {
    enabled: boolean;
    cacheHTML: boolean;
    cacheAPIResponses: boolean;
    cacheDuration: number;            // Seconds
    maxCacheSize: number;             // MB
  };
  
  contextOptimization: {
    enabled: boolean;
    summarizeOldObservations: boolean;
    pruneThreshold: number;
    maxContextTokens: number;
  };
}
```

---

## Import/Export

```jsx
<ImportExportSettings>
  <Section title="Export Settings">
    <Button onClick={exportAll}>Export All Settings (JSON)</Button>
    <Button onClick={exportMemory}>Export Memory Database</Button>
    <Button onClick={exportLogs}>Export Logs</Button>
  </Section>
  
  <Section title="Import Settings">
    <FileUpload label="Import Settings (JSON)" accept=".json" onChange={importSettings} />
    <Button onClick={resetToDefaults}>Reset to Defaults</Button>
  </Section>
</ImportExportSettings>
```

---

**Next:** See [rewards.md](./rewards.md) for advanced reward function design.