Seshat AIDocumentation

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

FieldPurpose
APIKeyThe provider key. A CredentialResolver can supply keys per provider instead, for multi-tenant servers
ModelA ModelIdentifier{Provider, Model}
PermissionModeWho approves actions. Default PermissionModeOnRequest
MaxTurnsLimit on turns per request
AutoCompactCompact the context when it gets full
WorkingDirThe folder the agent works in. Defaults to the current one
MCPServersMCP servers to connect (see Skills and MCP)
PersistSessions, SessionStorageDirWhere conversations are kept
EnableMemoryLong-term notes across sessions
ProviderConfigProvider options such as a base URL
SandboxKind, RequireSandboxRun commands in a local or Docker sandbox

Where next

Updated on 2026-10-07