mirror of
https://github.com/hanzoai/sdk.git
synced 2026-11-02 10:34:12 +00:00
- 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
39 lines
985 B
Python
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" |