- Merged latest 166 commits from origin/main - Resolved conflicts in .gitignore, commands.py, schema.py, providers/__init__.py, and registry.py - Kept both local providers (Ollama, AirLLM) and new providers from main - Preserved transformers 4.39.3 compatibility fixes - Combined error handling improvements with new features
47 lines
1.5 KiB
Python
47 lines
1.5 KiB
Python
#!/usr/bin/env python3
|
|
"""Direct test of nanobot agent"""
|
|
import asyncio
|
|
import sys
|
|
sys.path.insert(0, '.')
|
|
|
|
from nanobot.config.loader import load_config
|
|
from nanobot.bus.queue import MessageBus
|
|
from nanobot.agent.loop import AgentLoop
|
|
|
|
async def test():
|
|
print("Loading config...", file=sys.stderr)
|
|
config = load_config()
|
|
print(f"Config loaded. Provider: {config.providers}", file=sys.stderr)
|
|
|
|
print("Creating bus and provider...", file=sys.stderr)
|
|
bus = MessageBus()
|
|
from nanobot.cli.commands import _make_provider
|
|
provider = _make_provider(config)
|
|
print(f"Provider created: {type(provider)}", file=sys.stderr)
|
|
|
|
print("Creating agent loop...", file=sys.stderr)
|
|
agent_loop = AgentLoop(
|
|
bus=bus,
|
|
provider=provider,
|
|
workspace=config.workspace_path,
|
|
brave_api_key=config.tools.web.search.api_key or None,
|
|
exec_config=config.tools.exec,
|
|
restrict_to_workspace=config.tools.restrict_to_workspace,
|
|
)
|
|
print("Agent loop created", file=sys.stderr)
|
|
|
|
print("Processing message...", file=sys.stderr)
|
|
response = await agent_loop.process_direct("Hello, what is 2+5?", "cli:test")
|
|
print(f"Response received: {response}", file=sys.stderr)
|
|
print(f"Response content: {response.content if response else 'None'}", file=sys.stderr)
|
|
|
|
if response:
|
|
print("\n=== RESPONSE ===")
|
|
print(response.content or "(empty)")
|
|
else:
|
|
print("\n=== NO RESPONSE ===")
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(test())
|
|
|