cli/cmd/ml/cmd_agent.go
Claude a43cc099cd
Some checks are pending
Security Scan / Go Vulnerability Check (push) Waiting to run
Security Scan / Secret Detection (push) Waiting to run
Security Scan / Dependency & Config Scan (push) Waiting to run
feat(cli): migrate imports to split repos + wire go-agentic registry
Virgil split go-ai into standalone modules (go-agentic, go-ml, go-mlx,
go-rag). This migrates all CLI imports to the new module paths and fixes
API mismatches from the split.

Key changes:
- go-ai/agentic → go-agentic (cmd/ai, cmd/dev)
- go-ai/ml → go-ml (31 files in cmd/ml)
- go-ai/rag → go-rag (3 files in cmd/rag)
- go-ai/mlx → go-mlx (1 file)
- Fix go.work path (../core → ../go)
- Add all split repos to go.work and go.mod
- Simplify daemon to goroutine-based MCP (remove missing supervisor)
- Wire go-agentic SQLiteRegistry into dispatch watch (--agent-id flag)
- Add `core ai agent fleet` command for local registry status
- Fix rag collections API (PointCount, Status string)
- Fix ml live/expand-status to use available go-ml API

Co-Authored-By: Charon <charon@lethean.io>
2026-02-20 12:47:02 +00:00

67 lines
2.5 KiB
Go

package ml
import (
"forge.lthn.ai/core/go/pkg/cli"
"forge.lthn.ai/core/go-ml"
)
var (
agentM3Host string
agentM3User string
agentM3SSHKey string
agentM3AdapterBase string
agentBaseModel string
agentPollInterval int
agentWorkDir string
agentFilter string
agentForce bool
agentOneShot bool
agentDryRun bool
)
var agentCmd = &cli.Command{
Use: "agent",
Short: "Run the scoring agent daemon",
Long: "Polls M3 for unscored LoRA checkpoints, converts, probes, and pushes results to InfluxDB.",
RunE: runAgent,
}
func init() {
agentCmd.Flags().StringVar(&agentM3Host, "m3-host", ml.EnvOr("M3_HOST", "10.69.69.108"), "M3 host address")
agentCmd.Flags().StringVar(&agentM3User, "m3-user", ml.EnvOr("M3_USER", "claude"), "M3 SSH user")
agentCmd.Flags().StringVar(&agentM3SSHKey, "m3-ssh-key", ml.EnvOr("M3_SSH_KEY", ml.ExpandHome("~/.ssh/id_ed25519")), "SSH key for M3")
agentCmd.Flags().StringVar(&agentM3AdapterBase, "m3-adapter-base", ml.EnvOr("M3_ADAPTER_BASE", "/Volumes/Data/lem"), "Adapter base dir on M3")
agentCmd.Flags().StringVar(&agentBaseModel, "base-model", ml.EnvOr("BASE_MODEL", "deepseek-ai/DeepSeek-R1-Distill-Qwen-7B"), "HuggingFace base model ID")
agentCmd.Flags().IntVar(&agentPollInterval, "poll", ml.IntEnvOr("POLL_INTERVAL", 300), "Poll interval in seconds")
agentCmd.Flags().StringVar(&agentWorkDir, "work-dir", ml.EnvOr("WORK_DIR", "/tmp/scoring-agent"), "Working directory for adapters")
agentCmd.Flags().StringVar(&agentFilter, "filter", "", "Filter adapter dirs by prefix")
agentCmd.Flags().BoolVar(&agentForce, "force", false, "Re-score already-scored checkpoints")
agentCmd.Flags().BoolVar(&agentOneShot, "one-shot", false, "Process one checkpoint and exit")
agentCmd.Flags().BoolVar(&agentDryRun, "dry-run", false, "Discover and plan but don't execute")
}
func runAgent(cmd *cli.Command, args []string) error {
cfg := &ml.AgentConfig{
M3Host: agentM3Host,
M3User: agentM3User,
M3SSHKey: agentM3SSHKey,
M3AdapterBase: agentM3AdapterBase,
InfluxURL: influxURL,
InfluxDB: influxDB,
DBPath: dbPath,
APIURL: apiURL,
JudgeURL: judgeURL,
JudgeModel: judgeModel,
Model: modelName,
BaseModel: agentBaseModel,
PollInterval: agentPollInterval,
WorkDir: agentWorkDir,
Filter: agentFilter,
Force: agentForce,
OneShot: agentOneShot,
DryRun: agentDryRun,
}
ml.RunAgentLoop(cfg)
return nil
}