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.
74 lines
3.3 KiB
Go
74 lines
3.3 KiB
Go
package interfaces
|
|
|
|
// ProcessInfo holds information about a running process.
|
|
type ProcessInfo struct {
|
|
PID int
|
|
Status string // e.g., "running", "stopped", "error"
|
|
Command string
|
|
// Add other relevant fields like start time, CPU/memory usage, etc.
|
|
}
|
|
|
|
// ProcessConfig holds configuration for starting a new process.
|
|
type ProcessConfig struct {
|
|
Command string // The command to execute.
|
|
Args []string // Arguments for the command.
|
|
Env []string // Environment variables for the process (e.g., "KEY=VALUE").
|
|
WorkDir string // Working directory for the process.
|
|
LogFile string // Path to log file for stdout/stderr redirection.
|
|
// Add other relevant fields like UID/GID, etc.
|
|
}
|
|
|
|
// ProcessManager defines the contract for managing system processes.
|
|
// This interface abstracts the underlying operations for starting, stopping,
|
|
// and monitoring processes, allowing for different implementations (e.g., local, Docker).
|
|
type ProcessManager interface {
|
|
// Start initiates a new process based on the provided configuration.
|
|
// It returns the PID of the started process or an error if the process
|
|
// could not be started.
|
|
Start(config ProcessConfig) (pid int, err error)
|
|
|
|
// Stop terminates a process identified by its PID.
|
|
// It should handle graceful termination if possible, and forceful termination
|
|
// if necessary or specified.
|
|
// Returns an error if the process cannot be stopped or is not found.
|
|
Stop(pid int) error
|
|
|
|
// Status retrieves the current status and information of a process
|
|
// identified by its PID.
|
|
// Returns ProcessInfo containing details about the process, or an error
|
|
// if the status cannot be retrieved or the process is not found.
|
|
Status(pid int) (ProcessInfo, error)
|
|
|
|
// List retrieves information about all processes currently managed
|
|
// or observable by this ProcessManager.
|
|
// Returns a slice of ProcessInfo or an error.
|
|
// List() ([]ProcessInfo, error) // Uncomment and implement if needed
|
|
|
|
// Logs retrieves the recent logs for a process identified by its PID.
|
|
// Parameters like `tailLines` could specify how much log to retrieve.
|
|
// Returns the log content as a string or an error.
|
|
// Logs(pid int, tailLines int) (string, error) // Uncomment and implement if needed
|
|
}
|
|
|
|
// PortManager defines the contract for managing network ports.
|
|
// This interface abstracts operations like finding free ports,
|
|
// checking availability, and managing reservations.
|
|
type PortManager interface {
|
|
// FindFreePort searches for an available port, typically starting from a given port number.
|
|
// Returns the first free port found or an error if no port is available in the search range.
|
|
FindFreePort(startPort int) (int, error)
|
|
|
|
// IsPortAvailable checks if a specific port is currently available (not in use).
|
|
// Returns true if the port is available, false otherwise.
|
|
IsPortAvailable(port int) bool
|
|
|
|
// ReservePort attempts to mark a port as reserved for use by the application.
|
|
// This is a logical reservation within the PortManager, not necessarily a system-level lock.
|
|
// Returns an error if the port cannot be reserved (e.g., already in use or reserved).
|
|
ReservePort(port int) error
|
|
|
|
// ReleasePort marks a previously reserved port as available again.
|
|
// Returns an error if the port was not found in the reserved list or cannot be released.
|
|
ReleasePort(port int) error
|
|
}
|