Documentation
¶
Index ¶
- func AgentsConfigPath(dataDir string) string
- func FileConfigPath(dataDir string) string
- func GetAddressFromKey(keyHex string) (string, error)
- func SaveAgentsConfig(dataDir string, cfg *AgentsConfig) error
- func SaveFileConfig(path string, fc *FileConfig) error
- type AgentConfig
- type AgentProfile
- type AgentsConfig
- type Config
- type EthereumConfig
- type FileConfig
- type IPFSConfig
- type P2PConfig
- type StorageConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgentsConfigPath ¶
AgentsConfigPath returns the path to the agents.yaml file.
func FileConfigPath ¶
FileConfigPath returns the config.yaml path for the given data directory. FileConfigPath returns the config.yaml path for the given data directory.
func GetAddressFromKey ¶
func SaveAgentsConfig ¶
func SaveAgentsConfig(dataDir string, cfg *AgentsConfig) error
SaveAgentsConfig marshals the config to YAML and writes it to disk.
func SaveFileConfig ¶
func SaveFileConfig(path string, fc *FileConfig) error
SaveFileConfig writes the config to a YAML file with 0600 permissions.
Types ¶
type AgentConfig ¶
type AgentConfig struct {
Model string
APIKey string // Google API key (env: GOOGLE_API_KEY)
Provider string // "google", "openai", or "" for auto-detect (env: LLM_PROVIDER)
OpenAIAPIKey string // OpenAI-compatible API key (env: OPENAI_API_KEY)
OpenAIBaseURL string // OpenAI-compatible base URL (env: OPENAI_BASE_URL)
}
AgentConfig holds agent configuration
type AgentProfile ¶
type AgentProfile struct {
Name string `yaml:"name"`
Description string `yaml:"description"`
Price float64 `yaml:"price"`
Model string `yaml:"model,omitempty"` // falls back to GOOGLE_MODEL env
APIKey string `yaml:"api_key,omitempty"` // Google API key; falls back to GOOGLE_API_KEY env
Provider string `yaml:"provider,omitempty"` // "google", "openai", or "" for auto-detect
OpenAIAPIKey string `yaml:"openai_api_key,omitempty"` // OpenAI-compatible API key
OpenAIBaseURL string `yaml:"openai_base_url,omitempty"` // OpenAI-compatible base URL
OnChain bool `yaml:"on_chain,omitempty"` // mint ERC-721 on AgentRegistry (requires wallet)
}
AgentProfile holds the persistent configuration for a single agent.
type AgentsConfig ¶
type AgentsConfig struct {
Agents []AgentProfile `yaml:"agents"`
}
AgentsConfig is the top-level structure for agents.yaml.
func LoadAgentsConfig ¶
func LoadAgentsConfig(dataDir string) (*AgentsConfig, error)
LoadAgentsConfig loads the agents config from disk. Returns an empty config (not an error) if the file does not exist.
func (*AgentsConfig) AddProfile ¶
func (c *AgentsConfig) AddProfile(p AgentProfile) error
AddProfile adds a new profile. Returns an error if the name already exists.
func (*AgentsConfig) DeleteProfile ¶
func (c *AgentsConfig) DeleteProfile(name string) error
DeleteProfile removes the profile with the given name. Returns an error if not found.
func (*AgentsConfig) FindProfile ¶
func (c *AgentsConfig) FindProfile(name string) *AgentProfile
FindProfile returns the profile with the given name, or nil if not found.
func (*AgentsConfig) Validate ¶
func (c *AgentsConfig) Validate() error
Validate checks for empty names and duplicate names.
type Config ¶
type Config struct {
P2P *P2PConfig
IPFS *IPFSConfig
Ethereum *EthereumConfig
Agent *AgentConfig
Storage *StorageConfig
}
Config is the main configuration
func LoadConfig ¶
LoadConfig loads configuration from environment
type EthereumConfig ¶
type EthereumConfig struct {
RPCURL string
PrivateKey string
ChainID int64
RegistryAddr string // AgentRegistry (ERC-721) contract address
PaymentVaultAddr string // x402 PaymentVault contract address
IdentityAddr string // ERC-8004 IdentityRegistry contract address
ReputationAddr string // ReputationRegistry contract address
ValidationAddr string // ValidationRegistry contract address
}
EthereumConfig holds Ethereum configuration
type FileConfig ¶
type FileConfig struct {
RPCUrl string `yaml:"rpc_url"`
P2PPort int `yaml:"p2p_port"`
BootstrapPeers []string `yaml:"bootstrap_peers,omitempty"`
}
FileConfig represents ~/.betar/config.yaml written by `betar onboard`. It holds flat network settings only; agent profiles live in agents.yaml.
func LoadFileConfig ¶
func LoadFileConfig(path string) (*FileConfig, error)
LoadFileConfig loads config from a YAML file. Returns an empty FileConfig (not an error) if the file does not exist.