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-runtime/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-runtime@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-runtime/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

NewClient(cfg)once, then sharedCreateSessiona new conversationLoadSession(id)pick one up againSubmitMessageone question, one answersession.Closewhen you are doneclient.Closewhen the app stopsas many times as you likeSessions are saved. Delete one with client.DeleteSession(id): see Storage and data.Never share a session between two users.
A client is cheap to keep and is shared. A session keeps the history between messages and is closed when you are done.

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
MaxIterationsLimit on rounds of model calls per request (100 when left at zero)
MaxTokensThe most the model may write in one call (8,192 by default)
AutoCompactCompact the context when it gets full
CompactSummaryModelThe model that writes the summaries. By default, the model of the session
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
ManagedPolicyWhat an organization imposes on every agent: a text to follow and tools that are never used. Set it from an administrator’s configuration, not from the end user’s
EnableToolSearchKeep deferred tools (MCP tools, for example) out of the first tool list: the model finds them with tool_search

Where next

Updated on 2026-10-14