Lightweight framework for building multi-step AI agents in Go. Define tools, give the agent a task, and it figures out the steps. Uses Claude as the reasoning engine.
Think LangGraph — but Go, not Python, and not bloated.
go get github.com/divinedev111/agentkitpackage main
import (
"context"
"encoding/json"
"fmt"
"log"
"github.com/divinedev111/agentkit"
)
func main() {
// Define a tool
calculator := agentkit.DefineTool(
"calculator",
"Evaluate a math expression",
[]agentkit.Param{
{Name: "expression", Type: "string", Description: "Math expression", Required: true},
},
func(_ context.Context, input json.RawMessage) (string, error) {
var args struct{ Expression string }
json.Unmarshal(input, &args)
return "42", nil
},
)
// Create and run an agent
result, err := agentkit.Run(ctx, "math-agent", "What is 6 * 7?",
agentkit.WithTool(calculator),
agentkit.WithMaxSteps(5),
)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Output)
}The agent loop:
- Send the task (and any tool results) to Claude
- Claude responds with text and/or tool calls
- If tool calls: execute them, feed results back to Claude, go to 1
- If no tool calls: return the final text output
That's it. No chains, no graphs, no YAML configs. Just a loop.
searchTool := agentkit.DefineTool(
"search", // name
"Search the web for information", // description (Claude reads this)
[]agentkit.Param{ // parameters (becomes JSON Schema)
{Name: "query", Type: "string", Description: "Search query", Required: true},
{Name: "limit", Type: "number", Description: "Max results"},
},
func(ctx context.Context, input json.RawMessage) (string, error) {
var args struct {
Query string `json:"query"`
Limit int `json:"limit"`
}
json.Unmarshal(input, &args)
// ... do the actual search
return results, nil
},
)Parameters auto-generate a JSON Schema that Claude uses to structure its tool calls. Supported types: string, number, boolean, array, object.
agent := agentkit.New("my-agent",
agentkit.WithTool(searchTool), // add a tool
agentkit.WithTool(saveTool), // add another tool
agentkit.WithModel("claude-sonnet-4-20250514"), // model (default: claude-sonnet-4-20250514)
agentkit.WithAPIKey("sk-ant-..."), // API key (default: ANTHROPIC_API_KEY env)
agentkit.WithMaxSteps(10), // max iterations (default: 10)
agentkit.WithMaxTokens(4096), // max tokens per response
agentkit.WithSystem("You are a ..."), // system prompt
agentkit.OnToolCall(func(name, input string) {
fmt.Printf("[tool] %s\n", name) // observe tool calls
}),
agentkit.OnStep(func(step int, text string) {
fmt.Printf("[step %d] %s\n", step, text) // observe agent thinking
}),
)
result, err := agent.Run(ctx, "Research the latest Go release")type Result struct {
Output string // final text output from the agent
Steps int // number of loop iterations
ToolCalls int // total tool invocations
}agentkit.go Package doc
run.go Top-level API (New, Run, re-exported types)
agent/
agent.go Core agentic loop + Claude API client
options.go Configuration options
tool/
tool.go Tool definition + JSON Schema generation
memory/
memory.go Conversation history with eviction
examples/
simple/ Calculator agent
researcher/ Web research agent with note-taking
| Variable | Description |
|---|---|
ANTHROPIC_API_KEY |
Claude API key (required) |
MIT