mirror of
https://github.com/hanzoai/agents.git
synced 2026-10-30 18:48:36 +00:00
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.
90 lines
1.8 KiB
Go
90 lines
1.8 KiB
Go
package process
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"runtime"
|
|
"testing"
|
|
"time"
|
|
|
|
"github.com/hanzoai/agents/control-plane/internal/core/interfaces"
|
|
"github.com/stretchr/testify/assert"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func helperProcessConfig(mode string) interfaces.ProcessConfig {
|
|
return interfaces.ProcessConfig{
|
|
Command: os.Args[0],
|
|
Args: []string{"-test.run=TestProcessHelper"},
|
|
Env: []string{
|
|
"GO_WANT_HELPER_PROCESS=1",
|
|
fmt.Sprintf("HELPER_MODE=%s", mode),
|
|
},
|
|
}
|
|
}
|
|
|
|
func TestDefaultProcessManager_StartStatusStop(t *testing.T) {
|
|
if runtime.GOOS == "windows" {
|
|
t.Skip("process helper uses POSIX signals")
|
|
}
|
|
|
|
pm := NewProcessManager()
|
|
|
|
cfg := helperProcessConfig("block")
|
|
|
|
pid, err := pm.Start(cfg)
|
|
require.NoError(t, err)
|
|
require.True(t, pid > 0)
|
|
|
|
info, err := pm.Status(pid)
|
|
require.NoError(t, err)
|
|
assert.Equal(t, "running", info.Status)
|
|
|
|
require.NoError(t, pm.Stop(pid))
|
|
|
|
_, err = pm.Status(pid)
|
|
require.Error(t, err, "process should be removed after stop")
|
|
}
|
|
|
|
func TestDefaultProcessManager_StopHandlesExitedProcess(t *testing.T) {
|
|
if runtime.GOOS == "windows" {
|
|
t.Skip("process helper uses POSIX signals")
|
|
}
|
|
|
|
pm := NewProcessManager()
|
|
cfg := helperProcessConfig("exit")
|
|
|
|
pid, err := pm.Start(cfg)
|
|
require.NoError(t, err)
|
|
require.True(t, pid > 0)
|
|
|
|
time.Sleep(50 * time.Millisecond)
|
|
|
|
err = pm.Stop(pid)
|
|
require.NoError(t, err, "stopping an already exited process should not fail")
|
|
|
|
_, err = pm.Status(pid)
|
|
require.Error(t, err, "process should be removed after stop")
|
|
}
|
|
|
|
func TestProcessHelper(t *testing.T) {
|
|
if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" {
|
|
return
|
|
}
|
|
|
|
mode := os.Getenv("HELPER_MODE")
|
|
if mode == "" {
|
|
mode = "block"
|
|
}
|
|
|
|
switch mode {
|
|
case "block":
|
|
select {}
|
|
case "exit":
|
|
// Exit immediately
|
|
default:
|
|
}
|
|
|
|
os.Exit(0)
|
|
}
|