//go:build ignore // keygen generates deterministic Ed25519 keypairs for demo agents. // // Run with: go run keygen.go // // This creates agents.json with reproducible keypairs based on agent names. // The seed for each keypair is SHA-256(agent_name) - deterministic but unique. package main import ( "crypto/ed25519" "crypto/sha256" "encoding/hex" "encoding/json" "fmt" "os" ) // DemoAgent represents a demo agent configuration. type DemoAgent struct { Seed string `json:"seed"` PublicKey string `json:"public_key"` Tier int `json:"tier"` Description string `json:"description"` Sources string `json:"sources"` } var agents = []struct { Name string Tier int Description string Sources string }{ { Name: "fda:drug-label-ingestor", Tier: 0, Description: "Ingests FDA drug label data from DailyMed and FDA Orange Book", Sources: "DailyMed, FDA Orange Book", }, { Name: "pubmed:abstract-indexer", Tier: 1, Description: "Indexes clinical trial abstracts from PubMed/MEDLINE", Sources: "PubMed, MEDLINE", }, { Name: "clinicaltrials:study-importer", Tier: 1, Description: "Imports trial protocols and results from ClinicalTrials.gov", Sources: "ClinicalTrials.gov", }, { Name: "internal:clinical-ops-reviewer", Tier: 3, Description: "Internal clinical expert providing manual review and annotations", Sources: "Internal review, Manual annotations", }, { Name: "reddit:health-discussion-scraper", Tier: 5, Description: "Scrapes patient experience reports from health communities", Sources: "Reddit r/loseit, r/Ozempic, health forums", }, } func main() { result := make(map[string]DemoAgent) fmt.Println("Generating demo agent keypairs...") fmt.Println() for _, agent := range agents { // Generate deterministic seed from agent name hash := sha256.Sum256([]byte(agent.Name)) seed := hash[:] // Create Ed25519 keypair from seed privateKey := ed25519.NewKeyFromSeed(seed) publicKey := privateKey.Public().(ed25519.PublicKey) seedHex := hex.EncodeToString(seed) pubKeyHex := hex.EncodeToString(publicKey) result[agent.Name] = DemoAgent{ Seed: seedHex, PublicKey: pubKeyHex, Tier: agent.Tier, Description: agent.Description, Sources: agent.Sources, } fmt.Printf("Agent: %s\n", agent.Name) fmt.Printf(" Tier: T%d\n", agent.Tier) fmt.Printf(" Seed: %s\n", seedHex) fmt.Printf(" Public Key: %s\n", pubKeyHex) fmt.Println() } // Write to agents.json data, err := json.MarshalIndent(result, "", " ") if err != nil { fmt.Fprintf(os.Stderr, "Error marshaling JSON: %v\n", err) os.Exit(1) } err = os.WriteFile("agents.json", data, 0644) if err != nil { fmt.Fprintf(os.Stderr, "Error writing agents.json: %v\n", err) os.Exit(1) } fmt.Println("Wrote agents.json") }