@defai.digital/automatosx 8.2.0 → 8.3.2
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.
- package/CHANGELOG.md +16 -0
- package/README.md +125 -86
- package/dist/index.js +29215 -47804
- package/examples/grok/GROK_INTEGRATION.md +511 -0
- package/examples/grok/settings.json +43 -0
- package/examples/providers/README.md +228 -0
- package/examples/providers/grok-with-mcp.yaml +86 -0
- package/examples/providers/grok-x-ai.yaml +46 -0
- package/examples/providers/grok-z-ai.yaml +50 -0
- package/examples/providers/grok.yaml +120 -0
- package/package.json +4 -3
- package/templates/providers/README.md +117 -0
- package/templates/providers/grok-zai.yaml.template +61 -0
- package/templates/providers/grok.yaml.template +71 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
# Provider Configuration Examples
|
|
2
|
+
|
|
3
|
+
This directory contains example YAML configurations for AutomatosX providers.
|
|
4
|
+
|
|
5
|
+
## Available Examples
|
|
6
|
+
|
|
7
|
+
### Grok Provider
|
|
8
|
+
|
|
9
|
+
- **`grok-z-ai.yaml`** - Z.AI GLM 4.6 (code-optimized model)
|
|
10
|
+
- Best for: Development, code generation, technical tasks
|
|
11
|
+
- Endpoint: `https://api.z.ai/api/coding/paas/v4`
|
|
12
|
+
- Model: `glm-4.6`
|
|
13
|
+
|
|
14
|
+
- **`grok-x-ai.yaml`** - X.AI Official Grok Model
|
|
15
|
+
- Best for: Reasoning, analysis, general chat
|
|
16
|
+
- Endpoint: `https://api.x.ai/v1`
|
|
17
|
+
- Model: `grok-beta`
|
|
18
|
+
|
|
19
|
+
- **`grok-with-mcp.yaml`** - Grok with MCP Tools
|
|
20
|
+
- Includes: Filesystem, GitHub, Slack, PostgreSQL integrations
|
|
21
|
+
- Demonstrates: Model Context Protocol (MCP) setup
|
|
22
|
+
- Requires: MCP server packages installed
|
|
23
|
+
|
|
24
|
+
### Multi-Provider Setup
|
|
25
|
+
|
|
26
|
+
- **`multi-provider.yaml`** - Complete multi-provider configuration
|
|
27
|
+
- Demonstrates: Priority-based routing
|
|
28
|
+
- Includes: Claude, Gemini, Grok configurations
|
|
29
|
+
- Shows: Automatic fallback setup
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
### 1. Choose a Template
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# List available examples
|
|
37
|
+
ls examples/providers/
|
|
38
|
+
|
|
39
|
+
# View example
|
|
40
|
+
cat examples/providers/grok-z-ai.yaml
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### 2. Copy to Your Project
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Create providers directory
|
|
47
|
+
mkdir -p .automatosx/providers
|
|
48
|
+
|
|
49
|
+
# Copy template
|
|
50
|
+
cp examples/providers/grok-z-ai.yaml .automatosx/providers/grok.yaml
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### 3. Set Environment Variables
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# For Z.AI
|
|
57
|
+
export GROK_API_KEY="your-z-ai-key"
|
|
58
|
+
|
|
59
|
+
# For X.AI
|
|
60
|
+
export GROK_API_KEY="xai-your-key"
|
|
61
|
+
|
|
62
|
+
# For MCP tools (if using)
|
|
63
|
+
export GITHUB_TOKEN="your-github-token"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### 4. Test Configuration
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Check provider status
|
|
70
|
+
ax doctor grok
|
|
71
|
+
|
|
72
|
+
# Test execution
|
|
73
|
+
ax run --provider grok backend "simple task"
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
## Configuration Priority
|
|
77
|
+
|
|
78
|
+
When using multiple providers, AutomatosX routes requests based on priority:
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
# .automatosx/providers/claude.yaml
|
|
82
|
+
provider:
|
|
83
|
+
priority: 1 # ← Highest priority (tried first)
|
|
84
|
+
|
|
85
|
+
# .automatosx/providers/gemini.yaml
|
|
86
|
+
provider:
|
|
87
|
+
priority: 2 # ← Medium priority
|
|
88
|
+
|
|
89
|
+
# .automatosx/providers/grok.yaml
|
|
90
|
+
provider:
|
|
91
|
+
priority: 3 # ← Lowest priority (fallback)
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
**Routing behavior:**
|
|
95
|
+
1. Try highest priority provider (1)
|
|
96
|
+
2. If unavailable/failed → try next (2)
|
|
97
|
+
3. If all fail → try lowest priority (3)
|
|
98
|
+
4. If all exhausted → return error
|
|
99
|
+
|
|
100
|
+
## Environment Variable Interpolation
|
|
101
|
+
|
|
102
|
+
All examples use `${VAR_NAME}` syntax for environment variables:
|
|
103
|
+
|
|
104
|
+
```yaml
|
|
105
|
+
provider:
|
|
106
|
+
apiKey: ${GROK_API_KEY} # ← Replaced at runtime
|
|
107
|
+
baseUrl: https://${API_HOST}/v1 # ← Supports multiple vars
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
**Benefits:**
|
|
111
|
+
- ✅ Keep secrets out of version control
|
|
112
|
+
- ✅ Easy environment switching (dev/staging/prod)
|
|
113
|
+
- ✅ Works with CI/CD pipelines
|
|
114
|
+
- ✅ Compatible with `.env` files
|
|
115
|
+
|
|
116
|
+
## Customization
|
|
117
|
+
|
|
118
|
+
### Adjust Rate Limits
|
|
119
|
+
|
|
120
|
+
```yaml
|
|
121
|
+
rateLimits:
|
|
122
|
+
maxRequestsPerMinute: 120 # ← Increase for higher quota
|
|
123
|
+
maxTokensPerMinute: 200000 # ← Adjust based on plan
|
|
124
|
+
maxConcurrentRequests: 10 # ← More parallel requests
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Modify Timeouts
|
|
128
|
+
|
|
129
|
+
```yaml
|
|
130
|
+
provider:
|
|
131
|
+
timeout: 300000 # ← 5 minutes for complex tasks
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
### Add Circuit Breaker
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
circuitBreaker:
|
|
138
|
+
failureThreshold: 5 # ← More tolerant
|
|
139
|
+
resetTimeout: 120000 # ← Longer cooldown
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
## Advanced Features
|
|
143
|
+
|
|
144
|
+
### MCP Tools
|
|
145
|
+
|
|
146
|
+
Enable Model Context Protocol for extended capabilities:
|
|
147
|
+
|
|
148
|
+
```yaml
|
|
149
|
+
mcp:
|
|
150
|
+
enabled: true
|
|
151
|
+
servers:
|
|
152
|
+
- name: filesystem
|
|
153
|
+
command: npx
|
|
154
|
+
args: ["-y", "@modelcontextprotocol/server-filesystem", "/path"]
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
**Available MCP Servers:**
|
|
158
|
+
- `@modelcontextprotocol/server-filesystem` - File operations
|
|
159
|
+
- `@modelcontextprotocol/server-github` - GitHub API
|
|
160
|
+
- `@modelcontextprotocol/server-slack` - Slack integration
|
|
161
|
+
- `@modelcontextprotocol/server-postgres` - Database access
|
|
162
|
+
|
|
163
|
+
### Custom Morph Agents
|
|
164
|
+
|
|
165
|
+
Define specialized agents in configuration:
|
|
166
|
+
|
|
167
|
+
```yaml
|
|
168
|
+
morph:
|
|
169
|
+
enabled: true
|
|
170
|
+
agents:
|
|
171
|
+
- name: security-auditor
|
|
172
|
+
prompt: "Analyze code for security vulnerabilities"
|
|
173
|
+
capabilities: ["security", "audit"]
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Troubleshooting
|
|
177
|
+
|
|
178
|
+
### Provider Not Found
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
# Check file exists
|
|
182
|
+
ls -la .automatosx/providers/grok.yaml
|
|
183
|
+
|
|
184
|
+
# Verify provider name
|
|
185
|
+
cat .automatosx/providers/grok.yaml | grep "name:"
|
|
186
|
+
# Should show: name: grok
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Environment Variable Not Set
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Check variable
|
|
193
|
+
echo $GROK_API_KEY
|
|
194
|
+
|
|
195
|
+
# Set if missing
|
|
196
|
+
export GROK_API_KEY="your-key"
|
|
197
|
+
|
|
198
|
+
# Make persistent (add to ~/.bashrc or ~/.zshrc)
|
|
199
|
+
echo 'export GROK_API_KEY="your-key"' >> ~/.bashrc
|
|
200
|
+
source ~/.bashrc
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
### YAML Syntax Error
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
# Validate YAML
|
|
207
|
+
yamllint .automatosx/providers/grok.yaml
|
|
208
|
+
|
|
209
|
+
# Or use online validator
|
|
210
|
+
# https://www.yamllint.com/
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
## Documentation
|
|
214
|
+
|
|
215
|
+
- **Full Documentation**: [docs/providers/grok.md](../../docs/providers/grok.md)
|
|
216
|
+
- **AutomatosX Docs**: [README.md](../../README.md)
|
|
217
|
+
- **Z.AI Docs**: https://docs.z.ai
|
|
218
|
+
- **X.AI Docs**: https://x.ai/api
|
|
219
|
+
|
|
220
|
+
## Support
|
|
221
|
+
|
|
222
|
+
- GitHub Issues: https://github.com/defai-digital/automatosx/issues
|
|
223
|
+
- Email: support@defai.digital
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
**Version**: 8.3.0
|
|
228
|
+
**Last Updated**: 2025-11-16
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
# Grok Provider Example - With MCP Tools
|
|
2
|
+
#
|
|
3
|
+
# This example demonstrates using Grok with Model Context Protocol (MCP) tools.
|
|
4
|
+
# MCP enables the model to interact with external systems (filesystem, GitHub, etc.)
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# 1. Install MCP servers: npm install -g @modelcontextprotocol/server-*
|
|
8
|
+
# 2. Set environment variables: GROK_API_KEY, GITHUB_TOKEN
|
|
9
|
+
# 3. Copy to .automatosx/providers/grok.yaml
|
|
10
|
+
# 4. Run: ax run --provider grok backend "list files in src/"
|
|
11
|
+
|
|
12
|
+
provider:
|
|
13
|
+
name: grok
|
|
14
|
+
enabled: true
|
|
15
|
+
priority: 2
|
|
16
|
+
baseUrl: https://api.z.ai/api/coding/paas/v4
|
|
17
|
+
apiKey: ${GROK_API_KEY}
|
|
18
|
+
model: glm-4.6
|
|
19
|
+
timeout: 120000
|
|
20
|
+
maxRetries: 3
|
|
21
|
+
|
|
22
|
+
# MCP Tools Configuration
|
|
23
|
+
mcp:
|
|
24
|
+
enabled: true
|
|
25
|
+
servers:
|
|
26
|
+
# Filesystem access (read/write files)
|
|
27
|
+
- name: filesystem
|
|
28
|
+
command: npx
|
|
29
|
+
args:
|
|
30
|
+
- "-y"
|
|
31
|
+
- "@modelcontextprotocol/server-filesystem"
|
|
32
|
+
- "/Users/username/projects" # Allowed directory
|
|
33
|
+
env:
|
|
34
|
+
LOG_LEVEL: info
|
|
35
|
+
|
|
36
|
+
# GitHub integration (issues, PRs, repos)
|
|
37
|
+
- name: github
|
|
38
|
+
command: npx
|
|
39
|
+
args:
|
|
40
|
+
- "-y"
|
|
41
|
+
- "@modelcontextprotocol/server-github"
|
|
42
|
+
env:
|
|
43
|
+
GITHUB_TOKEN: ${GITHUB_TOKEN} # GitHub personal access token
|
|
44
|
+
LOG_LEVEL: info
|
|
45
|
+
|
|
46
|
+
# Slack integration (optional)
|
|
47
|
+
# - name: slack
|
|
48
|
+
# command: npx
|
|
49
|
+
# args:
|
|
50
|
+
# - "-y"
|
|
51
|
+
# - "@modelcontextprotocol/server-slack"
|
|
52
|
+
# env:
|
|
53
|
+
# SLACK_TOKEN: ${SLACK_TOKEN}
|
|
54
|
+
# LOG_LEVEL: info
|
|
55
|
+
|
|
56
|
+
# PostgreSQL database (optional)
|
|
57
|
+
# - name: postgres
|
|
58
|
+
# command: npx
|
|
59
|
+
# args:
|
|
60
|
+
# - "-y"
|
|
61
|
+
# - "@modelcontextprotocol/server-postgres"
|
|
62
|
+
# env:
|
|
63
|
+
# DATABASE_URL: ${DATABASE_URL}
|
|
64
|
+
# LOG_LEVEL: info
|
|
65
|
+
|
|
66
|
+
# Rate limits
|
|
67
|
+
rateLimits:
|
|
68
|
+
maxRequestsPerMinute: 60
|
|
69
|
+
maxTokensPerMinute: 100000
|
|
70
|
+
maxConcurrentRequests: 5
|
|
71
|
+
|
|
72
|
+
# Circuit breaker
|
|
73
|
+
circuitBreaker:
|
|
74
|
+
failureThreshold: 3
|
|
75
|
+
resetTimeout: 60000
|
|
76
|
+
|
|
77
|
+
# Metadata
|
|
78
|
+
metadata:
|
|
79
|
+
version: "1.0.0"
|
|
80
|
+
description: "Grok with MCP tools for extended capabilities"
|
|
81
|
+
tags:
|
|
82
|
+
- grok
|
|
83
|
+
- mcp
|
|
84
|
+
- filesystem
|
|
85
|
+
- github
|
|
86
|
+
lastUpdated: "2025-11-16T00:00:00Z"
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Grok Provider Example - X.AI Official Grok Model
|
|
2
|
+
#
|
|
3
|
+
# This example demonstrates using X.AI's official Grok model.
|
|
4
|
+
# Grok is optimized for reasoning, analysis, and general tasks.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# 1. Copy to .automatosx/providers/grok.yaml
|
|
8
|
+
# 2. Set GROK_API_KEY environment variable (starts with "xai-")
|
|
9
|
+
# 3. Run: ax doctor grok
|
|
10
|
+
|
|
11
|
+
provider:
|
|
12
|
+
# Provider identification
|
|
13
|
+
name: grok
|
|
14
|
+
enabled: true
|
|
15
|
+
priority: 2
|
|
16
|
+
|
|
17
|
+
# X.AI endpoint (official Grok model)
|
|
18
|
+
baseUrl: https://api.x.ai/v1
|
|
19
|
+
apiKey: ${GROK_API_KEY} # X.AI API key (xai-...)
|
|
20
|
+
model: grok-beta # X.AI Grok model
|
|
21
|
+
|
|
22
|
+
# Performance settings (higher timeout for longer context)
|
|
23
|
+
timeout: 180000 # 3 minutes (Grok can be slower)
|
|
24
|
+
maxRetries: 3
|
|
25
|
+
|
|
26
|
+
# Rate limiting for X.AI
|
|
27
|
+
rateLimits:
|
|
28
|
+
maxRequestsPerMinute: 60
|
|
29
|
+
maxTokensPerMinute: 200000 # Higher token limit for Grok
|
|
30
|
+
maxConcurrentRequests: 5
|
|
31
|
+
|
|
32
|
+
# Circuit breaker
|
|
33
|
+
circuitBreaker:
|
|
34
|
+
failureThreshold: 3
|
|
35
|
+
resetTimeout: 60000
|
|
36
|
+
|
|
37
|
+
# Metadata
|
|
38
|
+
metadata:
|
|
39
|
+
version: "1.0.0"
|
|
40
|
+
description: "X.AI Grok configuration for reasoning and analysis"
|
|
41
|
+
tags:
|
|
42
|
+
- grok
|
|
43
|
+
- x-ai
|
|
44
|
+
- grok-beta
|
|
45
|
+
- reasoning
|
|
46
|
+
lastUpdated: "2025-11-16T00:00:00Z"
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# Grok Provider Example - Z.AI GLM 4.6 (Code-Optimized)
|
|
2
|
+
#
|
|
3
|
+
# This example demonstrates using Z.AI's GLM 4.6 model with AutomatosX.
|
|
4
|
+
# GLM 4.6 is optimized for coding tasks and technical work.
|
|
5
|
+
#
|
|
6
|
+
# Usage:
|
|
7
|
+
# 1. Copy to .automatosx/providers/grok.yaml
|
|
8
|
+
# 2. Set GROK_API_KEY environment variable
|
|
9
|
+
# 3. Run: ax doctor grok
|
|
10
|
+
|
|
11
|
+
provider:
|
|
12
|
+
# Provider identification
|
|
13
|
+
name: grok
|
|
14
|
+
enabled: true
|
|
15
|
+
priority: 2 # 1 = highest priority
|
|
16
|
+
|
|
17
|
+
# Z.AI endpoint (code-optimized model)
|
|
18
|
+
baseUrl: https://api.z.ai/api/coding/paas/v4
|
|
19
|
+
apiKey: ${GROK_API_KEY} # Reference environment variable
|
|
20
|
+
model: glm-4.6 # Code-optimized model
|
|
21
|
+
|
|
22
|
+
# Performance settings
|
|
23
|
+
timeout: 120000 # 2 minutes (suitable for most tasks)
|
|
24
|
+
maxRetries: 3 # Retry on transient failures
|
|
25
|
+
|
|
26
|
+
# Optional: Custom CLI path (if not in PATH)
|
|
27
|
+
# customPath: /usr/local/bin/grok
|
|
28
|
+
|
|
29
|
+
# Rate limiting (recommended for production)
|
|
30
|
+
rateLimits:
|
|
31
|
+
maxRequestsPerMinute: 60 # Prevent quota exhaustion
|
|
32
|
+
maxTokensPerMinute: 100000 # Token-based limiting
|
|
33
|
+
maxConcurrentRequests: 5 # Parallel request limit
|
|
34
|
+
|
|
35
|
+
# Circuit breaker (prevents cascading failures)
|
|
36
|
+
circuitBreaker:
|
|
37
|
+
failureThreshold: 3 # Open circuit after 3 failures
|
|
38
|
+
resetTimeout: 60000 # Wait 60s before retry
|
|
39
|
+
halfOpenTimeout: 30000 # Test period: 30s
|
|
40
|
+
|
|
41
|
+
# Metadata (optional, for documentation)
|
|
42
|
+
metadata:
|
|
43
|
+
version: "1.0.0"
|
|
44
|
+
description: "Z.AI GLM 4.6 configuration for coding tasks"
|
|
45
|
+
tags:
|
|
46
|
+
- grok
|
|
47
|
+
- z-ai
|
|
48
|
+
- glm-4.6
|
|
49
|
+
- code-generation
|
|
50
|
+
lastUpdated: "2025-11-16T00:00:00Z"
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
# Grok Provider Configuration
|
|
2
|
+
#
|
|
3
|
+
# AutomatosX supports two Grok endpoints:
|
|
4
|
+
# 1. X.AI Official Grok (grok-3-fast) - Default, recommended
|
|
5
|
+
# 2. Z.AI GLM 4.6 (code-optimized) - Alternative for coding tasks
|
|
6
|
+
#
|
|
7
|
+
# Setup Instructions:
|
|
8
|
+
# 1. Choose your endpoint (X.AI or Z.AI) below
|
|
9
|
+
# 2. Set your API key: export GROK_API_KEY="your-key-here"
|
|
10
|
+
# 3. Copy this file to: .automatosx/providers/grok.yaml
|
|
11
|
+
# 4. Enable in automatosx.config.json: "grok": { "enabled": true }
|
|
12
|
+
# 5. Test: ax doctor grok
|
|
13
|
+
|
|
14
|
+
provider:
|
|
15
|
+
# Provider identification
|
|
16
|
+
name: grok
|
|
17
|
+
enabled: true
|
|
18
|
+
priority: 4 # Priority (1=highest, 4=after Claude/Gemini/OpenAI)
|
|
19
|
+
|
|
20
|
+
# ====================================================================
|
|
21
|
+
# OPTION 1: X.AI Official Grok (grok-3-fast) - DEFAULT
|
|
22
|
+
# ====================================================================
|
|
23
|
+
# Fast, efficient model for general reasoning and analysis
|
|
24
|
+
baseUrl: https://api.x.ai/v1
|
|
25
|
+
apiKey: ${GROK_API_KEY} # Set via: export GROK_API_KEY="xai-..."
|
|
26
|
+
model: grok-3-fast # Fast model (recommended)
|
|
27
|
+
# Alternative models:
|
|
28
|
+
# - grok-3-fast: Fastest, lowest cost
|
|
29
|
+
# - grok-beta: Latest features, higher quality
|
|
30
|
+
# - grok-vision-beta: Image understanding
|
|
31
|
+
|
|
32
|
+
# ====================================================================
|
|
33
|
+
# OPTION 2: Z.AI GLM 4.6 (Code-Optimized) - ALTERNATIVE
|
|
34
|
+
# ====================================================================
|
|
35
|
+
# Uncomment lines below and comment out X.AI config above to use GLM 4.6
|
|
36
|
+
# baseUrl: https://api.z.ai/api/coding/paas/v4
|
|
37
|
+
# apiKey: ${GROK_API_KEY} # Set via: export GROK_API_KEY="your-z-ai-key"
|
|
38
|
+
# model: glm-4.6 # Code-optimized model
|
|
39
|
+
|
|
40
|
+
# Performance settings
|
|
41
|
+
timeout: 180000 # 3 minutes (adjust based on task complexity)
|
|
42
|
+
maxRetries: 3 # Retry on transient failures
|
|
43
|
+
|
|
44
|
+
# Optional: Custom CLI path (if grok not in PATH)
|
|
45
|
+
# customPath: /usr/local/bin/grok
|
|
46
|
+
|
|
47
|
+
# Rate limiting (prevents quota exhaustion)
|
|
48
|
+
rateLimits:
|
|
49
|
+
maxRequestsPerMinute: 60 # API rate limit
|
|
50
|
+
maxTokensPerMinute: 200000 # Token-based limiting (adjust for your plan)
|
|
51
|
+
maxConcurrentRequests: 5 # Parallel request limit
|
|
52
|
+
|
|
53
|
+
# Circuit breaker (prevents cascading failures)
|
|
54
|
+
circuitBreaker:
|
|
55
|
+
failureThreshold: 3 # Open circuit after 3 consecutive failures
|
|
56
|
+
resetTimeout: 60000 # Wait 60s before retry
|
|
57
|
+
halfOpenTimeout: 30000 # Test period: 30s
|
|
58
|
+
|
|
59
|
+
# Cost tracking (optional)
|
|
60
|
+
costs:
|
|
61
|
+
# X.AI Grok pricing (as of Nov 2024)
|
|
62
|
+
promptTokenCost: 0.000005 # $5 per 1M tokens
|
|
63
|
+
completionTokenCost: 0.000015 # $15 per 1M tokens
|
|
64
|
+
currency: USD
|
|
65
|
+
|
|
66
|
+
# Z.AI GLM 4.6 pricing - update based on your plan
|
|
67
|
+
# promptTokenCost: 0.0
|
|
68
|
+
# completionTokenCost: 0.0
|
|
69
|
+
|
|
70
|
+
# Metadata
|
|
71
|
+
metadata:
|
|
72
|
+
version: "8.3.1"
|
|
73
|
+
description: "Grok provider with X.AI (grok-3-fast) and Z.AI (glm-4.6) support"
|
|
74
|
+
tags:
|
|
75
|
+
- grok
|
|
76
|
+
- x-ai
|
|
77
|
+
- z-ai
|
|
78
|
+
- grok-3-fast
|
|
79
|
+
- glm-4.6
|
|
80
|
+
- reasoning
|
|
81
|
+
- code-generation
|
|
82
|
+
lastUpdated: "2025-11-17T01:45:00Z"
|
|
83
|
+
|
|
84
|
+
# ====================================================================
|
|
85
|
+
# Quick Start Guide
|
|
86
|
+
# ====================================================================
|
|
87
|
+
#
|
|
88
|
+
# 1. Get your API key:
|
|
89
|
+
# - X.AI: https://console.x.ai/api-keys (starts with "xai-")
|
|
90
|
+
# - Z.AI: https://z.ai/developer (your Z.AI API key)
|
|
91
|
+
#
|
|
92
|
+
# 2. Set environment variable:
|
|
93
|
+
# export GROK_API_KEY="xai-your-key-here"
|
|
94
|
+
#
|
|
95
|
+
# 3. Copy this file:
|
|
96
|
+
# cp examples/providers/grok.yaml .automatosx/providers/grok.yaml
|
|
97
|
+
#
|
|
98
|
+
# 4. Enable in config:
|
|
99
|
+
# Edit automatosx.config.json:
|
|
100
|
+
# "grok": { "enabled": true, ... }
|
|
101
|
+
#
|
|
102
|
+
# 5. Verify setup:
|
|
103
|
+
# ax doctor grok
|
|
104
|
+
# ax providers list
|
|
105
|
+
#
|
|
106
|
+
# 6. Use Grok:
|
|
107
|
+
# ax run backend "implement auth" --provider grok
|
|
108
|
+
#
|
|
109
|
+
# ====================================================================
|
|
110
|
+
# Switching Between X.AI and Z.AI
|
|
111
|
+
# ====================================================================
|
|
112
|
+
#
|
|
113
|
+
# To switch from X.AI (grok-3-fast) to Z.AI (glm-4.6):
|
|
114
|
+
# 1. Comment out X.AI config (lines 20-27)
|
|
115
|
+
# 2. Uncomment Z.AI config (lines 34-37)
|
|
116
|
+
# 3. Update GROK_API_KEY with Z.AI key
|
|
117
|
+
# 4. Restart AutomatosX: ax doctor grok
|
|
118
|
+
#
|
|
119
|
+
# To switch back: reverse the process
|
|
120
|
+
#
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@defai.digital/automatosx",
|
|
3
|
-
"version": "8.2
|
|
3
|
+
"version": "8.3.2",
|
|
4
4
|
"description": "AI Agent Orchestration Platform",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"publishConfig": {
|
|
@@ -86,7 +86,6 @@
|
|
|
86
86
|
"vitest": "^3.2.4"
|
|
87
87
|
},
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@defai.digital/automatosx": "^5.8.5",
|
|
90
89
|
"@iarna/toml": "^2.2.5",
|
|
91
90
|
"ajv": "^8.17.1",
|
|
92
91
|
"ajv-formats": "^3.0.1",
|
|
@@ -96,6 +95,7 @@
|
|
|
96
95
|
"chalk": "^5.6.2",
|
|
97
96
|
"cli-highlight": "^2.1.11",
|
|
98
97
|
"cli-table3": "^0.6.5",
|
|
98
|
+
"effect": "^3.19.3",
|
|
99
99
|
"find-up": "^8.0.0",
|
|
100
100
|
"inquirer": "^12.10.0",
|
|
101
101
|
"js-yaml": "^4.1.0",
|
|
@@ -107,7 +107,8 @@
|
|
|
107
107
|
"p-limit": "^7.2.0",
|
|
108
108
|
"sqlite-vec": "^0.1.7-alpha.2",
|
|
109
109
|
"yaml": "^2.8.1",
|
|
110
|
-
"yargs": "^18.0.0"
|
|
110
|
+
"yargs": "^18.0.0",
|
|
111
|
+
"zod": "^4.1.12"
|
|
111
112
|
},
|
|
112
113
|
"files": [
|
|
113
114
|
"dist",
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
# Provider Configuration Templates
|
|
2
|
+
|
|
3
|
+
This directory contains YAML templates for configuring AI providers in AutomatosX.
|
|
4
|
+
|
|
5
|
+
## Available Templates
|
|
6
|
+
|
|
7
|
+
### Grok Provider
|
|
8
|
+
|
|
9
|
+
**1. X.AI Official Grok** (`grok.yaml.template`)
|
|
10
|
+
- **Model**: `grok-3-fast`
|
|
11
|
+
- **Endpoint**: `https://api.x.ai/v1`
|
|
12
|
+
- **Best for**: General AI tasks, reasoning, analysis
|
|
13
|
+
- **API Key**: Get from https://x.ai/api
|
|
14
|
+
- **Cost**: Paid API (check X.AI pricing)
|
|
15
|
+
|
|
16
|
+
**2. Z.AI GLM 4.6** (`grok-zai.yaml.template`)
|
|
17
|
+
- **Model**: `glm-4.6`
|
|
18
|
+
- **Endpoint**: `https://api.z.ai/api/coding/paas/v4`
|
|
19
|
+
- **Best for**: Code generation, Chinese language support
|
|
20
|
+
- **API Key**: Get from https://z.ai
|
|
21
|
+
- **Cost**: Free tier available
|
|
22
|
+
|
|
23
|
+
## Quick Start
|
|
24
|
+
|
|
25
|
+
### Using X.AI Grok
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 1. Copy template
|
|
29
|
+
cp templates/providers/grok.yaml.template .automatosx/providers/grok.yaml
|
|
30
|
+
|
|
31
|
+
# 2. Edit the file and add your API key
|
|
32
|
+
# Replace: YOUR_X_AI_API_KEY_HERE
|
|
33
|
+
# With: xai-your-actual-api-key
|
|
34
|
+
|
|
35
|
+
# 3. Test configuration
|
|
36
|
+
ax doctor grok
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### Using Z.AI GLM 4.6
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# 1. Copy template
|
|
43
|
+
cp templates/providers/grok-zai.yaml.template .automatosx/providers/grok.yaml
|
|
44
|
+
|
|
45
|
+
# 2. Edit the file and add your API key
|
|
46
|
+
# Replace: YOUR_Z_AI_API_KEY_HERE
|
|
47
|
+
# With: your-actual-z-ai-key
|
|
48
|
+
|
|
49
|
+
# 3. Test configuration
|
|
50
|
+
ax doctor grok
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Configuration Priority
|
|
54
|
+
|
|
55
|
+
You can adjust the provider priority to control routing order:
|
|
56
|
+
|
|
57
|
+
- **Priority 1** - Highest (tried first)
|
|
58
|
+
- **Priority 2** - High
|
|
59
|
+
- **Priority 3** - Medium
|
|
60
|
+
- **Priority 4** - Low (fallback)
|
|
61
|
+
|
|
62
|
+
Example:
|
|
63
|
+
```yaml
|
|
64
|
+
provider:
|
|
65
|
+
priority: 2 # Try Grok after OpenAI but before Gemini/Claude
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Environment Variables
|
|
69
|
+
|
|
70
|
+
Instead of hardcoding API keys, use environment variables:
|
|
71
|
+
|
|
72
|
+
```yaml
|
|
73
|
+
provider:
|
|
74
|
+
apiKey: ${GROK_API_KEY}
|
|
75
|
+
baseUrl: ${GROK_BASE_URL}
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
Set environment variables:
|
|
79
|
+
```bash
|
|
80
|
+
export GROK_API_KEY="your-key"
|
|
81
|
+
export GROK_BASE_URL="https://api.x.ai/v1"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Customization
|
|
85
|
+
|
|
86
|
+
### Adjust Rate Limits
|
|
87
|
+
|
|
88
|
+
```yaml
|
|
89
|
+
rateLimits:
|
|
90
|
+
maxRequestsPerMinute: 120 # Increase for higher quota
|
|
91
|
+
maxTokensPerMinute: 400000
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### Modify Timeouts
|
|
95
|
+
|
|
96
|
+
```yaml
|
|
97
|
+
provider:
|
|
98
|
+
timeout: 300000 # 5 minutes for complex tasks
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Enable/Disable Provider
|
|
102
|
+
|
|
103
|
+
```yaml
|
|
104
|
+
provider:
|
|
105
|
+
enabled: true # or false to disable
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## Support
|
|
109
|
+
|
|
110
|
+
- **Documentation**: See [docs/providers/grok.md](../../docs/providers/grok.md)
|
|
111
|
+
- **Examples**: See [examples/providers/](../../examples/providers/)
|
|
112
|
+
- **Issues**: https://github.com/defai-digital/automatosx/issues
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
**Version**: 8.3.1
|
|
117
|
+
**Last Updated**: 2025-11-17
|