package main
import (
"log"
"net/http"
"os"
hastekit "github.com/hastekit/hastekit-sdk-go"
"github.com/hastekit/hastekit-sdk-go/pkg/agents"
)
func main() {
// Configure an LLM client
client := hastekit.NewLLMClient([]hastekit.ProviderConfig{
{
ProviderName: hastekit.ProviderOpenAI,
BaseURL: "",
CustomHeaders: nil,
ApiKeys: []*hastekit.APIKeyConfig{
{
Name: "Key 1",
APIKey: os.Getenv("OPENAI_API_KEY"),
},
},
},
})
// Create LLM model
model := client.Model("OpenAI/gpt-4.1-mini")
// Create specialized agents
jokeAgent := hastekit.NewAgent(&hastekit.AgentConfig{
Name: "JokeAgent",
Instruction: hastekit.NewPrompt("You are a joke teller"),
LLM: model,
History: hastekit.NewFileHistory("./conversations"),
})
factAgent := hastekit.NewAgent(&hastekit.AgentConfig{
Name: "FactAgent",
Instruction: hastekit.NewPrompt("You are a fact teller"),
LLM: model,
History: hastekit.NewFileHistory("./conversations"),
})
// Create router agent with handoffs
_ = hastekit.NewAgent(&hastekit.AgentConfig{
Name: "RouterAgent",
Instruction: hastekit.NewPrompt("You are a router agent. You must not respond directly. Your role is only to delegate to other agents"),
LLM: model,
Handoffs: []*agents.Handoff{
agents.NewHandoff(jokeAgent.Name, "Use this agent to generate jokes", jokeAgent),
agents.NewHandoff(factAgent.Name, "Use this agent to generate facts", factAgent),
},
History: hastekit.NewFileHistory("./conversations"),
})
// Serve the agents
err := http.ListenAndServe(":8070", hastekit.NewHTTPHandler())
if err != nil {
log.Fatal(err)
}
}