Files
agents/sdk/python/tests/test_async_config.py
zeekayandGitHub 5b5cf9e9db feat: merge AgentField control plane + SDKs as Hanzo Agents (#1)
Transforms hanzoai/agents from a marketplace config repo into a full
agent orchestration platform by merging the AgentField infrastructure:

- Go control plane (K8s-like agent orchestration, service mesh, DAG workflows)
- Python SDK (FastAPI-based agent framework, LiteLLM, memory, DID/VC)
- TypeScript SDK (@hanzo/agents - Vercel AI SDK, MCP, workflows)
- Go SDK (idiomatic agent builder + client)
- React 19 embedded dashboard (XyFlow DAGs, Recharts, Radix UI)
- Docker/K8s/Helm deployment configs
- Examples: hello world, deep research, RAG, simulation, benchmarks
- Functional test suite across Python/Go/TypeScript

All references rebranded: AgentField → Hanzo Agents
- Module: github.com/hanzoai/agents/control-plane
- Python: hanzo_agents
- TypeScript: @hanzo/agents
- Go: github.com/hanzoai/agents/sdk/go
- Env vars: HANZO_AGENTS_*
- Config: hanzo-agents.yaml

Previous marketplace configs moved to config/ directory.
2026-02-09 18:53:09 -08:00

51 lines
1.6 KiB
Python

from hanzo_agents.async_config import AsyncConfig
def test_async_config_validate_defaults_ok():
cfg = AsyncConfig()
# Should not raise
cfg.validate()
def test_async_config_validate_bad_intervals():
cfg = AsyncConfig(
initial_poll_interval=1.0,
fast_poll_interval=0.5, # out of order
)
try:
cfg.validate()
raised = False
except ValueError:
raised = True
assert raised
def test_get_poll_interval_for_age():
cfg = AsyncConfig(
fast_execution_threshold=10.0,
medium_execution_threshold=60.0,
fast_poll_interval=0.1,
medium_poll_interval=0.5,
slow_poll_interval=2.0,
)
assert cfg.get_poll_interval_for_age(5) == 0.1
assert cfg.get_poll_interval_for_age(20) == 0.5
assert cfg.get_poll_interval_for_age(120) == 2.0
def test_from_environment_overrides(monkeypatch):
monkeypatch.setenv("HANZO_AGENTS_ASYNC_MAX_EXECUTION_TIMEOUT", "123")
monkeypatch.setenv("HANZO_AGENTS_ASYNC_BATCH_SIZE", "7")
monkeypatch.setenv("HANZO_AGENTS_ASYNC_ENABLE_RESULT_CACHING", "false")
monkeypatch.setenv("HANZO_AGENTS_ASYNC_ENABLE_EVENT_STREAM", "true")
monkeypatch.setenv("HANZO_AGENTS_ASYNC_EVENT_STREAM_PATH", "/stream")
monkeypatch.setenv("HANZO_AGENTS_ASYNC_EVENT_STREAM_RETRY_BACKOFF", "4.5")
cfg = AsyncConfig.from_environment()
assert cfg.max_execution_timeout == 123
assert cfg.batch_size == 7
assert cfg.enable_result_caching is False
assert cfg.enable_event_stream is True
assert cfg.event_stream_path == "/stream"
assert cfg.event_stream_retry_backoff == 4.5