skawld

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 25, 2026 License: MIT Imports: 22 Imported by: 0

README

Skawld Agent SDK for Go

A Go-native SDK with two complementary runtimes:

  • a streaming coding-agent runtime with providers, tools, permissions, sessions, skills, subagents, and MCP; and
  • a provider-independent deterministic workflow runtime with semantic demonstrations, immutable workflow versions, policy/approval checkpoints, idempotency controls, and audit records.
go test ./...

Development checks via the Makefile:

make fmt      # gofmt -w .
make vet      # go vet ./...
make test     # go test ./...
make tidy     # go mod tidy

Quick start

package main

import (
    "context"
    "fmt"
    "os"

    skawld "github.com/ZekromNguyen/skawld-sdk-go"
    "github.com/ZekromNguyen/skawld-sdk-go/providers"
    "github.com/ZekromNguyen/skawld-sdk-go/tools"
)

func main() {
    agent, err := skawld.NewAgent(skawld.AgentOptions{
        Provider: providers.NewOpenAIResponsesProvider(providers.OpenAIOptions{}),
        Model:    "gpt-5",
        ToolProfile: tools.ProfileCoding,
        Permissions: skawld.PermissionOptions{
            Mode: skawld.PermissionModeDefault,
        },
    })
    if err != nil {
        panic(err)
    }
    defer agent.Close()

    session, err := agent.Session(context.Background(), skawld.SessionOptions{})
    if err != nil {
        panic(err)
    }

    for event := range session.Run(context.Background(), "List files in the current directory.", skawld.RunOptions{}) {
        if event.Type == skawld.EventAssistant {
            for _, block := range event.Message.Content {
                if block.Type == skawld.BlockText {
                    fmt.Fprint(os.Stdout, block.Text)
                }
            }
        }
    }
}

Raven CLI

Raven is a premium terminal UI for the skawld SDK. It renders the event stream with a thoughtfully designed TUI: streaming text, tool execution display, interactive permission prompts, and session management.

# Install
go install ./cmd/raven

# Interactive REPL with splash screen
raven

# Single-shot mode
raven --prompt "Fix the auth middleware"

# Resume a session
raven --session <id> --prompt "Continue the review"

# Override model
raven --model claude-haiku-4-5

Raven features:

Feature Description
Welcome screen Animated raven silhouette splash on launch
Streaming text Real-time token-by-token rendering with blink cursor
Tool display Icon-labelled tool executions with live durations
Diff preview Side-by-side diff rendering for Edit/Write tools
Permission dialogs Inline modal with Y/A/N/S choices and diff preview
Command palette Ctrl+P fuzzy command picker
Slash commands /help, /model, /clear, /status, /sessions, /memory, /settings, /cost, /export
Status bar Model, token usage, cost, MCP indicator, help hint
Line editing Readline-style input with history, Ctrl+W/U/K, multi-line
Toast notifications Top-right transient success/error/warning toasts
Resize Auto-adapts to terminal dimensions
Raw mode Direct keyboard input: arrows, Home/End, Ctrl+A/E, etc.

Keyboard shortcuts (interactive mode):

Key Action
Ctrl+P Command palette
Ctrl+C Cancel current operation
Ctrl+D Exit Raven
Ctrl+L Clear screen
Up/Down Navigate history
/ Slash commands

Package map

Package Purpose
github.com/ZekromNguyen/skawld-sdk-go Root: Agent, Session, RunHandle, events, core aliases, errors
github.com/ZekromNguyen/skawld-sdk-go/providers Anthropic Messages, OpenAI Chat Completions, OpenAI Responses providers
github.com/ZekromNguyen/skawld-sdk-go/tools Registry, DefaultTools, built-in tools (Read, Write, Edit, Bash, Glob, Grep, Task*)
github.com/ZekromNguyen/skawld-sdk-go/tools/mcp MCP client, server configs (stdio + HTTP), MCP Tool wrapper
github.com/ZekromNguyen/skawld-sdk-go/permissions Engine, rule matching, permission modes, CanUseTool callback
github.com/ZekromNguyen/skawld-sdk-go/sessions In-memory SessionStore
github.com/ZekromNguyen/skawld-sdk-go/sessions/sqlite Persistent SQLite-backed SessionStore
github.com/ZekromNguyen/skawld-sdk-go/skills SKILL.md loader, frontmatter parsing, shell argument substitution, Skill tool
github.com/ZekromNguyen/skawld-sdk-go/subagents Agent-definition loader, registry, Subagent tool
github.com/ZekromNguyen/skawld-sdk-go/config JSON config schema and loader
github.com/ZekromNguyen/skawld-sdk-go/core Shared types: messages, content blocks, events, provider/tool/store contracts
github.com/ZekromNguyen/skawld-sdk-go/workflow Versioned workflow model, deterministic executor, fenced checkpoints, deadlines/cancellation, routes/feedback, explicit uncertain-execution recovery
github.com/ZekromNguyen/skawld-sdk-go/observation Classified semantic human-demonstration events, ingress redaction, traces, and recorder
github.com/ZekromNguyen/skawld-sdk-go/observation/httpadapter HMAC-authenticated semantic business-event HTTP ingress
github.com/ZekromNguyen/skawld-sdk-go/observation/browseradapter Bounded browser semantic-event adapter using accessibility/application identity
github.com/ZekromNguyen/skawld-sdk-go/learning Optional, vendor-neutral trace-to-candidate compiler boundary
github.com/ZekromNguyen/skawld-sdk-go/learning/structured Strict provider-neutral structured-output workflow extractor with redacted trace projection
github.com/ZekromNguyen/skawld-sdk-go/evaluation Workflow, agent-runtime, and extractor evaluation; metrics, safety checks, and release gates
github.com/ZekromNguyen/skawld-sdk-go/policy Tool and approval capability authorization, separation of duties, risk policy, and approval lifecycle
github.com/ZekromNguyen/skawld-sdk-go/audit Structured audit events, durable/leased outbox, bounded delivery worker, and sinks
github.com/ZekromNguyen/skawld-sdk-go/automation Controlled demonstration, learning/improvement, evaluation, human-review, publication, recovery, and execution facade
github.com/ZekromNguyen/skawld-sdk-go/telemetry Vendor-neutral metric/span records and bounded local sink
github.com/ZekromNguyen/skawld-sdk-go/storage Tenant-key document protection and explicit retention contracts
github.com/ZekromNguyen/skawld-sdk-go/storage/sqlite Migrated, optionally encrypted/re-keyable workflow, fenced execution, demonstration, approval, audit/outbox, and evaluation stores
github.com/ZekromNguyen/skawld-sdk-go/internal/ Private helpers (ID generation, frontmatter parser, SSE parser)
github.com/ZekromNguyen/skawld-sdk-go/cmd/raven Raven CLI — premium terminal UI
github.com/ZekromNguyen/skawld-sdk-go/examples/minimal Minimal one-shot agent example
github.com/ZekromNguyen/skawld-sdk-go/examples/interactive_cli Interactive chat-loop example
github.com/ZekromNguyen/skawld-sdk-go/examples/mcp_agent Agent with MCP server integration
github.com/ZekromNguyen/skawld-sdk-go/examples/invoice_reconciliation Semantic recording and deterministic approval-gated workflow
github.com/ZekromNguyen/skawld-sdk-go/examples/learned_invoice Complete demonstration-to-learned-workflow lifecycle with review, release gates, resolution, approval, and execution
github.com/ZekromNguyen/skawld-sdk-go/examples/multiple_demonstrations Multi-trace analysis and evidence-validated candidate extraction
github.com/ZekromNguyen/skawld-sdk-go/examples/workflow_evaluation Deterministic workflow regression metrics and release gates
github.com/ZekromNguyen/skawld-sdk-go/examples/agent_evaluation Real SDK agent-loop evaluation with a fixture provider
github.com/ZekromNguyen/skawld-sdk-go/examples/extractor_evaluation Trace-extractor accuracy, evidence, cost, and release gates
github.com/ZekromNguyen/skawld-sdk-go/examples/http_observation Signed HTTP business event captured as a semantic demonstration

Provider setup

Three provider types ship in providers/:

// Anthropic Messages API
providers.NewAnthropicProvider(providers.AnthropicOptions{
    APIKey: os.Getenv("ANTHROPIC_API_KEY"),
})

// OpenAI Responses API
providers.NewOpenAIResponsesProvider(providers.OpenAIOptions{
    APIKey: os.Getenv("OPENAI_API_KEY"),
})

// OpenAI Chat Completions API
providers.NewOpenAIChatCompletionsProvider(providers.OpenAIOptions{
    APIKey: os.Getenv("OPENAI_API_KEY"),
})

Providers read their respective *_API_KEY environment variable when the APIKey field is empty. BaseURL and DefaultHeaders are available for compatible gateways and proxies.

Run lifecycle

Prefer StartRun / RunHandle for safe cancellation and cleanup:

handle := session.StartRun(ctx, "Inspect this repository.", skawld.RunOptions{})
defer handle.Close()

for event := range handle.Events() {
    switch event.Type {
    case skawld.EventAssistant:
        // render text, thinking, tool calls from event.Message.Content
    case skawld.EventToolCallStart:
        // tool execution started
    case skawld.EventToolCallEnd:
        // tool finished — check event.IsError and event.DurationMS
    case skawld.EventPermissionRequest:
        // must decide allow/deny — see engine callbacks
    case skawld.EventUsage:
        // cumulative token + cost snapshot
    case skawld.EventCompaction:
        // context was compacted
    case skawld.EventResult:
        // run completed — check event.Subtype: "success" | "error" | "aborted"
    }
}

RunHandle.Abort() cancels provider and tool work while still emitting an aborted result. RunHandle.Close() is for abandoned consumers — it cancels event delivery so active-run state and provider streams can unwind.

Custom tools

Implement core.Tool (aliased as skawld.Tool in the root package):

type MyTool struct{}

func (MyTool) Name() string        { return "MyTool" }
func (MyTool) Description() string { return "Do one focused operation." }
func (MyTool) InputSchema() map[string]interface{} {
    return map[string]interface{}{"type": "object"}
}
func (MyTool) Scope() core.ToolScope       { return core.ToolScopeRead }
func (MyTool) ParallelSafe() bool          { return true }
func (MyTool) Validate(raw map[string]interface{}) (map[string]interface{}, error) {
    return raw, nil
}
func (MyTool) Execute(input map[string]interface{}, ctx core.ToolContext) (core.ToolResult, error) {
    return core.ToolResult{Content: "ok", Summary: "ok"}, nil
}
func (MyTool) Summarize(input map[string]interface{}) string {
    return "Run MyTool"
}

Register with tools.NewRegistry() or clone tools.DefaultTools():

reg := tools.DefaultTools()
reg.Register(MyTool{})
agent, _ := skawld.NewAgent(skawld.AgentOptions{
    Tools: reg,
    // ...
})

Permissions

Three modes are available:

Mode Behavior
PermissionModeDefault Ask before writes and exec; reads auto-allowed
PermissionModeAcceptEdits Auto-approve edits, ask before commands
PermissionModeYolo Run everything without asking

Add custom rules or a callback for finer control:

Permissions: skawld.PermissionOptions{
    Mode: skawld.PermissionModeDefault,
    Rules: []permissions.Rule{
        {ToolName: "Bash", Allow: true, RequireApproval: true},
    },
    CanUseTool: func(ctx context.Context, req permissions.CanUseToolRequest) (permissions.CanUseToolResponse, error) {
        // approve, deny, or rewrite tool input
        return permissions.CanUseToolResponse{Behavior: "allow"}, nil
    },
}

SQLite sessions

Persistent sessions with full message history:

import "github.com/ZekromNguyen/skawld-sdk-go/sessions/sqlite"

store, err := sqlite.Open("skawld.db")
if err != nil {
    return err
}
defer store.Close()

agent, err := skawld.NewAgent(skawld.AgentOptions{
    SessionStore: store,
    // provider, model, tools, permissions...
})

Reusing a SessionOptions.ID resumes stored messages for that session.

MCP tools

Connect to MCP servers (stdio or HTTP) for additional tools:

opts := skawld.AgentOptions{
    // ...
    MCPServers: []mcp.ServerConfig{
        {
            Name: "filesystem",
            Stdio: &mcp.StdioServerConfig{
                Command: "npx",
                Args:    []string{"-y", "@modelcontextprotocol/server-filesystem", "."},
            },
        },
        {
            Name: "remote",
            HTTP: &mcp.HTTPServerConfig{
                URL: "https://mcp.example.com",
            },
        },
    },
}

Skills and subagents

Place SKILL.md files in .skawld/skills/ and agent definitions in .skawld/agents/. They auto-load at session start. Disable via DisableSkills: true or DisableSubagents: true.

Skills support shell argument substitution, overlay handling, and a built-in Skill tool. Subagents run with their own provider instance and model configuration.

This repository includes project-local development skills for Git branch workflow, systematic debugging, test-driven development, completion verification, code review, security best practices, and threat modeling. Their source revisions and licenses are recorded in .skawld/skills/THIRD_PARTY_NOTICES.md.

Compaction

Automatic context compaction triggers when estimated token usage exceeds the threshold (default 80% of context window). Emits EventCompaction events with before/after message and token counts.

opts := skawld.AgentOptions{
    CompactionThreshold: 0.8,           // trigger at 80% (default)
    DisableCompaction:   false,
    // CompactionStrategy: &MyStrategy{},  // custom strategy
}

Observability

Set a structured logger or observer for metrics and tracing:

opts := skawld.AgentOptions{
    Logger: slog.New(slog.NewJSONHandler(os.Stderr, nil)),
    // or
    Observer: myObserver{},
}

Observations include stable fields: session ID, run ID, provider ID, tool name, attempt number, duration, retryability, and error kind. Raw prompts, request bodies, tool inputs, and API keys are excluded by default.

Observable lifecycle spans:

  • ObservationProviderAttempt — each provider HTTP call
  • ObservationToolExecution — each tool invoke
  • ObservationPermissionCallback — permission decisions
  • ObservationCompaction — compaction runs
  • ObservationMCPCall — MCP connect/discover
  • ObservationStoreOperation — store reads/writes

Directory structure

skawld-sdk-go/
  agent.go                Agent construction and lifecycle
  session.go              Session, RunHandle, run management
  loop.go                 Run loop: event dispatch, tool execution, compaction
  compaction.go           CompactionStrategy and default implementation
  exports.go              Public type aliases (ModelID, Event, Tool, etc.)
  config_adapter.go       Adapts config.File to AgentOptions
  observability.go        Observation types and helpers
  store_observer.go       Session-store observation wrapper
  skills_runtime.go       Skill invocation runtime
  subagents_runtime.go    Subagent invocation runtime
  system_prompt.go        System prompt construction

  core/                   Shared types and contracts
  providers/              Provider implementations (Anthropic, OpenAI)
  tools/                  Built-in tools and registry
  tools/mcp/              MCP client and tool integration
  permissions/            Permission engine
  sessions/               In-memory session store
  sessions/sqlite/        SQLite-backed session store
  skills/                 SKILL.md loader and Skill tool
  subagents/              Agent-definition loader and Subagent tool
  config/                 JSON config schema and loader
  workflow/               Deterministic workflow runtime and execution safety
  observation/            Semantic demonstrations and ingress minimization
  learning/               Trace analysis and candidate compilation
  policy/                 Capability, risk, and approval policy
  audit/                  Structured audit records and leased outbox
  automation/             Safe application lifecycle facade
  evaluation/             Deterministic and agentic evaluation harnesses
  telemetry/              Vendor-neutral workflow telemetry
  storage/                Document protection and retention contracts
  storage/sqlite/         Durable workflow-domain persistence
  internal/               Private helpers (id, sse, frontmatter, jsoncopy)

  cmd/raven/              Raven CLI terminal UI
    main.go                 Entry point and REPL loop
    internal/tui/
      screen.go             Terminal management (raw mode, alt screen, resize)
      buffer.go             Double-buffered diffing renderer
      theme.go              ANSI-256 color theme with NO_COLOR support
      ansi.go               ANSI escape sequences, box drawing, progress bars
      renderer.go           Event dispatch → ChatView, StatusView, ToolsView
      welcome.go            Raven ASCII splash screen with animation
      input.go              Raw input reader, CSI parser, line editor
      dialogs.go            Command palette, permission dialog
      modals.go             Model picker, settings, sessions, memories, setup
                            wizard, export dialog, cost breakdown, agent view,
                            theme switcher, toast notifications
      diff.go               Unified diff engine and diff rendering

  examples/               Runnable examples
  docs/                   Usage, structure, and release notes
  Makefile                Development shortcuts

Known gaps

See docs/RELEASE_CHECKLIST.md and TODO.md for tracked open items. Notable areas still in progress:

  • Memory session parity with TypeScript SDK
  • Permissions/tool parity rollups for remaining TypeScript fixtures
  • Live provider and MCP release smoke tests

License

MIT

Documentation

Overview

Package skawld provides an embeddable agent SDK for Go.

The root package is the primary public API. It exposes Agent, Session, event streaming, run options, and aliases for the common extension interfaces used by providers, tools, sessions, and permissions.

Index

Constants

View Source
const (
	PermissionModeDefault     = core.PermissionModeDefault
	PermissionModeAcceptEdits = core.PermissionModeAcceptEdits
	PermissionModeYolo        = core.PermissionModeYolo

	BlockText       = core.BlockText
	BlockToolUse    = core.BlockToolUse
	BlockToolResult = core.BlockToolResult
	BlockThinking   = core.BlockThinking
	BlockImage      = core.BlockImage

	RiskLow      = core.RiskLow
	RiskMedium   = core.RiskMedium
	RiskHigh     = core.RiskHigh
	RiskCritical = core.RiskCritical

	SideEffectNone          = core.SideEffectNone
	SideEffectIdempotent    = core.SideEffectIdempotent
	SideEffectNonIdempotent = core.SideEffectNonIdempotent
	SideEffectUnknown       = core.SideEffectUnknown

	IdempotencyNotApplicable = core.IdempotencyNotApplicable
	IdempotencyUnsupported   = core.IdempotencyUnsupported
	IdempotencyOptional      = core.IdempotencyOptional
	IdempotencyRequired      = core.IdempotencyRequired

	TrustSystemPolicy     = core.TrustSystemPolicy
	TrustHumanInstruction = core.TrustHumanInstruction
	TrustToolResult       = core.TrustToolResult
	TrustUntrustedContent = core.TrustUntrustedContent

	EventSystem            = core.EventSystem
	EventAssistant         = core.EventAssistant
	EventUser              = core.EventUser
	EventPartialAssistant  = core.EventPartialAssistant
	EventToolCallStart     = core.EventToolCallStart
	EventToolCallEnd       = core.EventToolCallEnd
	EventPermissionRequest = core.EventPermissionRequest
	EventUsage             = core.EventUsage
	EventCompaction        = core.EventCompaction
	EventResult            = core.EventResult
	EventError             = core.EventError
	EventSkillsLoaded      = core.EventSkillsLoaded
	EventSkillInvoked      = core.EventSkillInvoked
	EventSkillCompleted    = core.EventSkillCompleted
	EventSubagent          = core.EventSubagent

	ObservationProviderAttempt    = core.ObservationProviderAttempt
	ObservationToolExecution      = core.ObservationToolExecution
	ObservationPermissionCallback = core.ObservationPermissionCallback
	ObservationCompaction         = core.ObservationCompaction
	ObservationMCPCall            = core.ObservationMCPCall
	ObservationStoreOperation     = core.ObservationStoreOperation
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Agent

type Agent struct {
	// contains filtered or unexported fields
}

Agent owns shared SDK runtime resources and can create multiple sessions concurrently. Close should be called when MCP or store resources are no longer needed.

func NewAgent

func NewAgent(opts AgentOptions) (*Agent, error)

func (*Agent) Close

func (a *Agent) Close() error

func (*Agent) Observe

func (a *Agent) Observe(ctx context.Context, observation core.Observation)

func (*Agent) Options

func (a *Agent) Options() AgentOptions

func (*Agent) Session

func (a *Agent) Session(ctx context.Context, opts SessionOptions) (*Session, error)

func (*Agent) Store

func (a *Agent) Store() core.SessionStore

Store returns the underlying session store so callers can list, delete, and query sessions.

type AgentOptions

type AgentOptions struct {
	Provider        core.Provider
	ProviderFactory core.ProviderFactory
	Model           core.ModelID
	Tools           *tools.Registry
	// CloseTools transfers registered tool resource lifecycle to Agent.Close.
	// Tools constructed internally are always owned by the Agent.
	CloseTools       bool
	Permissions      PermissionOptions
	SessionStore     core.SessionStore
	CWD              string
	FilesystemPolicy tools.FilesystemPolicy
	Principal        core.Principal
	ToolProfile      tools.Profile
	Logger           *slog.Logger
	Observer         core.Observer
	SystemPrompt     string
	ProblemSolving   ProblemSolvingOptions
	ProviderRetry    *ProviderRetryPolicy
	// MaxRetries is retained for compatibility. Prefer ProviderRetry, whose
	// non-nil zero value can explicitly disable retries.
	MaxRetries             int
	MaxOutputTokens        *int
	IncludePartialMessages bool
	MaxTurns               int
	ToolConcurrency        int
	CompactionStrategy     CompactionStrategy
	CompactionThreshold    float64
	DisableCompaction      bool
	MCPServers             []mcp.ServerConfig
	SkillsDir              string
	SubagentsDir           string
	DisableSkills          bool
	DisableSubagents       bool
}

AgentOptions configures an Agent. NewAgent clones the supplied Tools registry before adding runtime tools, so callers keep ownership of their registry after construction.

func AgentOptionsFromConfig

func AgentOptionsFromConfig(opts config.AgentOptions) AgentOptions

type CanUseTool

type CanUseTool = permissions.CanUseTool

type CompactionRequest

type CompactionRequest struct {
	Provider        core.Provider
	Model           core.ModelID
	System          []core.SystemBlock
	Tools           []core.ToolSchema
	Messages        []core.Message
	Trigger         string
	ContextWindow   int
	EstimatedTokens int
}

type CompactionResult

type CompactionResult struct {
	Messages []core.Message
	Changed  bool
}

type CompactionStrategy

type CompactionStrategy interface {
	Name() string
	Compact(ctx context.Context, req CompactionRequest) (CompactionResult, error)
}

func DefaultCompactionStrategy

func DefaultCompactionStrategy() CompactionStrategy

type ContentBlock

type ContentBlock = core.ContentBlock

type ContentTrust

type ContentTrust = core.ContentTrust

type DescribedTool

type DescribedTool = core.DescribedTool

type Event

type Event = core.Event

type EventType

type EventType = core.EventType

type FilesystemPolicy

type FilesystemPolicy = tools.FilesystemPolicy

type IdempotencySupport

type IdempotencySupport = core.IdempotencySupport

type IdempotentTool

type IdempotentTool = core.IdempotentTool

type ImageSource

type ImageSource = core.ImageSource

type KeepLastTurnsCompactionStrategy

type KeepLastTurnsCompactionStrategy struct {
	Turns                  int
	SummaryMaxOutputTokens int
}

func (KeepLastTurnsCompactionStrategy) Compact

func (KeepLastTurnsCompactionStrategy) Name

type LegacyStreamingProvider

type LegacyStreamingProvider = core.LegacyStreamingProvider

type MCPHTTPServerConfig

type MCPHTTPServerConfig = mcp.HTTPServerConfig

type MCPServerConfig

type MCPServerConfig = mcp.ServerConfig

type MCPStdioServerConfig

type MCPStdioServerConfig = mcp.StdioServerConfig

type Message

type Message = core.Message

type ModelID

type ModelID = core.ModelID

type Observation

type Observation = core.Observation

type ObservationType

type ObservationType = core.ObservationType

type Observer

type Observer = core.Observer

type PermissionMode

type PermissionMode = core.PermissionMode

type PermissionOptions

type PermissionOptions struct {
	Mode       core.PermissionMode
	Rules      []permissions.Rule
	CanUseTool permissions.CanUseTool
}

type PermissionRule

type PermissionRule = permissions.Rule

type Principal

type Principal = core.Principal

type ProblemSolvingOptions

type ProblemSolvingOptions struct {
	Enabled                  bool
	AutoRepoMap              bool
	RequirePlanBeforeWrite   bool
	AutoVerify               bool
	MaxConsecutiveToolErrors int
}

ProblemSolvingOptions enables lightweight orchestration hints that help a coding agent choose better next actions without changing provider APIs.

type Provider

type Provider = core.Provider

type ProviderFactory

type ProviderFactory = core.ProviderFactory

type ProviderRequest

type ProviderRequest = core.ProviderRequest

type ProviderRetryPolicy

type ProviderRetryPolicy struct {
	// MaxRetries is additional attempts after the initial request. A value of
	// zero explicitly disables retries when ProviderRetry is non-nil.
	MaxRetries     int
	InitialBackoff time.Duration
	MaxBackoff     time.Duration
}

type ProviderStream

type ProviderStream = core.ProviderStream

type ProviderStreamEvent

type ProviderStreamEvent = core.ProviderStreamEvent

type ProviderStreamResult

type ProviderStreamResult = core.ProviderStreamResult

type RiskLevel

type RiskLevel = core.RiskLevel

type RunHandle

type RunHandle struct {
	// contains filtered or unexported fields
}

func (*RunHandle) Abort

func (h *RunHandle) Abort()

func (*RunHandle) Close

func (h *RunHandle) Close()

func (*RunHandle) Done

func (h *RunHandle) Done() <-chan struct{}

func (*RunHandle) Events

func (h *RunHandle) Events() <-chan core.Event

type RunImage

type RunImage struct {
	Data      string
	MediaType string
	URL       string
}

type RunOptions

type RunOptions struct {
	MaxOutputTokens *int
	Temperature     *float64
	Images          []RunImage
	Thinking        map[string]interface{}
	Effort          string
}

type Session

type Session struct {
	ID        string
	CreatedAt time.Time
	Principal core.Principal
	// Meta is a compatibility snapshot. Use Metadata for a concurrency-safe
	// copy when sessions may be accessed by multiple goroutines.
	Meta map[string]interface{}
	// contains filtered or unexported fields
}

Session holds one conversation history. A Session permits one active run at a time; metadata and run lifecycle methods are safe to call from concurrent goroutines.

func (*Session) Abort

func (s *Session) Abort()

func (*Session) MessageCount

func (s *Session) MessageCount() int

func (*Session) Metadata

func (s *Session) Metadata() map[string]interface{}

Metadata returns an isolated copy of session metadata.

func (*Session) Run

func (s *Session) Run(ctx context.Context, prompt string, opts RunOptions) <-chan core.Event

func (*Session) StartRun

func (s *Session) StartRun(ctx context.Context, prompt string, opts RunOptions) *RunHandle

func (*Session) UpdateMeta

func (s *Session) UpdateMeta(meta map[string]interface{}) error

func (*Session) UpdateMetaContext

func (s *Session) UpdateMetaContext(ctx context.Context, meta map[string]interface{}) error

type SessionOptions

type SessionOptions struct {
	ID        string
	Meta      map[string]interface{}
	Principal core.Principal
}

type SessionStore

type SessionStore = core.SessionStore

type SideEffectKind

type SideEffectKind = core.SideEffectKind

type StopReason

type StopReason = core.StopReason

type StreamingProvider

type StreamingProvider = core.StreamingProvider

type Tool

type Tool = core.Tool

type ToolContext

type ToolContext = core.ToolContext

type ToolDescriptor

type ToolDescriptor = core.ToolDescriptor

type ToolResult

type ToolResult = core.ToolResult

type Usage

type Usage = core.Usage

Directories

Path Synopsis
Package audit defines durable, structured records for consequential SDK actions.
Package audit defines durable, structured records for consequential SDK actions.
Package automation composes observation, learning, review, publication, and deterministic execution into one safe application-facing lifecycle.
Package automation composes observation, learning, review, publication, and deterministic execution into one safe application-facing lifecycle.
cmd
raven command
Raven CLI — a premium AI coding assistant terminal UI.
Raven CLI — a premium AI coding assistant terminal UI.
raven/internal/tui
Package tui implements the Raven terminal UI rendering layer.
Package tui implements the Raven terminal UI rendering layer.
Package config loads JSON configuration files into AgentOptions.
Package config loads JSON configuration files into AgentOptions.
Package evaluation provides deterministic regression testing for published workflows.
Package evaluation provides deterministic regression testing for published workflows.
examples
interactive_cli command
learned_invoice command
Command learned_invoice demonstrates the complete local lifecycle: semantic demonstrations -> structured extraction -> compilation -> evaluation -> human review -> publication -> deterministic resolution -> approval -> execution.
Command learned_invoice demonstrates the complete local lifecycle: semantic demonstrations -> structured extraction -> compilation -> evaluation -> human review -> publication -> deterministic resolution -> approval -> execution.
mcp_agent command
minimal command
internal
id
sse
Package learning contains the optional trace-to-workflow boundary.
Package learning contains the optional trace-to-workflow boundary.
structured
Package structured provides a provider-neutral, structured-output workflow extractor.
Package structured provides a provider-neutral, structured-output workflow extractor.
Package observation models semantic human demonstrations.
Package observation models semantic human demonstrations.
browseradapter
Package browseradapter converts browser-extension or instrumentation events into semantic observations.
Package browseradapter converts browser-extension or instrumentation events into semantic observations.
httpadapter
Package httpadapter receives authenticated business events over HTTP and converts them into semantic observation events.
Package httpadapter receives authenticated business events over HTTP and converts them into semantic observation events.
Package policy is the mandatory safety boundary between proposed actions and real-world execution.
Package policy is the mandatory safety boundary between proposed actions and real-world execution.
sqlite
Package sqlite provides a SQLite-backed core.SessionStore implementation.
Package sqlite provides a SQLite-backed core.SessionStore implementation.
Package skills loads SKILL.md files and exposes them through the Skill tool.
Package skills loads SKILL.md files and exposes them through the Skill tool.
Package storage defines production data-protection and retention contracts shared by durable storage adapters.
Package storage defines production data-protection and retention contracts shared by durable storage adapters.
sqlite
Package sqlite provides durable local persistence for workflow-learning domain stores.
Package sqlite provides durable local persistence for workflow-learning domain stores.
Package subagents loads child-agent definitions and exposes the Subagent tool.
Package subagents loads child-agent definitions and exposes the Subagent tool.
Package telemetry adapts safe SDK observations into vendor-neutral metric and completed-span records.
Package telemetry adapts safe SDK observations into vendor-neutral metric and completed-span records.
mcp
Package mcp provides a small Model Context Protocol client and adapts MCP server tools to the SDK's core.Tool interface.
Package mcp provides a small Model Context Protocol client and adapts MCP server tools to the SDK's core.Tool interface.
Package workflow provides the canonical, provider-independent workflow model and deterministic runtime.
Package workflow provides the canonical, provider-independent workflow model and deterministic runtime.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL