config

package
v0.1.0-alpha.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ServerNames

func ServerNames(selectors []ToolSelector) []string

ServerNames returns a slice of server names from a slice of ToolSelectors. This is useful for backward compatibility with code that expects []string.

func Validate

func Validate(t *Topology) error

Validate checks the topology configuration for errors.

Types

type A2AAgent

type A2AAgent struct {
	Name string   `yaml:"name"`           // Local alias for this remote agent
	URL  string   `yaml:"url"`            // Base URL for the remote agent's A2A endpoint
	Auth *A2AAuth `yaml:"auth,omitempty"` // Authentication configuration
}

A2AAgent defines an external A2A agent reference.

type A2AAuth

type A2AAuth struct {
	Type       string `yaml:"type,omitempty"`        // "bearer", "api_key", or "none"
	TokenEnv   string `yaml:"token_env,omitempty"`   // Environment variable containing the token
	HeaderName string `yaml:"header_name,omitempty"` // Header name for API key auth (default: "Authorization")
}

A2AAuth contains authentication configuration for A2A connections.

type A2AConfig

type A2AConfig struct {
	Enabled bool       `yaml:"enabled,omitempty"` // Enable A2A exposure (default: true when block present)
	Version string     `yaml:"version,omitempty"` // Agent version (default: "1.0.0")
	Skills  []A2ASkill `yaml:"skills,omitempty"`  // Skills this agent exposes
}

A2AConfig defines A2A protocol settings for exposing an agent via A2A.

type A2ASkill

type A2ASkill struct {
	ID          string   `yaml:"id"`
	Name        string   `yaml:"name"`
	Description string   `yaml:"description,omitempty"`
	Tags        []string `yaml:"tags,omitempty"`
}

A2ASkill represents a capability the agent can perform.

type Agent

type Agent struct {
	Name           string            `yaml:"name"`
	Image          string            `yaml:"image,omitempty"`
	Source         *Source           `yaml:"source,omitempty"`
	Description    string            `yaml:"description,omitempty"`
	Capabilities   []string          `yaml:"capabilities,omitempty"`
	Uses           []ToolSelector    `yaml:"uses"`                      // References mcp-servers or agents by name
	EquippedSkills []ToolSelector    `yaml:"equipped_skills,omitempty"` // Alias for Uses (merged during load)
	Env            map[string]string `yaml:"env,omitempty"`
	BuildArgs      map[string]string `yaml:"build_args,omitempty"`
	Network        string            `yaml:"network,omitempty"` // Network to join (for multi-network mode)
	Command        []string          `yaml:"command,omitempty"` // Override container entrypoint
	Runtime        string            `yaml:"runtime,omitempty"` // Headless runtime (e.g., "claude-code")
	Prompt         string            `yaml:"prompt,omitempty"`  // System prompt for headless agents
	A2A            *A2AConfig        `yaml:"a2a,omitempty"`     // A2A protocol configuration
}

Agent defines an active agent container that consumes MCP tools.

func (*Agent) IsA2AEnabled

func (a *Agent) IsA2AEnabled() bool

IsA2AEnabled returns true if the agent is exposed via A2A protocol.

func (*Agent) IsHeadless

func (a *Agent) IsHeadless() bool

IsHeadless returns true if the agent uses a headless runtime.

type MCPServer

type MCPServer struct {
	Name      string            `yaml:"name"`
	Image     string            `yaml:"image,omitempty"`
	Source    *Source           `yaml:"source,omitempty"`
	URL       string            `yaml:"url,omitempty"`       // External server URL (no container)
	Port      int               `yaml:"port,omitempty"`      // For HTTP transport (container-based)
	Transport string            `yaml:"transport,omitempty"` // "http" (default), "stdio", or "sse"
	Command   []string          `yaml:"command,omitempty"`   // Override container command or remote command for SSH
	Env       map[string]string `yaml:"env,omitempty"`
	BuildArgs map[string]string `yaml:"build_args,omitempty"`
	Network   string            `yaml:"network,omitempty"` // Network to join (for multi-network mode)
	SSH       *SSHConfig        `yaml:"ssh,omitempty"`     // SSH connection config for remote servers
	Tools     []string          `yaml:"tools,omitempty"`   // Tool whitelist (empty = all tools exposed)
}

MCPServer defines an MCP server (container-based or external).

func (*MCPServer) IsExternal

func (s *MCPServer) IsExternal() bool

IsExternal returns true if this is an external MCP server (URL-only, no container).

func (*MCPServer) IsLocalProcess

func (s *MCPServer) IsLocalProcess() bool

IsLocalProcess returns true if this is a local process MCP server (command-only, no container).

func (*MCPServer) IsSSH

func (s *MCPServer) IsSSH() bool

IsSSH returns true if this is an SSH-based MCP server (ssh config with command).

type Network

type Network struct {
	Name   string `yaml:"name"`
	Driver string `yaml:"driver"`
}

Network defines the Docker network configuration.

type Resource

type Resource struct {
	Name    string            `yaml:"name"`
	Image   string            `yaml:"image"`
	Env     map[string]string `yaml:"env,omitempty"`
	Ports   []string          `yaml:"ports,omitempty"`
	Volumes []string          `yaml:"volumes,omitempty"`
	Network string            `yaml:"network,omitempty"` // Network to join (for multi-network mode)
}

Resource defines a supporting container (database, cache, etc).

type SSHConfig

type SSHConfig struct {
	Host         string `yaml:"host"`                   // Required: hostname or IP address
	User         string `yaml:"user"`                   // Required: SSH username
	Port         int    `yaml:"port,omitempty"`         // Optional: SSH port (default 22)
	IdentityFile string `yaml:"identityFile,omitempty"` // Optional: path to SSH private key
}

SSHConfig defines SSH connection parameters for remote MCP servers.

type Source

type Source struct {
	Type       string `yaml:"type"` // "git" or "local"
	URL        string `yaml:"url,omitempty"`
	Ref        string `yaml:"ref,omitempty"`
	Path       string `yaml:"path,omitempty"`
	Dockerfile string `yaml:"dockerfile,omitempty"`
}

Source defines how to build an MCP server from source code.

type ToolSelector

type ToolSelector struct {
	Server string   `yaml:"server" json:"server"`                   // MCP server or A2A agent name
	Tools  []string `yaml:"tools,omitempty" json:"tools,omitempty"` // Tool whitelist (empty = all tools from this server)
}

ToolSelector specifies which tools an agent can access from an MCP server. Supports both string format (server name only) and object format (server + tools).

func (*ToolSelector) UnmarshalYAML

func (ts *ToolSelector) UnmarshalYAML(node *yaml.Node) error

UnmarshalYAML implements custom YAML unmarshaling for ToolSelector. This allows both string format (legacy) and object format (new).

String format (legacy):

uses:
  - server-name

Object format (new):

uses:
  - server: server-name
    tools: ["tool1", "tool2"]

type Topology

type Topology struct {
	Version    string      `yaml:"version"`
	Name       string      `yaml:"name"`
	Network    Network     `yaml:"network"`            // Single network (simple mode)
	Networks   []Network   `yaml:"networks,omitempty"` // Multiple networks (advanced mode)
	MCPServers []MCPServer `yaml:"mcp-servers"`
	Agents     []Agent     `yaml:"agents,omitempty"` // Active agents that consume MCP tools
	Resources  []Resource  `yaml:"resources,omitempty"`
	A2AAgents  []A2AAgent  `yaml:"a2a-agents,omitempty"` // External A2A agents for agent-to-agent communication
}

Topology represents the complete gridctl configuration.

func LoadTopology

func LoadTopology(path string) (*Topology, error)

LoadTopology reads and parses a topology file.

func (*Topology) SetDefaults

func (t *Topology) SetDefaults()

SetDefaults applies default values to the topology.

type ValidationError

type ValidationError struct {
	Field   string
	Message string
}

ValidationError represents a configuration validation error.

func (ValidationError) Error

func (e ValidationError) Error() string

type ValidationErrors

type ValidationErrors []ValidationError

ValidationErrors is a collection of validation errors.

func (ValidationErrors) Error

func (e ValidationErrors) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL