package main
import (
"log"
"net/http"
"os"
hastekit "github.com/hastekit/hastekit-sdk-go"
"github.com/hastekit/hastekit-sdk-go/pkg/agents"
"github.com/hastekit/hastekit-sdk-go/pkg/gateway"
"github.com/hastekit/hastekit-sdk-go/pkg/gateway/llm"
)
func main() {
// Initialize SDK client with required services
client, err := hastekit.New(&hastekit.ClientOptions{
ProviderConfigs: []gateway.ProviderConfig{
{
ProviderName: llm.ProviderNameOpenAI,
ApiKeys: []*gateway.APIKeyConfig{
{
Name: "Key 1",
APIKey: os.Getenv("OPENAI_API_KEY"),
},
},
},
},
})
if err != nil {
log.Fatal(err)
}
// Create LLM model
model := client.NewLLM(hastekit.LLMOptions{
Provider: llm.ProviderNameOpenAI,
Model: "gpt-4.1-mini",
})
// Create specialized agents
jokeAgent := client.NewAgent(&hastekit.AgentOptions{
Name: "JokeAgent",
Instruction: client.Prompt("You are a joke teller"),
LLM: model,
History: client.NewConversationManager(),
})
factAgent := client.NewAgent(&hastekit.AgentOptions{
Name: "FactAgent",
Instruction: client.Prompt("You are a fact teller"),
LLM: model,
History: client.NewConversationManager(),
})
// Create router agent with handoffs
_ = client.NewAgent(&hastekit.AgentOptions{
Name: "RouterAgent",
Instruction: client.Prompt("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: client.NewConversationManager(),
})
// Serve the agents
err = http.ListenAndServe(":8070", client)
if err != nil {
log.Fatal(err)
}
}