Files
sdk/tests/py/test_agent.py
zeekay 1a19f15912 feat: Unified multi-language Hanzo SDK
- Consolidated Python, JavaScript, Rust, and Go SDKs
- Standard directory structure (src/py, src/js, src/rs, src/go)
- Real implementations from existing SDKs (not stubs)
- Comprehensive test framework with CI/CD matrix
- Dual distribution support (pip and npm)
- Language parity for all core commands
- Smart routing based on language strengths
2025-09-15 12:44:41 -05:00

39 lines
985 B
Python

"""Tests for Agent framework."""
import pytest
import asyncio
from hanzo.agent import Agent
def test_agent_creation():
"""Test agent can be created."""
agent = Agent(name="test-agent")
assert agent.name == "test-agent"
assert agent.model == "gpt-4"
assert agent.tools == []
def test_agent_with_tools():
"""Test agent with tools."""
agent = Agent(name="test-agent")
agent.add_tool("filesystem")
agent.add_tool("shell")
assert len(agent.tools) == 2
assert "filesystem" in agent.tools
@pytest.mark.asyncio
async def test_agent_run():
"""Test agent run method."""
agent = Agent(name="test-agent")
result = await agent.run("test task")
assert "test task" in result
assert "test-agent" in result
def test_agent_to_dict():
"""Test agent serialization."""
agent = Agent(name="test-agent", model="claude-3")
data = agent.to_dict()
assert data["name"] == "test-agent"
assert data["model"] == "claude-3"