# Hanzo REPL
Interactive REPL for Hanzo AI - Like Claude Code in your terminal.
## Features
- 🎯 **Direct MCP Access**: All 70+ MCP tools available as Python functions
- 💬 **Integrated Chat**: Chat with AI that can use MCP tools
- 🔧 **IPython Magic**: Advanced features with tab completion and magic commands
- 🎨 **Beautiful TUI**: Textual-based terminal UI with syntax highlighting
- 🔄 **Live Editing**: Edit code and see results immediately
- 🎤 **Voice Mode**: Speak to AI and hear responses (optional)
## Quick Start
```bash
# Install
pip install hanzo-repl
# Start interactive REPL (recommended)
hanzo-repl
# Start IPython REPL (advanced)
hanzo-repl-ipython
# Start TUI mode (beautiful interface)
hanzo-repl-tui
```
## Usage
### Basic CLI Usage
The REPL integrates seamlessly with the Hanzo CLI:
```bash
# Interactive chat mode
hanzo chat
# Quick questions
hanzo ask "What files are in the current directory?"
# With specific model
hanzo ask "Explain this code" --model claude-3-opus
```
### REPL Commands
```python
# Direct tool access
>>> read_file(file_path="README.md")
>>> write_file(file_path="test.py", content="print('Hello')")
>>> search(query="def main", path=".")
# Chat with AI
>>> chat("Create a Python script that fetches weather data")
# AI will use tools automatically
>>> chat("Find all TODO comments in the codebase and create a summary")
```
### IPython Magic Commands
```python
# Quick chat
%chat What is 2+2?
# Multi-line chat
%%ai
Help me refactor this function to be more efficient.
It should handle edge cases better.
# List tools
%tools
# Change model
%model claude-3.5-sonnet
# Execute tool
%tool read_file {"file_path": "config.json"}
```
### TUI Mode Features
- **Split panes**: Code editor, chat, and output
- **Syntax highlighting**: Full language support
- **Tool palette**: Visual tool selection
- **History**: Navigate previous commands
- **Themes**: Dark/light mode support
## Environment Setup
Set at least one LLM provider:
```bash
export ANTHROPIC_API_KEY=your-key # For Claude
export OPENAI_API_KEY=your-key # For GPT
export HANZO_API_KEY=your-key # For Hanzo AI
```
## Advanced Features
### Voice Mode
Install voice dependencies:
```bash
pip install hanzo-repl[voice]
```
Enable in REPL:
```python
>>> enable_voice()
>>> chat("Hello") # Speak your message
```
### Custom Tools
Create custom tools on the fly:
```python
@register_tool
def my_tool(param: str) -> str:
"""My custom tool."""
return f"Processed: {param}"
# Now available to AI
>>> chat("Use my_tool to process 'hello'")
```
### Scripting
Use the REPL in scripts:
```python
from hanzo_repl import create_repl
async def main():
repl = create_repl()
result = await repl.chat("Analyze the project structure")
print(result)
```
## Integration with Hanzo Ecosystem
### With Hanzo MCP
All MCP tools are automatically available:
- File operations
- Code search and analysis
- Process management
- Git operations
- And 60+ more tools
### With Hanzo Agents
Create and manage agents:
```python
>>> agent = create_agent("researcher")
>>> agent.run("Research best practices for API design")
```
### With Hanzo Network
Dispatch to agent networks:
```python
>>> network.dispatch("Solve this problem", agents=5)
```
## Tips
1. **Tab Completion**: Use Tab to explore available tools and parameters
2. **Help System**: Use `?` after any function for documentation
3. **History**: Use up/down arrows to navigate command history
4. **Shortcuts**: Ctrl+R for reverse search, Ctrl+L to clear screen
5. **Output**: Results are automatically pretty-printed with Rich
## Troubleshooting
### No LLM Response
Ensure you have set API keys:
```bash
echo $ANTHROPIC_API_KEY # Should show your key
```
### Tool Errors
Check tool permissions:
```python
>>> mcp.get_allowed_paths()
>>> mcp.add_allowed_path("/path/to/allow")
```
### Performance
For better performance:
```python
>>> set_model("gpt-3.5-turbo") # Faster model
>>> set_streaming(True) # Stream responses
```
## Contributing
The REPL is part of the Hanzo Python SDK. See the main repository for contribution guidelines.
## License
BSD-3-Clause - see LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "hanzo-repl",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.8",
"maintainer_email": null,
"keywords": "ai, claude, hanzo, interactive, llm, mcp, repl",
"author": null,
"author_email": "Hanzo AI <dev@hanzo.ai>",
"download_url": "https://files.pythonhosted.org/packages/d0/43/d60769f9eb5e46030f8072327bffe03cc968edfe238e86f4a26afb7853b2/hanzo_repl-0.1.0.tar.gz",
"platform": null,
"description": "# Hanzo REPL\n\nInteractive REPL for Hanzo AI - Like Claude Code in your terminal.\n\n## Features\n\n- \ud83c\udfaf **Direct MCP Access**: All 70+ MCP tools available as Python functions\n- \ud83d\udcac **Integrated Chat**: Chat with AI that can use MCP tools\n- \ud83d\udd27 **IPython Magic**: Advanced features with tab completion and magic commands\n- \ud83c\udfa8 **Beautiful TUI**: Textual-based terminal UI with syntax highlighting\n- \ud83d\udd04 **Live Editing**: Edit code and see results immediately\n- \ud83c\udfa4 **Voice Mode**: Speak to AI and hear responses (optional)\n\n## Quick Start\n\n```bash\n# Install\npip install hanzo-repl\n\n# Start interactive REPL (recommended)\nhanzo-repl\n\n# Start IPython REPL (advanced)\nhanzo-repl-ipython\n\n# Start TUI mode (beautiful interface)\nhanzo-repl-tui\n```\n\n## Usage\n\n### Basic CLI Usage\n\nThe REPL integrates seamlessly with the Hanzo CLI:\n\n```bash\n# Interactive chat mode\nhanzo chat\n\n# Quick questions\nhanzo ask \"What files are in the current directory?\"\n\n# With specific model\nhanzo ask \"Explain this code\" --model claude-3-opus\n```\n\n### REPL Commands\n\n```python\n# Direct tool access\n>>> read_file(file_path=\"README.md\")\n>>> write_file(file_path=\"test.py\", content=\"print('Hello')\")\n>>> search(query=\"def main\", path=\".\")\n\n# Chat with AI\n>>> chat(\"Create a Python script that fetches weather data\")\n\n# AI will use tools automatically\n>>> chat(\"Find all TODO comments in the codebase and create a summary\")\n```\n\n### IPython Magic Commands\n\n```python\n# Quick chat\n%chat What is 2+2?\n\n# Multi-line chat\n%%ai\nHelp me refactor this function to be more efficient.\nIt should handle edge cases better.\n\n# List tools\n%tools\n\n# Change model\n%model claude-3.5-sonnet\n\n# Execute tool\n%tool read_file {\"file_path\": \"config.json\"}\n```\n\n### TUI Mode Features\n\n- **Split panes**: Code editor, chat, and output\n- **Syntax highlighting**: Full language support\n- **Tool palette**: Visual tool selection\n- **History**: Navigate previous commands\n- **Themes**: Dark/light mode support\n\n## Environment Setup\n\nSet at least one LLM provider:\n\n```bash\nexport ANTHROPIC_API_KEY=your-key # For Claude\nexport OPENAI_API_KEY=your-key # For GPT\nexport HANZO_API_KEY=your-key # For Hanzo AI\n```\n\n## Advanced Features\n\n### Voice Mode\n\nInstall voice dependencies:\n\n```bash\npip install hanzo-repl[voice]\n```\n\nEnable in REPL:\n\n```python\n>>> enable_voice()\n>>> chat(\"Hello\") # Speak your message\n```\n\n### Custom Tools\n\nCreate custom tools on the fly:\n\n```python\n@register_tool\ndef my_tool(param: str) -> str:\n \"\"\"My custom tool.\"\"\"\n return f\"Processed: {param}\"\n\n# Now available to AI\n>>> chat(\"Use my_tool to process 'hello'\")\n```\n\n### Scripting\n\nUse the REPL in scripts:\n\n```python\nfrom hanzo_repl import create_repl\n\nasync def main():\n repl = create_repl()\n result = await repl.chat(\"Analyze the project structure\")\n print(result)\n```\n\n## Integration with Hanzo Ecosystem\n\n### With Hanzo MCP\n\nAll MCP tools are automatically available:\n\n- File operations\n- Code search and analysis\n- Process management\n- Git operations\n- And 60+ more tools\n\n### With Hanzo Agents\n\nCreate and manage agents:\n\n```python\n>>> agent = create_agent(\"researcher\")\n>>> agent.run(\"Research best practices for API design\")\n```\n\n### With Hanzo Network\n\nDispatch to agent networks:\n\n```python\n>>> network.dispatch(\"Solve this problem\", agents=5)\n```\n\n## Tips\n\n1. **Tab Completion**: Use Tab to explore available tools and parameters\n2. **Help System**: Use `?` after any function for documentation\n3. **History**: Use up/down arrows to navigate command history\n4. **Shortcuts**: Ctrl+R for reverse search, Ctrl+L to clear screen\n5. **Output**: Results are automatically pretty-printed with Rich\n\n## Troubleshooting\n\n### No LLM Response\n\nEnsure you have set API keys:\n\n```bash\necho $ANTHROPIC_API_KEY # Should show your key\n```\n\n### Tool Errors\n\nCheck tool permissions:\n\n```python\n>>> mcp.get_allowed_paths()\n>>> mcp.add_allowed_path(\"/path/to/allow\")\n```\n\n### Performance\n\nFor better performance:\n\n```python\n>>> set_model(\"gpt-3.5-turbo\") # Faster model\n>>> set_streaming(True) # Stream responses\n```\n\n## Contributing\n\nThe REPL is part of the Hanzo Python SDK. See the main repository for contribution guidelines.\n\n## License\n\nBSD-3-Clause - see LICENSE file for details.",
"bugtrack_url": null,
"license": "BSD-3-Clause",
"summary": "Interactive REPL for Hanzo AI - Like Claude Code in your terminal",
"version": "0.1.0",
"project_urls": {
"Documentation": "https://docs.hanzo.ai/repl",
"Homepage": "https://hanzo.ai",
"Issues": "https://github.com/hanzoai/python-sdk/issues",
"Repository": "https://github.com/hanzoai/python-sdk"
},
"split_keywords": [
"ai",
" claude",
" hanzo",
" interactive",
" llm",
" mcp",
" repl"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "57bc4d85d24c2b7f5e965962e0e66ce66bd8ad21ea0eaec2aa025d1e8f7f1099",
"md5": "7ef28cf8f281c3c178af90036cc38f2d",
"sha256": "198e639c18a7239e174adfe2d290212791aeb730b892a54f8f05e9c7829576ed"
},
"downloads": -1,
"filename": "hanzo_repl-0.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "7ef28cf8f281c3c178af90036cc38f2d",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.8",
"size": 35121,
"upload_time": "2025-07-26T02:48:40",
"upload_time_iso_8601": "2025-07-26T02:48:40.739379Z",
"url": "https://files.pythonhosted.org/packages/57/bc/4d85d24c2b7f5e965962e0e66ce66bd8ad21ea0eaec2aa025d1e8f7f1099/hanzo_repl-0.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "d043d60769f9eb5e46030f8072327bffe03cc968edfe238e86f4a26afb7853b2",
"md5": "1e172889217aa89d67cfb883f73f4d20",
"sha256": "4fed8869b2ebb2c9f808dd83e2f4b03f2f4ccc0427225decef6be3d8bfec7538"
},
"downloads": -1,
"filename": "hanzo_repl-0.1.0.tar.gz",
"has_sig": false,
"md5_digest": "1e172889217aa89d67cfb883f73f4d20",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.8",
"size": 29020,
"upload_time": "2025-07-26T02:48:42",
"upload_time_iso_8601": "2025-07-26T02:48:42.120027Z",
"url": "https://files.pythonhosted.org/packages/d0/43/d60769f9eb5e46030f8072327bffe03cc968edfe238e86f4a26afb7853b2/hanzo_repl-0.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-26 02:48:42",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "hanzoai",
"github_project": "python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "hanzo-repl"
}