Documentation / SDK and API
Go SDK
Embed the Seshat runtime in a Go application: create a client, ask a question, hold a conversation.
The SDK is the github.com/KPO-Tech/seshat/pkg/sdk package. It gives you the same runtime as the terminal agent, as a library: sessions, tools, permissions, memory, MCP, hooks and providers.
go get github.com/KPO-Tech/seshat@latest
You need Go 1.26 or later.
One question
Ask creates a session, sends the prompt, waits for the agent to finish (including any tools it calls) and returns the final answer.
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/KPO-Tech/seshat/pkg/sdk"
)
func main() {
cfg := sdk.DefaultClientConfig()
cfg.APIKey = os.Getenv("ANTHROPIC_API_KEY")
cfg.Model = sdk.ModelIdentifier{
Provider: sdk.APIProviderAnthropic,
Model: "claude-sonnet-4-20250514",
}
client, err := sdk.NewClient(cfg)
if err != nil {
log.Fatal(err)
}
defer client.Close()
resp, err := client.Ask(context.Background(), "Write a Go function that reverses a string", nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Content)
}
AskResponse also carries the tool calls and their results (ToolUses, ToolResults), token Usage and IsComplete.
A conversation
A session keeps the history between messages. Create one, send as many messages as you like, then close it.
session, err := client.CreateSession(ctx)
if err != nil {
log.Fatal(err)
}
defer session.Close()
first, _ := session.SubmitMessage(ctx, "List the Go files in this folder")
second, _ := session.SubmitMessage(ctx, "Now explain the biggest one")
fmt.Println(second.TotalTokens, second.IsComplete)
Come back to a saved session later with client.LoadSession(ctx, id). client.ListSessions() and client.DeleteSession(id) manage what is stored.
The settings you will touch first
| Field | Purpose |
|---|---|
APIKey | The provider key. A CredentialResolver can supply keys per provider instead, for multi-tenant servers |
Model | A ModelIdentifier{Provider, Model} |
PermissionMode | Who approves actions. Default PermissionModeOnRequest |
MaxTurns | Limit on turns per request |
AutoCompact | Compact the context when it gets full |
WorkingDir | The folder the agent works in. Defaults to the current one |
MCPServers | MCP servers to connect (see Skills and MCP) |
PersistSessions, SessionStorageDir | Where conversations are kept |
EnableMemory | Long-term notes across sessions |
ProviderConfig | Provider options such as a base URL |
SandboxKind, RequireSandbox | Run commands in a local or Docker sandbox |
Where next
Updated on 2026-10-07