A small Go library
for building LLM agents
Agents that run the same way on every major provider.
Tools are Go functions. Sessions are replayable logs.
crux.RegisterTool("lookup_order", "Look an order up by its ID",
func(ctx context.Context, in struct{ ID string `json:"id"` }) (Order, error) {
return orders.Get(in.ID)
})
agent, _ := crux.New("support", crux.ClaudeHaiku4_5, crux.WithTools([]string{"lookup_order"}))
session, _ := crux.NewSession(ctx, agent)
answer, err := session.Run(ctx, "Where is my order A-1001?")
// Order A-1001 shipped yesterday and arrives on Friday.Everything you need to build agents in Go
crux handles providers, tools, sessions and approvals, so you can focus on what your agent does.
Every provider, one API
OpenAI, Anthropic, Gemini, xAI, DeepSeek, OpenRouter and Ollama. Switch by changing the model constant.
Tools are Go functions
Register once, select by name. The JSON schema comes from your input struct, and arguments are validated strictly.
Sessions are logs
Every run, turn and tool call is a stored entry. Resume, fork onto another provider, or persist with GORM.
Humans in the loop
Mark tools as needing approval. Runs pause, you approve or reject, and they resume, even across restarts.
MCP, skills and toolsets
Connect MCP servers with OAuth, give agents Agent Skills, or use the built-in filesystem and network tools.
Typed decisions
Classify, route and score into a Go struct with Decide[T], with calibrated probabilities on decision models.
Agents that delegate
Give an agent subagents as tools, or let it spawn new agents on the fly, with approvals surfacing on the parent.
Streaming and structure
Stream text and reasoning as it arrives, or decode the answer straight into a Go type with RunInto.
Test without keys
cruxtest mocks every provider's API, so agent tests run offline and still exercise the real request code.