Implement secure configuration management with encryption and validation (Phase 1 improvements)
This commit is contained in:
commit
d4d6aafea9
12 files changed
+1656
No files matched your search
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env python3
|
||||
"""
|
||||
Test script for OpenClaw Agent
|
||||
"""
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, '.')
|
||||
|
||||
from main import create_maxclaw_agent
|
||||
|
||||
def test_agent_creation():
|
||||
"""Test that the agent can be created successfully."""
|
||||
print("Testing agent creation...")
|
||||
try:
|
||||
agent = create_maxclaw_agent()
|
||||
print("✅ Agent created successfully!")
|
||||
return agent
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to create agent: {e}")
|
||||
print("💡 Make sure to set the required environment variables for your chosen model provider.")
|
||||
print(" See README.md for configuration examples.")
|
||||
return None
|
||||
|
||||
def test_simple_query(agent):
|
||||
"""Test a simple query to the agent."""
|
||||
print("\nTesting simple query...")
|
||||
try:
|
||||
result = agent.invoke({"messages": [{"role": "user", "content": "Hello, how are you?"}]})
|
||||
ai_message = result["messages"][-1]
|
||||
print(f"✅ Agent responded: {ai_message.content}")
|
||||
return True
|
||||
except Exception as e:
|
||||
print(f"❌ Failed to get response: {e}")
|
||||
return False
|
||||
|
||||
if __name__ == "__main__":
|
||||
# Set some default environment variables for testing
|
||||
# In a real scenario, these would be set externally
|
||||
if not os.getenv("MODEL_PROVIDER"):
|
||||
os.environ["MODEL_PROVIDER"] = "openai"
|
||||
if not os.getenv("MODEL_NAME"):
|
||||
os.environ["MODEL_NAME"] = "gpt-4o-mini" # Using a cheaper model for testing
|
||||
|
||||
agent = test_agent_creation()
|
||||
if agent:
|
||||
test_simple_query(agent)
|
||||
Reference in new issue
Block a user