Implement secure configuration management with encryption and validation (Phase 1 improvements)

This commit is contained in:
truetype committed 2026-03-19 20:29:30 +01:00
commit d4d6aafea9
12 files changed
+1656

No files matched your search

+118
View File
@@ -0,0 +1,118 @@
# MaxClaw Agent
A configurable agent harness using DeepAgents that supports multiple LLM providers.
## Features
- **Provider Agnostic**: Works with OpenAI, Ollama, OpenRouter, and any other provider supported by LangChain's `init_chat_model`
- **Built on DeepAgents**: Includes planning, filesystem access, subagents, and context management out of the box
- **Easy Configuration**: Set environment variables to choose your provider and model
- **Persistent Configuration**: Store and manage configurations via CLI or TUI
- **Extensible**: Add custom tools, modify prompts, and configure subagents as needed
## Installation
1. Clone this repository
2. Install the required packages:
```bash
pip install -r requirements.txt
```
## Configuration
You can configure MaxClaw Agent in several ways:
### 1. Environment Variables (Quick Start)
Set the following environment variables to configure your LLM provider:
- `MODEL_PROVIDER`: The provider to use (e.g., "openai", "ollama", "openrouter")
- `MODEL_NAME`: The specific model name (e.g., "gpt-4o", "gemma2:9b")
- Provider-specific variables:
- For OpenAI: `OPENAI_API_KEY`
- For Ollama: `OLLAMA_BASE_URL` (defaults to http://localhost:11434)
- For OpenRouter: `OPENROUTER_API_KEY` and optionally `OPENROUTER_BASE_URL` (defaults to https://openrouter.ai/api/v1)
### Example Configurations
#### OpenAI
```bash
export MODEL_PROVIDER="openai"
export MODEL_NAME="gpt-4o"
export OPENAI_API_KEY="your-openai-api-key"
```
#### Ollama (local)
```bash
export MODEL_PROVIDER="ollama"
export MODEL_NAME="gemma2:9b"
export OLLAMA_BASE_URL="http://localhost:11434"
```
#### OpenRouter
```bash
export MODEL_PROVIDER="openrouter"
export MODEL_NAME="anthropic/claude-3.5-sonnet"
export OPENROUTER_API_KEY="your-openrouter-api-key"
```
### 2. Persistent Configuration (Recommended)
Use the CLI or TUI to manage configurations that persist across sessions.
#### CLI Usage
```bash
# List configurations
python config_cli.py list
# Add a new configuration interactively
python config_cli.py add
# Add a new configuration non-interactively
python config_cli.py add --name "my-ollama" --provider "ollama" --model "gemma2:9b" --base-url "https://ollama.solarpi.net" --set-active
# Remove a configuration
python config_cli.py remove "my-ollama"
# Set active configuration
python config_cli.py set-active "my-ollama"
# Show active configuration
python config_cli.py active
```
#### TUI Usage
```bash
# Launch the Text User Interface
python config_tui.py
```
Navigate using arrow keys, press Enter to select, and 'q' to quit.
## Usage
Run the agent:
```bash
python main.py
```
You can then interact with the agent in the terminal. Type 'exit' to quit.
## Customization
To customize the agent, edit `main.py`:
- Change the default system prompt in `create_maxclaw_agent`
- Add custom tools to the `create_deep_agent` call
- Configure subagents or other DeepAgents features
## Testing
Run the test script:
```bash
python test_agent.py
```
## License
MIT