Phase 3: Unified provider tools system for all LLM providers

This commit is contained in:
truetype committed 2026-03-20 17:45:03 +01:00
1 parent 9f3298fa13
commit aba2fc11f4
4 files changed
+735 -19

No files matched your search

+28 -12
View File
@@ -2,7 +2,7 @@
"""
MaxClaw Agent - A configurable agent harness using DeepAgents
Supports multiple LLM providers via LangChain's init_chat_model
Enhanced with custom tools for Proxmox and Ollama management
Enhanced with unified provider tools and custom tools
"""
import os
import sys
@@ -14,7 +14,8 @@ from langchain.tools import Tool
# Import custom tools
try:
from tools import get_proxmox_tools, get_ollama_tools
from tools import get_proxmox_tools
from tools.provider_tools import get_provider_tools, get_all_provider_tools
TOOLS_AVAILABLE = True
except ImportError:
TOOLS_AVAILABLE = False
@@ -94,14 +95,13 @@ def get_custom_tools() -> List[Tool]:
except Exception as e:
print(f"⚠️ Could not load Proxmox tools: {e}")
# Add Ollama tools if configured
ollama_url = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434")
# Add unified provider tools for all configured providers
try:
ollama_tools = get_ollama_tools(base_url=ollama_url)
custom_tools.extend(ollama_tools)
print(f"✅ Added {len(ollama_tools)} Ollama tools")
provider_tools = get_all_provider_tools()
custom_tools.extend(provider_tools)
print(f"✅ Added {len(provider_tools)} provider tools")
except Exception as e:
print(f"⚠️ Could not load Ollama tools: {e}")
print(f"⚠️ Could not load provider tools: {e}")
return custom_tools
@@ -115,8 +115,15 @@ def create_maxclaw_agent(system_prompt: Optional[str] = None):
manage context, and delegate to subagents. You are designed to be configurable
to work with various LLM providers.
You have access to custom tools for managing Proxmox virtual machines and Ollama models.
Use these tools when asked about system administration, virtualization, or AI model management."""
You have access to:
1. Unified provider tools for managing LLM providers (list models, test connections, etc.)
2. Custom tools for managing Proxmox virtual machines
3. Standard DeepAgents tools (planning, filesystem, shell, subagents)
Use these tools when asked about:
- LLM provider management (listing models, testing connections, setting defaults)
- System administration and virtualization
- AI model management and configuration"""
model = load_model_from_config()
@@ -143,9 +150,18 @@ def main():
agent = create_maxclaw_agent()
print("✅ Agent initialized successfully!")
# Simple test interaction
# Show available tools
print("\n🔧 Available tools:")
print(" • Provider tools: list models, test connections, set defaults")
print(" • Proxmox tools: manage VMs, snapshots, resources")
print(" • Standard tools: planning, filesystem, shell, subagents")
print("\n💬 You can now interact with the agent. Type 'exit' to quit.")
print("💡 Try asking about Proxmox VMs or Ollama models!")
print("💡 Try asking:")
print(" - 'List available models for my provider'")
print(" - 'Test connection to Ollama'")
print(" - 'Show me Proxmox VMs'")
print(" - 'What's the default model for OpenAI?'")
while True:
user_input = input("\n👤 You: ").strip()