hanzo-cli 0.1.0__tar.gz
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.
- hanzo_cli-0.1.0/.gitignore +16 -0
- hanzo_cli-0.1.0/PKG-INFO +338 -0
- hanzo_cli-0.1.0/README.md +286 -0
- hanzo_cli-0.1.0/pyproject.toml +104 -0
- hanzo_cli-0.1.0/src/hanzo_cli/__init__.py +6 -0
- hanzo_cli-0.1.0/src/hanzo_cli/__main__.py +6 -0
- hanzo_cli-0.1.0/src/hanzo_cli/cli.py +104 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/__init__.py +3 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/agent.py +112 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/auth.py +324 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/chat.py +183 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/cluster.py +428 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/config.py +240 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/mcp.py +235 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/miner.py +323 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/network.py +333 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/repl.py +186 -0
- hanzo_cli-0.1.0/src/hanzo_cli/commands/tools.py +335 -0
- hanzo_cli-0.1.0/src/hanzo_cli/interactive/__init__.py +3 -0
- hanzo_cli-0.1.0/src/hanzo_cli/interactive/dashboard.py +125 -0
- hanzo_cli-0.1.0/src/hanzo_cli/interactive/repl.py +185 -0
- hanzo_cli-0.1.0/src/hanzo_cli/utils/__init__.py +3 -0
- hanzo_cli-0.1.0/src/hanzo_cli/utils/config.py +170 -0
- hanzo_cli-0.1.0/src/hanzo_cli/utils/output.py +103 -0
hanzo_cli-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: hanzo-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Unified CLI for Hanzo AI - Local, Private, Free AI Infrastructure
|
|
5
|
+
Project-URL: Homepage, https://hanzo.ai
|
|
6
|
+
Project-URL: Repository, https://github.com/hanzoai/python-sdk
|
|
7
|
+
Project-URL: Documentation, https://docs.hanzo.ai/cli
|
|
8
|
+
Project-URL: Changelog, https://github.com/hanzoai/python-sdk/blob/main/pkg/hanzo-cli/CHANGELOG.md
|
|
9
|
+
Project-URL: Bug Tracker, https://github.com/hanzoai/python-sdk/issues
|
|
10
|
+
Author-email: Hanzo AI <dev@hanzo.ai>
|
|
11
|
+
Keywords: agents,ai,cli,hanzo,llm,local-ai,mcp,private-ai
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
23
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
24
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
25
|
+
Requires-Python: >=3.8
|
|
26
|
+
Requires-Dist: click>=8.1.0
|
|
27
|
+
Requires-Dist: httpx>=0.23.0
|
|
28
|
+
Requires-Dist: prompt-toolkit>=3.0.0
|
|
29
|
+
Requires-Dist: pydantic>=2.0.0
|
|
30
|
+
Requires-Dist: pyyaml>=6.0
|
|
31
|
+
Requires-Dist: rich>=13.0.0
|
|
32
|
+
Requires-Dist: typer>=0.9.0
|
|
33
|
+
Provides-Extra: all
|
|
34
|
+
Requires-Dist: hanzo-a2a>=0.1.0; extra == 'all'
|
|
35
|
+
Requires-Dist: hanzo-agents>=0.1.0; extra == 'all'
|
|
36
|
+
Requires-Dist: hanzo-cluster>=0.1.0; extra == 'all'
|
|
37
|
+
Requires-Dist: hanzo-mcp>=0.1.0; extra == 'all'
|
|
38
|
+
Requires-Dist: hanzo-miner>=0.1.0; extra == 'all'
|
|
39
|
+
Requires-Dist: hanzo-network>=0.1.0; extra == 'all'
|
|
40
|
+
Requires-Dist: hanzo-repl>=0.1.0; extra == 'all'
|
|
41
|
+
Requires-Dist: hanzoai>=1.0.0; extra == 'all'
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: black>=23.0.0; extra == 'dev'
|
|
44
|
+
Requires-Dist: mypy>=1.0.0; extra == 'dev'
|
|
45
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
|
|
46
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
47
|
+
Requires-Dist: pytest>=7.0.0; extra == 'dev'
|
|
48
|
+
Requires-Dist: ruff>=0.1.0; extra == 'dev'
|
|
49
|
+
Provides-Extra: repl
|
|
50
|
+
Requires-Dist: hanzo-repl>=0.1.0; extra == 'repl'
|
|
51
|
+
Description-Content-Type: text/markdown
|
|
52
|
+
|
|
53
|
+
# Hanzo CLI
|
|
54
|
+
|
|
55
|
+
Unified command-line interface for Hanzo AI - Local, Private, Free AI Infrastructure.
|
|
56
|
+
|
|
57
|
+
## Features
|
|
58
|
+
|
|
59
|
+
- 🤖 **AI Chat** - Interactive chat with multiple LLM providers
|
|
60
|
+
- 🛠️ **MCP Tools** - Access to 70+ Model Context Protocol tools
|
|
61
|
+
- 🌐 **Agent Networks** - Distributed AI agent orchestration
|
|
62
|
+
- ⛏️ **Mining** - Contribute compute and earn rewards
|
|
63
|
+
- 🔐 **Authentication** - Secure access with Hanzo IAM
|
|
64
|
+
- 📊 **Monitoring** - Real-time cluster and agent status
|
|
65
|
+
- 🎨 **Beautiful UI** - Rich terminal interface with syntax highlighting
|
|
66
|
+
|
|
67
|
+
## Installation
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Basic installation
|
|
71
|
+
pip install hanzo
|
|
72
|
+
|
|
73
|
+
# With all features
|
|
74
|
+
pip install hanzo[all]
|
|
75
|
+
|
|
76
|
+
# With specific features
|
|
77
|
+
pip install hanzo[repl] # Interactive REPL
|
|
78
|
+
pip install hanzo[cluster] # Local AI cluster
|
|
79
|
+
pip install hanzo[network] # Agent networks
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
## Quick Start
|
|
83
|
+
|
|
84
|
+
### Authentication
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Login with email/password
|
|
88
|
+
hanzo auth login
|
|
89
|
+
|
|
90
|
+
# Use API key
|
|
91
|
+
export HANZO_API_KEY=your-key
|
|
92
|
+
hanzo auth status
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
### AI Chat
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
# Interactive chat
|
|
99
|
+
hanzo chat
|
|
100
|
+
|
|
101
|
+
# Quick question
|
|
102
|
+
hanzo ask "What is the capital of France?"
|
|
103
|
+
|
|
104
|
+
# With specific model
|
|
105
|
+
hanzo chat --model claude-3.5-sonnet
|
|
106
|
+
|
|
107
|
+
# Start REPL (like Claude Code)
|
|
108
|
+
hanzo chat --repl
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
### Local AI Cluster
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Start local cluster
|
|
115
|
+
hanzo serve
|
|
116
|
+
|
|
117
|
+
# Or with options
|
|
118
|
+
hanzo cluster start --models llama-3.2-3b --port 8000
|
|
119
|
+
|
|
120
|
+
# Check status
|
|
121
|
+
hanzo cluster status
|
|
122
|
+
|
|
123
|
+
# Start as node
|
|
124
|
+
hanzo cluster node start --blockchain --network
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### MCP Tools
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# List available tools
|
|
131
|
+
hanzo mcp tools
|
|
132
|
+
|
|
133
|
+
# Run a tool
|
|
134
|
+
hanzo mcp run read_file --arg file_path=README.md
|
|
135
|
+
|
|
136
|
+
# Start MCP server
|
|
137
|
+
hanzo mcp serve
|
|
138
|
+
|
|
139
|
+
# Install in Claude Desktop
|
|
140
|
+
hanzo mcp install
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### Agent Networks
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
# Dispatch work to network
|
|
147
|
+
hanzo network dispatch "Analyze this codebase and suggest improvements"
|
|
148
|
+
|
|
149
|
+
# Start local swarm
|
|
150
|
+
hanzo network swarm --agents 5
|
|
151
|
+
|
|
152
|
+
# List available agents
|
|
153
|
+
hanzo network agents
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Mining
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
# Start mining
|
|
160
|
+
hanzo miner start --wallet 0x... --models llama-3.2-3b
|
|
161
|
+
|
|
162
|
+
# Check earnings
|
|
163
|
+
hanzo miner earnings --wallet 0x...
|
|
164
|
+
|
|
165
|
+
# View leaderboard
|
|
166
|
+
hanzo miner leaderboard
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
## Configuration
|
|
170
|
+
|
|
171
|
+
### Environment Variables
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
# API Keys
|
|
175
|
+
export HANZO_API_KEY=your-hanzo-key
|
|
176
|
+
export ANTHROPIC_API_KEY=your-anthropic-key
|
|
177
|
+
export OPENAI_API_KEY=your-openai-key
|
|
178
|
+
|
|
179
|
+
# Preferences
|
|
180
|
+
export HANZO_DEFAULT_MODEL=claude-3.5-sonnet
|
|
181
|
+
export HANZO_USE_LOCAL=true
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
### Configuration File
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
# Initialize config
|
|
188
|
+
hanzo config init
|
|
189
|
+
|
|
190
|
+
# Set values
|
|
191
|
+
hanzo config set default_model claude-3.5-sonnet
|
|
192
|
+
hanzo config set mcp.allowed_paths /home/user/projects
|
|
193
|
+
|
|
194
|
+
# View config
|
|
195
|
+
hanzo config show
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Advanced Usage
|
|
199
|
+
|
|
200
|
+
### Interactive REPL
|
|
201
|
+
|
|
202
|
+
The REPL provides direct access to all MCP tools and AI capabilities:
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# Start REPL
|
|
206
|
+
hanzo repl start
|
|
207
|
+
|
|
208
|
+
# With IPython interface
|
|
209
|
+
hanzo repl start --ipython
|
|
210
|
+
|
|
211
|
+
# With TUI interface
|
|
212
|
+
hanzo repl start --tui
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
In the REPL:
|
|
216
|
+
```python
|
|
217
|
+
# Direct tool access
|
|
218
|
+
>>> read_file(file_path="config.json")
|
|
219
|
+
>>> search(query="TODO", path=".")
|
|
220
|
+
|
|
221
|
+
# Chat with AI
|
|
222
|
+
>>> chat("Create a FastAPI server with authentication")
|
|
223
|
+
|
|
224
|
+
# AI uses tools automatically
|
|
225
|
+
>>> chat("Find all Python files and create a dependency graph")
|
|
226
|
+
```
|
|
227
|
+
|
|
228
|
+
### Tool Management
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
# Install custom tools
|
|
232
|
+
hanzo tools install my-tool
|
|
233
|
+
|
|
234
|
+
# Create new tool
|
|
235
|
+
hanzo tools create my-custom-tool
|
|
236
|
+
|
|
237
|
+
# List installed tools
|
|
238
|
+
hanzo tools list --installed
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Dashboard
|
|
242
|
+
|
|
243
|
+
```bash
|
|
244
|
+
# Start interactive dashboard
|
|
245
|
+
hanzo dashboard
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
## Command Reference
|
|
249
|
+
|
|
250
|
+
### Main Commands
|
|
251
|
+
|
|
252
|
+
- `hanzo auth` - Authentication management
|
|
253
|
+
- `hanzo chat` - Interactive AI chat
|
|
254
|
+
- `hanzo cluster` - Local AI cluster management
|
|
255
|
+
- `hanzo mcp` - Model Context Protocol tools
|
|
256
|
+
- `hanzo agent` - Agent management
|
|
257
|
+
- `hanzo network` - Agent network operations
|
|
258
|
+
- `hanzo miner` - Mining operations
|
|
259
|
+
- `hanzo tools` - Tool management
|
|
260
|
+
- `hanzo config` - Configuration management
|
|
261
|
+
- `hanzo repl` - Interactive REPL
|
|
262
|
+
|
|
263
|
+
### Quick Aliases
|
|
264
|
+
|
|
265
|
+
- `hanzo ask <question>` - Quick AI question
|
|
266
|
+
- `hanzo serve` - Start local cluster
|
|
267
|
+
- `hanzo dashboard` - Open dashboard
|
|
268
|
+
|
|
269
|
+
## Examples
|
|
270
|
+
|
|
271
|
+
### Complex Workflows
|
|
272
|
+
|
|
273
|
+
```bash
|
|
274
|
+
# Analyze project and create documentation
|
|
275
|
+
hanzo network dispatch "Analyze this Python project and create comprehensive documentation" --agents 3
|
|
276
|
+
|
|
277
|
+
# Start mining with specific configuration
|
|
278
|
+
hanzo miner start --wallet 0x123... --models "llama-3.2-3b,mistral-7b" --min-stake 100
|
|
279
|
+
|
|
280
|
+
# Create and deploy an agent
|
|
281
|
+
hanzo agent create researcher --model gpt-4
|
|
282
|
+
hanzo agent start researcher --task "Research best practices for API security"
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
### Integration with Other Tools
|
|
286
|
+
|
|
287
|
+
```bash
|
|
288
|
+
# Use with pipes
|
|
289
|
+
echo "Explain this error" | hanzo chat --once
|
|
290
|
+
|
|
291
|
+
# Process files
|
|
292
|
+
find . -name "*.py" | xargs hanzo mcp run analyze_code
|
|
293
|
+
|
|
294
|
+
# Combine with jq
|
|
295
|
+
hanzo network jobs --json | jq '.[] | select(.status=="completed")'
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
## Troubleshooting
|
|
299
|
+
|
|
300
|
+
### Common Issues
|
|
301
|
+
|
|
302
|
+
1. **No LLM provider configured**
|
|
303
|
+
```bash
|
|
304
|
+
export ANTHROPIC_API_KEY=your-key
|
|
305
|
+
# or
|
|
306
|
+
hanzo auth login
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
2. **Local cluster not running**
|
|
310
|
+
```bash
|
|
311
|
+
hanzo cluster start
|
|
312
|
+
# or
|
|
313
|
+
hanzo serve
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
3. **Permission denied for MCP tools**
|
|
317
|
+
```bash
|
|
318
|
+
hanzo config set mcp.allowed_paths /path/to/allow
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
### Debug Mode
|
|
322
|
+
|
|
323
|
+
```bash
|
|
324
|
+
# Enable debug output
|
|
325
|
+
export HANZO_DEBUG=true
|
|
326
|
+
hanzo chat
|
|
327
|
+
|
|
328
|
+
# Verbose logging
|
|
329
|
+
hanzo --verbose chat
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
## Contributing
|
|
333
|
+
|
|
334
|
+
See the main [Hanzo Python SDK](https://github.com/hanzoai/python-sdk) repository.
|
|
335
|
+
|
|
336
|
+
## License
|
|
337
|
+
|
|
338
|
+
BSD-3-Clause - see LICENSE file for details.
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
# Hanzo CLI
|
|
2
|
+
|
|
3
|
+
Unified command-line interface for Hanzo AI - Local, Private, Free AI Infrastructure.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- 🤖 **AI Chat** - Interactive chat with multiple LLM providers
|
|
8
|
+
- 🛠️ **MCP Tools** - Access to 70+ Model Context Protocol tools
|
|
9
|
+
- 🌐 **Agent Networks** - Distributed AI agent orchestration
|
|
10
|
+
- ⛏️ **Mining** - Contribute compute and earn rewards
|
|
11
|
+
- 🔐 **Authentication** - Secure access with Hanzo IAM
|
|
12
|
+
- 📊 **Monitoring** - Real-time cluster and agent status
|
|
13
|
+
- 🎨 **Beautiful UI** - Rich terminal interface with syntax highlighting
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Basic installation
|
|
19
|
+
pip install hanzo
|
|
20
|
+
|
|
21
|
+
# With all features
|
|
22
|
+
pip install hanzo[all]
|
|
23
|
+
|
|
24
|
+
# With specific features
|
|
25
|
+
pip install hanzo[repl] # Interactive REPL
|
|
26
|
+
pip install hanzo[cluster] # Local AI cluster
|
|
27
|
+
pip install hanzo[network] # Agent networks
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
### Authentication
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
# Login with email/password
|
|
36
|
+
hanzo auth login
|
|
37
|
+
|
|
38
|
+
# Use API key
|
|
39
|
+
export HANZO_API_KEY=your-key
|
|
40
|
+
hanzo auth status
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### AI Chat
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# Interactive chat
|
|
47
|
+
hanzo chat
|
|
48
|
+
|
|
49
|
+
# Quick question
|
|
50
|
+
hanzo ask "What is the capital of France?"
|
|
51
|
+
|
|
52
|
+
# With specific model
|
|
53
|
+
hanzo chat --model claude-3.5-sonnet
|
|
54
|
+
|
|
55
|
+
# Start REPL (like Claude Code)
|
|
56
|
+
hanzo chat --repl
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Local AI Cluster
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
# Start local cluster
|
|
63
|
+
hanzo serve
|
|
64
|
+
|
|
65
|
+
# Or with options
|
|
66
|
+
hanzo cluster start --models llama-3.2-3b --port 8000
|
|
67
|
+
|
|
68
|
+
# Check status
|
|
69
|
+
hanzo cluster status
|
|
70
|
+
|
|
71
|
+
# Start as node
|
|
72
|
+
hanzo cluster node start --blockchain --network
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### MCP Tools
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# List available tools
|
|
79
|
+
hanzo mcp tools
|
|
80
|
+
|
|
81
|
+
# Run a tool
|
|
82
|
+
hanzo mcp run read_file --arg file_path=README.md
|
|
83
|
+
|
|
84
|
+
# Start MCP server
|
|
85
|
+
hanzo mcp serve
|
|
86
|
+
|
|
87
|
+
# Install in Claude Desktop
|
|
88
|
+
hanzo mcp install
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Agent Networks
|
|
92
|
+
|
|
93
|
+
```bash
|
|
94
|
+
# Dispatch work to network
|
|
95
|
+
hanzo network dispatch "Analyze this codebase and suggest improvements"
|
|
96
|
+
|
|
97
|
+
# Start local swarm
|
|
98
|
+
hanzo network swarm --agents 5
|
|
99
|
+
|
|
100
|
+
# List available agents
|
|
101
|
+
hanzo network agents
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Mining
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
# Start mining
|
|
108
|
+
hanzo miner start --wallet 0x... --models llama-3.2-3b
|
|
109
|
+
|
|
110
|
+
# Check earnings
|
|
111
|
+
hanzo miner earnings --wallet 0x...
|
|
112
|
+
|
|
113
|
+
# View leaderboard
|
|
114
|
+
hanzo miner leaderboard
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Configuration
|
|
118
|
+
|
|
119
|
+
### Environment Variables
|
|
120
|
+
|
|
121
|
+
```bash
|
|
122
|
+
# API Keys
|
|
123
|
+
export HANZO_API_KEY=your-hanzo-key
|
|
124
|
+
export ANTHROPIC_API_KEY=your-anthropic-key
|
|
125
|
+
export OPENAI_API_KEY=your-openai-key
|
|
126
|
+
|
|
127
|
+
# Preferences
|
|
128
|
+
export HANZO_DEFAULT_MODEL=claude-3.5-sonnet
|
|
129
|
+
export HANZO_USE_LOCAL=true
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Configuration File
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
# Initialize config
|
|
136
|
+
hanzo config init
|
|
137
|
+
|
|
138
|
+
# Set values
|
|
139
|
+
hanzo config set default_model claude-3.5-sonnet
|
|
140
|
+
hanzo config set mcp.allowed_paths /home/user/projects
|
|
141
|
+
|
|
142
|
+
# View config
|
|
143
|
+
hanzo config show
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
## Advanced Usage
|
|
147
|
+
|
|
148
|
+
### Interactive REPL
|
|
149
|
+
|
|
150
|
+
The REPL provides direct access to all MCP tools and AI capabilities:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Start REPL
|
|
154
|
+
hanzo repl start
|
|
155
|
+
|
|
156
|
+
# With IPython interface
|
|
157
|
+
hanzo repl start --ipython
|
|
158
|
+
|
|
159
|
+
# With TUI interface
|
|
160
|
+
hanzo repl start --tui
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
In the REPL:
|
|
164
|
+
```python
|
|
165
|
+
# Direct tool access
|
|
166
|
+
>>> read_file(file_path="config.json")
|
|
167
|
+
>>> search(query="TODO", path=".")
|
|
168
|
+
|
|
169
|
+
# Chat with AI
|
|
170
|
+
>>> chat("Create a FastAPI server with authentication")
|
|
171
|
+
|
|
172
|
+
# AI uses tools automatically
|
|
173
|
+
>>> chat("Find all Python files and create a dependency graph")
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Tool Management
|
|
177
|
+
|
|
178
|
+
```bash
|
|
179
|
+
# Install custom tools
|
|
180
|
+
hanzo tools install my-tool
|
|
181
|
+
|
|
182
|
+
# Create new tool
|
|
183
|
+
hanzo tools create my-custom-tool
|
|
184
|
+
|
|
185
|
+
# List installed tools
|
|
186
|
+
hanzo tools list --installed
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Dashboard
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Start interactive dashboard
|
|
193
|
+
hanzo dashboard
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
## Command Reference
|
|
197
|
+
|
|
198
|
+
### Main Commands
|
|
199
|
+
|
|
200
|
+
- `hanzo auth` - Authentication management
|
|
201
|
+
- `hanzo chat` - Interactive AI chat
|
|
202
|
+
- `hanzo cluster` - Local AI cluster management
|
|
203
|
+
- `hanzo mcp` - Model Context Protocol tools
|
|
204
|
+
- `hanzo agent` - Agent management
|
|
205
|
+
- `hanzo network` - Agent network operations
|
|
206
|
+
- `hanzo miner` - Mining operations
|
|
207
|
+
- `hanzo tools` - Tool management
|
|
208
|
+
- `hanzo config` - Configuration management
|
|
209
|
+
- `hanzo repl` - Interactive REPL
|
|
210
|
+
|
|
211
|
+
### Quick Aliases
|
|
212
|
+
|
|
213
|
+
- `hanzo ask <question>` - Quick AI question
|
|
214
|
+
- `hanzo serve` - Start local cluster
|
|
215
|
+
- `hanzo dashboard` - Open dashboard
|
|
216
|
+
|
|
217
|
+
## Examples
|
|
218
|
+
|
|
219
|
+
### Complex Workflows
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
# Analyze project and create documentation
|
|
223
|
+
hanzo network dispatch "Analyze this Python project and create comprehensive documentation" --agents 3
|
|
224
|
+
|
|
225
|
+
# Start mining with specific configuration
|
|
226
|
+
hanzo miner start --wallet 0x123... --models "llama-3.2-3b,mistral-7b" --min-stake 100
|
|
227
|
+
|
|
228
|
+
# Create and deploy an agent
|
|
229
|
+
hanzo agent create researcher --model gpt-4
|
|
230
|
+
hanzo agent start researcher --task "Research best practices for API security"
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
### Integration with Other Tools
|
|
234
|
+
|
|
235
|
+
```bash
|
|
236
|
+
# Use with pipes
|
|
237
|
+
echo "Explain this error" | hanzo chat --once
|
|
238
|
+
|
|
239
|
+
# Process files
|
|
240
|
+
find . -name "*.py" | xargs hanzo mcp run analyze_code
|
|
241
|
+
|
|
242
|
+
# Combine with jq
|
|
243
|
+
hanzo network jobs --json | jq '.[] | select(.status=="completed")'
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Troubleshooting
|
|
247
|
+
|
|
248
|
+
### Common Issues
|
|
249
|
+
|
|
250
|
+
1. **No LLM provider configured**
|
|
251
|
+
```bash
|
|
252
|
+
export ANTHROPIC_API_KEY=your-key
|
|
253
|
+
# or
|
|
254
|
+
hanzo auth login
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
2. **Local cluster not running**
|
|
258
|
+
```bash
|
|
259
|
+
hanzo cluster start
|
|
260
|
+
# or
|
|
261
|
+
hanzo serve
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
3. **Permission denied for MCP tools**
|
|
265
|
+
```bash
|
|
266
|
+
hanzo config set mcp.allowed_paths /path/to/allow
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Debug Mode
|
|
270
|
+
|
|
271
|
+
```bash
|
|
272
|
+
# Enable debug output
|
|
273
|
+
export HANZO_DEBUG=true
|
|
274
|
+
hanzo chat
|
|
275
|
+
|
|
276
|
+
# Verbose logging
|
|
277
|
+
hanzo --verbose chat
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
## Contributing
|
|
281
|
+
|
|
282
|
+
See the main [Hanzo Python SDK](https://github.com/hanzoai/python-sdk) repository.
|
|
283
|
+
|
|
284
|
+
## License
|
|
285
|
+
|
|
286
|
+
BSD-3-Clause - see LICENSE file for details.
|