twilight

module
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2026 License: Apache-2.0

README

Twilight AI

A lightweight, idiomatic AI SDK for Go — inspired by Vercel AI SDK.

Go Reference License

Features

  • One call, one result — Model.Generate and Model.Stream take an sdk.Request and return a ModelResult or a stream of typed parts. Embed, EmbedMany, GenerateImage, EditImage, GenerateVideo, GenerateSpeech and StreamSpeech cover the other modalities
  • Provider-agnostic — swap between OpenAI, Anthropic, Google, GitHub Copilot, Edge TTS, or any OpenAI-compatible endpoint
  • Model discovery — ListModels fetches available models, Test checks provider connectivity and model support
  • Tool calling — describe tools with ToolDefinition (or infer the schema from a Go struct with NewToolDefinition[T]); the model's calls come back as typed ToolCalls with ToolArguments
  • Streaming — first-class channel-based streaming with fine-grained StreamPart types
  • Rich message types — text, images, files, reasoning content, tool calls/results
  • Embeddings — generate embeddings with Embed / EmbedMany, supports OpenAI and Google providers
  • Image generation — generate and edit images with GenerateImage / EditImage, supports OpenAI (dall-e, gpt-image) and Alibaba Cloud DashScope (Qwen-Image, Wan) models
  • Video generation — create, poll, and download video jobs with OpenRouter and Ark/ModelArk providers
  • Speech synthesis — generate speech with GenerateSpeech / StreamSpeech, supports Edge TTS with an open provider model

Installation

go get github.com/felinics/twilight

Requires Go 1.25+.

Quick Start

Generate Text (Chat Completions API)
package main

import (
    "context"
    "fmt"
    "log"

    "github.com/felinics/twilight/provider/openai/completions"
    "github.com/felinics/twilight/sdk"
)

func main() {
    provider := completions.New(
        completions.WithAPIKey("sk-..."),
    )
    model := provider.ChatModel("gpt-4o-mini")

    result, err := model.Generate(context.Background(), sdk.Request{
        Messages: []sdk.Message{
            sdk.UserMessage("Explain Go channels in 3 sentences."),
        },
    })
    if err != nil {
        log.Fatal(err)
    }
    fmt.Println(result.Text)
}
Generate Text (Responses API)
import "github.com/felinics/twilight/provider/openai/responses"

provider := responses.New(
    responses.WithAPIKey("sk-..."),
)
model := provider.ChatModel("gpt-4o-mini")

result, err := model.Generate(context.Background(), sdk.Request{
    Messages: []sdk.Message{
        sdk.UserMessage("Explain Go channels in 3 sentences."),
    },
})
fmt.Println(result.Text)

The Responses API is OpenAI's newer API with first-class support for reasoning models (o3, o4-mini), URL citation annotations, and a flat input format. See Providers for details.

OpenCode Go
import opencodego "github.com/felinics/twilight/provider/opencode/go"

provider := opencodego.New(
    opencodego.WithAPIKey("your-opencode-go-key"),
    opencodego.WithHeaders(map[string]string{"User-Agent": "my-agent/1.0"}),
)
ctx := sdk.WithRequestHeaders(context.Background(), map[string]string{
    opencodego.SessionHeader: conversationID, // stable across turns and tool calls
})
result, err := provider.ChatModel("glm-5.2").Generate(ctx, sdk.Request{
    Messages: []sdk.Message{sdk.UserMessage("Explain this code")},
})
if err != nil {
    log.Fatal(err)
}
fmt.Println(result.Text)

Models route to Completions unless the official endpoint table lists them under Responses or Messages. See OpenCode Go for model discovery, route overrides and session handling.

Anthropic
import "github.com/felinics/twilight/provider/anthropic/messages"

provider := messages.New(
    messages.WithAPIKey("sk-ant-..."),
)
model := provider.ChatModel("claude-sonnet-4-20250514")

maxTokens := 1024
result, err := model.Generate(context.Background(), sdk.Request{
    MaxTokens: &maxTokens,
    Messages: []sdk.Message{
        sdk.UserMessage("Explain Go channels in 3 sentences."),
    },
})
fmt.Println(result.Text)

For extended thinking (reasoning), configure the provider with WithThinking:

provider := messages.New(
    messages.WithAPIKey("sk-ant-..."),
    messages.WithThinking(messages.ThinkingConfig{
        Type:         "enabled",
        BudgetTokens: 4000,
    }),
)
Google Gemini
import "github.com/felinics/twilight/provider/google/generativeai"

provider := generativeai.New(
    generativeai.WithAPIKey("AIza..."),
)
model := provider.ChatModel("gemini-2.5-flash")

result, err := model.Generate(context.Background(), sdk.Request{
    Messages: []sdk.Message{
        sdk.UserMessage("Explain Go channels in 3 sentences."),
    },
})
fmt.Println(result.Text)
GitHub Copilot Agent
import "github.com/felinics/twilight/provider/github/copilot"

provider := copilot.New(
    // Use the inbound X-GitHub-Token value from your Copilot agent request.
    copilot.WithGitHubToken("ghu_..."),
)
model := provider.ChatModel(copilot.AutoModel)

result, err := model.Generate(context.Background(), sdk.Request{
    Messages: []sdk.Message{
        sdk.UserMessage("Explain Go channels in 3 sentences."),
    },
})
fmt.Println(result.Text)

This provider targets GitHub Copilot agent / extension runtimes that can call api.githubcopilot.com/chat/completions. GitHub currently does not expose a public Copilot models discovery endpoint, so copilot.AutoModel tells the provider to let GitHub choose the backing model instead of inventing an undocumented model ID.

Stream Text
stream, err := model.Stream(ctx, sdk.Request{
    Messages: []sdk.Message{
        sdk.UserMessage("Write a haiku about concurrency."),
    },
})
if err != nil {
    log.Fatal(err)
}

for part := range stream.Parts {
    switch p := part.(type) {
    case *sdk.TextDeltaPart:
        fmt.Print(p.Text)
    case *sdk.ErrorPart:
        log.Fatal(p.Error)
    }
}

// Once Parts is drained, the assembled result is available: text, usage,
// finish reason and any tool calls, identical to what Generate returns.
result, err := stream.Result()
Tool Calling

Describe the tool with a Go struct — the SDK infers the JSON Schema. The model asks for the call; the caller runs it and replays the step:

type WeatherParams struct {
    City string `json:"city" jsonschema:"City name"`
}

weather, err := sdk.NewToolDefinition[WeatherParams]("get_weather", "Get current weather for a city")
if err != nil {
    log.Fatal(err)
}

messages := []sdk.Message{sdk.UserMessage("What's the weather in Tokyo?")}
for {
    result, err := model.Generate(ctx, sdk.Request{Messages: messages, Tools: []sdk.ToolDefinition{weather}})
    if err != nil {
        log.Fatal(err)
    }
    if len(result.ToolCalls) == 0 {
        fmt.Println(result.Text)
        break
    }
    var assistant []sdk.MessagePart
    for _, rp := range result.ReasoningParts {
        assistant = append(assistant, rp) // reasoning first, with the provider's tokens
    }
    if result.Text != "" {
        assistant = append(assistant, sdk.TextPart{Text: result.Text, ProviderMetadata: result.TextProviderMetadata})
    }
    var results []sdk.ToolResultPart
    for _, call := range result.ToolCalls {
        assistant = append(assistant, sdk.ToolCallPart{ToolCallID: call.ToolCallID, ToolName: call.ToolName, Input: call.Input, ProviderMetadata: call.ProviderMetadata})
        var params WeatherParams
        if err := call.Input.Unmarshal(&params); err != nil { // not a JSON document: tell the model
            results = append(results, sdk.ToolResultPart{ToolCallID: call.ToolCallID, ToolName: call.ToolName, Result: sdk.TextOutput(err.Error()), IsError: true})
            continue
        }
        out, _ := sdk.JSONOutput(map[string]any{"city": params.City, "temp": "22°C"})
        results = append(results, sdk.ToolResultPart{ToolCallID: call.ToolCallID, ToolName: call.ToolName, Result: out})
    }
    messages = append(messages, sdk.Message{Role: sdk.MessageRoleAssistant, Content: assistant}, sdk.ToolMessage(results...))
}

Each iteration is one model call. See Tool Calling.

Image Generation

Generate images from text prompts using OpenAI's image models:

import "github.com/felinics/twilight/provider/openai/images"

provider := images.New(images.WithAPIKey("sk-..."))
model := provider.GenerationModel("gpt-image-1")

result, err := sdk.GenerateImage(ctx,
    sdk.WithImageGenerationModel(model),
    sdk.WithImagePrompt("A sunset over mountains, oil painting style"),
    sdk.WithImageSize("1024x1024"),
)
// result.Data[0].B64JSON contains the base64-encoded image

Edit existing images with inpainting or extensions:

model := provider.EditModel("gpt-image-1")

result, err := sdk.EditImage(ctx,
    sdk.WithImageEditModel(model),
    sdk.WithEditPrompt("Add a rainbow in the sky"),
    sdk.WithEditImages(sdk.ImageInput{
        Data:     pngBytes,
        Filename: "photo.png",
    }),
)

Alibaba Cloud Model Studio (DashScope) image models work through the same API:

import "github.com/felinics/twilight/provider/alibabacloud/images"

provider := images.New(images.WithAPIKey("sk-..."))
model := provider.GenerationModel("qwen-image-max")

result, err := sdk.GenerateImage(ctx,
    sdk.WithImageGenerationModel(model),
    sdk.WithImagePrompt("A sunset over mountains, oil painting style"),
    sdk.WithImageSize("1024x1024"),
)
// result.Data[0].URL contains the generated image URL

The DashScope provider routes Qwen-Image and Wan models to the right endpoint automatically and transparently polls async generation tasks. See Images for details.

Embeddings

Generate vector embeddings for text using OpenAI or Google:

import "github.com/felinics/twilight/provider/openai/embedding"

provider := embedding.New(embedding.WithAPIKey("sk-..."))
model := provider.EmbeddingModel("text-embedding-3-small")

// Single value
vec, err := sdk.Embed(ctx, "Hello world", sdk.WithEmbeddingModel(model))
// vec is []float64

// Multiple values
result, err := sdk.EmbedMany(ctx, []string{"Hello", "World"},
    sdk.WithEmbeddingModel(model),
    sdk.WithDimensions(256),
)
// result.Embeddings is [][]float64
// result.Usage.Tokens reports token consumption

Google Gemini embeddings:

import "github.com/felinics/twilight/provider/google/embedding"

provider := embedding.New(
    embedding.WithAPIKey("AIza..."),
    embedding.WithTaskType("RETRIEVAL_DOCUMENT"),
)
model := provider.EmbeddingModel("gemini-embedding-001")

vec, err := sdk.Embed(ctx, "Hello world", sdk.WithEmbeddingModel(model))
Speech Synthesis

Generate speech audio from text using Edge TTS (free, no API key required):

import "github.com/felinics/twilight/provider/edge/speech"

provider := speech.New()
model := provider.SpeechModel("edge-read-aloud")

// Generate complete audio
result, err := sdk.GenerateSpeech(ctx,
    sdk.WithSpeechModel(model),
    sdk.WithText("Hello, world!"),
    sdk.WithSpeechConfig(map[string]any{
        "voice": "en-US-EmmaMultilingualNeural",
        "speed": 1.0,
    }),
)
// result.Audio is []byte, result.ContentType is "audio/mpeg"

Stream audio chunks for low-latency playback:

sr, err := sdk.StreamSpeech(ctx,
    sdk.WithSpeechModel(model),
    sdk.WithText("你好,这是流式语音合成。"),
    sdk.WithSpeechConfig(map[string]any{
        "voice": "zh-CN-XiaoxiaoNeural",
    }),
)
for chunk := range sr.Stream {
    // write chunk to audio player or file
}
Provider Health Check & Model Discovery

Test connectivity and discover available models before making generation requests:

provider := completions.New(completions.WithAPIKey("sk-..."))

// Check provider connectivity
if err := provider.Test(context.Background()); err != nil {
    var apiErr *sdk.APIError
    switch {
    case sdk.KindOf(err) == sdk.KindAuthentication, sdk.KindOf(err) == sdk.KindPermissionDenied:
        fmt.Println("Credentials rejected:", err)
    case errors.As(err, &apiErr):
        fmt.Println("Connected but the check failed:", err)
    default:
        fmt.Println("Cannot connect:", err)
    }
}

// List all available models
models, err := provider.ListModels(context.Background())
for _, m := range models {
    fmt.Println(m.ID)
}

// Check if a specific model is supported
model := provider.ChatModel("gpt-4o")
testResult, err := model.Test(context.Background())
if testResult.Supported {
    fmt.Println("Model is supported")
}

Documentation

Document Description
Getting Started Installation, setup, and first request
Providers Provider interface, OpenAI, Anthropic, and Google Gemini
Images Generate and edit images with OpenAI and Alibaba Cloud DashScope image models
Embeddings Generate vector embeddings with OpenAI and Google
Speech Speech synthesis with Edge TTS and custom providers
Tool Calling Tool definitions, typed arguments and outputs, replaying a step
Streaming Model.Stream, the ModelStream and its StreamPart types
API Reference Complete type and function reference

Supported Providers

Provider Constructor API Status
OpenAI Chat Completions completions.New() /chat/completions ✅ Stable
OpenAI Responses responses.New() /responses ✅ Stable
OpenAI Codex codex.New() /codex/responses ✅ Stable
OpenAI-compatible (DeepSeek, Groq, etc.) completions.New() + WithBaseURL /chat/completions ✅ Stable
OpenRouter Responses responses.New() + WithBaseURL /responses ✅ Stable
OpenCode Go opencodego.New() Per-model Completions / Responses / Messages New
Anthropic messages.New() /messages ✅ Stable
Google Gemini generativeai.New() Generative AI API ✅ Stable
OpenAI Images images.New() /images/generations, /images/edits ✅ Stable
Alibaba Cloud DashScope Images images.New() DashScope text2image / multimodal-generation ✅ Stable
OpenAI Embeddings embedding.New() /embeddings ✅ Stable
Google Embeddings embedding.New() embedContent / batchEmbedContents ✅ Stable
Edge TTS speech.New() Bing WebSocket ✅ Stable
OpenAI / compatible TTS speech.New() /audio/speech ✅ Stable
Deepgram TTS speech.New() /v1/speak ✅ Stable
ElevenLabs TTS speech.New() /v1/text-to-speech/{voice_id} ✅ Stable
MiniMax TTS speech.New() /v1/t2a_v2 ✅ Stable
MiMo TTS speech.New() /chat/completions + audio output ✅ Stable
Alibaba Cloud CosyVoice speech.New() DashScope WebSocket ✅ Stable
Volcengine SAMI TTS speech.New() /api/v1/invoke ✅ Stable

License

Apache License 2.0

Directories

Path Synopsis
agentcore
artifact
Package artifact is the Artifact Core: Ref, Binding and the two-state RetentionLedger.
Package artifact is the Artifact Core: Ref, Binding and the two-state RetentionLedger.
artifact/artifacttest
Package artifacttest is the conformance suite of the Artifact Core (agent-artifact.md section 8).
Package artifacttest is the conformance suite of the Artifact Core (agent-artifact.md section 8).
chatlog
Package chatlog is the first-party conversation module.
Package chatlog is the first-party conversation module.
checkpoint
Package checkpoint is the consumer's position in a ledger: the durable cursor of a catch-up subscription.
Package checkpoint is the consumer's position in a ledger: the durable cursor of a catch-up subscription.
checkpoint/checkpointtest
Package checkpointtest holds the reference implementation of the checkpoint.Store contract and its conformance suite.
Package checkpointtest holds the reference implementation of the checkpoint.Store contract and its conformance suite.
compaction
Package compaction records Session context-maintenance operations.
Package compaction records Session context-maintenance operations.
driver
Package driver performs finite advancement of durable Turns.
Package driver performs finite advancement of durable Turns.
executor
Package executor makes provider effects durable: a Worker owns the execution record of every accepted Assignment -- its payload, its ExecutionRef, its lifecycle state and its Outcome -- and hands the effect itself to one Backend chosen once, at Dispatch.
Package executor makes provider effects durable: a Worker owns the execution record of every accepted Assignment -- its payload, its ExecutionRef, its lifecycle state and its Outcome -- and hands the effect itself to one Backend chosen once, at Dispatch.
executor/notice
Package notice is the one bounded notice log every settlement source in the executor tier keeps: a Worker announcing that an AssignmentKey settled, a Backend announcing that a Ref settled.
Package notice is the one bounded notice log every settlement source in the executor tier keeps: a Worker announcing that an AssignmentKey settled, a Backend announcing that a Ref settled.
executor/protocol
Package protocol defines the wire/application protocol for the process- independent effect port in agent/run/effect.
Package protocol defines the wire/application protocol for the process- independent effect port in agent/run/effect.
executor/store
Package store is the Executor's authority over one execution: the commit ledger of an effect's attempts and the lease that fences its writers.
Package store is the Executor's authority over one execution: the commit ledger of an effect's attempts and the lease that fences its writers.
executor/store/storetest
Package storetest holds the reference implementation of the execution store contract and the conformance suite every adapter runs.
Package storetest holds the reference implementation of the execution store contract and the conformance suite every adapter runs.
history
Package history answers fork-boundary questions about a Session's ledger: it reads the turn and chatlog event types, so callers need not scan raw commits themselves.
Package history answers fork-boundary questions about a Session's ledger: it reads the turn and chatlog event types, so callers need not scan raw commits themselves.
jsonstable
Package jsonstable provides immutable RFC 8785 (JCS) JSON values for agent wire protocols, and the stable identity computed over them: Digest, typed-payload digest preimages, and strict decoding.
Package jsonstable provides immutable RFC 8785 (JCS) JSON values for agent wire protocols, and the stable identity computed over them: Digest, typed-payload digest preimages, and strict decoding.
ledger
Package ledger is the commit vocabulary of an append-only event ledger: commits and their event batches, the domains that group a commit's events, positions and heads, and the classified errors every store over it reports.
Package ledger is the commit vocabulary of an append-only event ledger: commits and their event batches, the domains that group a commit's events, positions and heads, and the classified errors every store over it reports.
module
Package module is the framework the ledger's writers declare themselves through: a module names its event types with versioned codecs, the stream domains it owns and how each reads across a parent edge, the projections it folds and the modules it requires.
Package module is the framework the ledger's writers declare themselves through: a module names its event types with versioned codecs, the stream domains it owns and how each reads across a parent edge, the projections it folds and the modules it requires.
observe
Package observe carries a Session's observations in two streams.
Package observe carries a Session's observations in two streams.
preset
Package preset is the authority-side catalog of decision identities: an AgentPreset in, a digest-checked PresetRef out.
Package preset is the authority-side catalog of decision identities: an AgentPreset in, a digest-checked PresetRef out.
prompt
Package prompt is the model-input seam of the agent core: the catalog that resolves an AgentPreset's PromptBuilderRef to a PromptBuilder and the Sources a builder reads from.
Package prompt is the model-input seam of the agent core: the catalog that resolves an AgentPreset's PromptBuilderRef to a PromptBuilder and the Sources a builder reads from.
run
Package run defines a Run: one execution attempt with a unique identity that is recoverable and never rewritten.
Package run defines a Run: one execution attempt with a unique identity that is recoverable and never rewritten.
run/canonical
Package canonical is the canonical identity of a Run: the digest rules (Digests) for every body a fact names or a derived identity covers, and the derivation (Identity) of every RunID-scoped identity -- step, call, response, effect and command ids.
Package canonical is the canonical identity of a Run: the digest rules (Digests) for every body a fact names or a derived identity covers, and the derivation (Identity) of every RunID-scoped identity -- step, call, response, effect and command ids.
run/effect
Package effect defines the process-independent protocol between the Run Loop and the component that performs model/tool effects.
Package effect defines the process-independent protocol between the Run Loop and the component that performs model/tool effects.
run/frozen
Package frozen is the frozen-body protocol of a Run.
Package frozen is the frozen-body protocol of a Run.
run/model
Package model holds the durable, provider-neutral model data a Run persists by digest: ModelRequest, Message, ToolDefinition, ModelResult, Usage and their parts, plus the canonical rendering of tool arguments.
Package model holds the durable, provider-neutral model data a Run persists by digest: ModelRequest, Message, ToolDefinition, ModelResult, Usage and their parts, plus the canonical rendering of tool arguments.
run/plan
Package plan derives what a Run's MachineState asks for next and persists none of it.
Package plan derives what a Run's MachineState asks for next and persists none of it.
run/reconcile
Package reconcile compares durable Run intents with Execution Authority.
Package reconcile compares durable Run intents with Execution Authority.
run/redispatch
Package redispatch is the dispatch ledger of one effect: the process manager's own decisions.
Package redispatch is the dispatch ledger of one effect: the process manager's own decisions.
run/redispatch/redispatchtest
Package redispatchtest holds the reference implementation of the dispatch ledger contract (redispatch.Store) and its conformance suite.
Package redispatchtest holds the reference implementation of the dispatch ledger contract (redispatch.Store) and its conformance suite.
run/schema
Package schema composes the Run protocol's contracts: the state machine, the fact and command codec, the digest rules, the snapshot codec, the identity derivation and the frozen-body codec.
Package schema composes the Run protocol's contracts: the state machine, the fact and command codec, the digest rules, the snapshot codec, the identity derivation and the frozen-body codec.
run/sessionstore
Package sessionstore is the Run domain over a Session ledger: the twilight/run/ event definitions, the twilight/run/machine projection, the frozen-body store over the content store, and the RunStore adapter (SessionRunStore) that commits Run commands through a Session Writer.
Package sessionstore is the Run domain over a Session ledger: the twilight/run/ event definitions, the twilight/run/machine projection, the frozen-body store over the content store, and the RunStore adapter (SessionRunStore) that commits Run commands through a Session Writer.
run/sessionstore/sessionstoretest
Package sessionstoretest builds the Run session store's ports over throwaway durable stores for tests.
Package sessionstoretest builds the Run session store's ports over throwaway durable stores for tests.
run/sessionstore/storetest
Package storetest is the RunStore conformance suite.
Package storetest is the RunStore conformance suite.
run/store
Package store is the transactional boundary of a Run: the RunStore port a Loop drives, the Snapshot a command sees, the CommitRequest and CommitResult of one command, the pure EvaluateCommit every adapter runs inside its own commit, and FoldRun, the rebuild of a MachineState from a Run's complete fact sequence.
Package store is the transactional boundary of a Run: the RunStore port a Loop drives, the Snapshot a command sees, the CommitRequest and CommitResult of one command, the pure EvaluateCommit every adapter runs inside its own commit, and FoldRun, the rebuild of a MachineState from a Run's complete fact sequence.
run/wire
Package wire is the persisted protocol of Run facts and commands: the sealed variant registry of each schema version, the typed fact payloads and the command envelope, and the codec that stores a MachineState as a durable snapshot.
Package wire is the persisted protocol of Run facts and commands: the sealed variant registry of each schema version, the typed fact payloads and the command envelope, and the codec that stores a MachineState as a durable snapshot.
runtime
Package runtime interprets a Session's durable conversation state.
Package runtime interprets a Session's durable conversation state.
runtime/runtimetest
Package turntest is the Store-parameterized conformance suite of the Turn module.
Package turntest is the Store-parameterized conformance suite of the Turn module.
session
Package session is the Session kernel: the lineage tree of immutable commit segments and the storage, ownership and read machinery over them.
Package session is the Session kernel: the lineage tree of immutable commit segments and the storage, ownership and read machinery over them.
session/filestore
Package filestore is the JSONL-backed session.Store: the kernel Ledger over a file Storage.
Package filestore is the JSONL-backed session.Store: the kernel Ledger over a file Storage.
session/filestore/filestoretest
Package filestoretest opens throwaway file-backed stores for tests: the JSONL Session ledger and the cas content store, each under t.TempDir.
Package filestoretest opens throwaway file-backed stores for tests: the JSONL Session ledger and the cas content store, each under t.TempDir.
session/sessiontest
Package sessiontest is the Store-parameterized conformance suite of the Session kernel (agent-session.md section 7).
Package sessiontest is the Store-parameterized conformance suite of the Session kernel (agent-session.md section 7).
session/unit
Package unit is the one place a cross-module commit of a Session is assembled.
Package unit is the one place a cross-module commit of a Session is assembled.
session/writer
Package writer is the single in-process write entry of one Session A commit is a pipeline of stages, one per file: encoding and stream affinity (encode.go), artifact admission and retention claims (admission.go), projection folding and cache (projector.go), observer fan-out (observers.go).
Package writer is the single in-process write entry of one Session A commit is a pipeline of stages, one per file: encoding and stream affinity (encode.go), artifact admission and retention claims (admission.go), projection folding and cache (projector.go), observer fan-out (observers.go).
session/writer/writertest
Package writertest composes explicit acquisition, binding and cleanup for tests.
Package writertest composes explicit acquisition, binding and cleanup for tests.
sessionkernel
Package sessionkernel is the Session-side semantic mechanism: the durable fact layer one Session's meaning lives in -- the Store and its Writers, the module Registry and the projections folded from it, the Run module's Session adapter, the Turn protocol's committer, the chatlog's commands, the content store behind the frozen bodies and the fork/collect lifecycle over the Store.
Package sessionkernel is the Session-side semantic mechanism: the durable fact layer one Session's meaning lives in -- the Store and its Writers, the module Registry and the projections folded from it, the Run module's Session adapter, the Turn protocol's committer, the chatlog's commands, the content store behind the frozen bodies and the fork/collect lifecycle over the Store.
testutil/local
Package local is the colocated executor: model and tool effects run in goroutines of this process against a static Catalog.
Package local is the colocated executor: model and tool effects run in goroutines of this process against a static Catalog.
testutil/sdkconv
Package sdkconv provides test-side conversions between the SDK's model types and the persisted values of agentcore/run/model.
Package sdkconv provides test-side conversions between the SDK's model types and the persisted values of agentcore/run/model.
turn
Package turn is the Turn module: the logical Turn's own facts (started, failed, superseded), the identity derivations that name them, the protocol vocabulary operated on them and the surface that projects Turn state from the Session's facts.
Package turn is the Turn module: the logical Turn's own facts (started, failed, superseded), the identity derivations that name them, the protocol vocabulary operated on them and the surface that projects Turn state from the Session's facts.
internal
canonicaljson
Package canonicaljson is the one RFC 8785 (JCS) rule of the module: the SDK canonicalizes the raw JSON it first carries with it, and the agent's stable values re-canonicalize with it, so bytes produced on one side are the same bytes on the other.
Package canonicaljson is the one RFC 8785 (JCS) rule of the module: the SDK canonicalizes the raw JSON it first carries with it, and the agent's stable values re-canonicalize with it, so bytes produced on one side are the same bytes on the other.
errorformat
Package errorformat decodes the error body formats that more than one provider package receives, such as OpenAI's, which OpenAI-compatible APIs copy.
Package errorformat decodes the error body formats that more than one provider package receives, such as OpenAI's, which OpenAI-compatible APIs copy.
messagecompat
Package messagecompat normalizes provider-agnostic SDK messages for the instruction-role capabilities of a concrete provider protocol.
Package messagecompat normalizes provider-agnostic SDK messages for the instruction-role capabilities of a concrete provider protocol.
reqheaders
Package reqheaders carries per-request HTTP headers on a context.
Package reqheaders carries per-request HTTP headers on a context.
provider
alibabacloud/images
Package images provides an Alibaba Cloud Model Studio DashScope image provider.
Package images provides an Alibaba Cloud Model Studio DashScope image provider.
alibabacloud/speech
Package speech provides an Alibaba Cloud DashScope CosyVoice TTS provider.
Package speech provides an Alibaba Cloud DashScope CosyVoice TTS provider.
ark/videos
Package videos provides Ark / ModelArk video generation support for BytePlus ModelArk and Volcengine Ark data-plane APIs.
Package videos provides Ark / ModelArk video generation support for BytePlus ModelArk and Volcengine Ark data-plane APIs.
deepgram/speech
Package speech provides a Deepgram TTS provider.
Package speech provides a Deepgram TTS provider.
elevenlabs/speech
Package speech provides an ElevenLabs TTS provider.
Package speech provides an ElevenLabs TTS provider.
microsoft/speech
Package speech provides a Microsoft Azure Cognitive Services Text-to-Speech provider.
Package speech provides a Microsoft Azure Cognitive Services Text-to-Speech provider.
minimax/speech
Package speech provides a MiniMax TTS provider.
Package speech provides a MiniMax TTS provider.
openai/speech
Package speech provides an OpenAI-compatible TTS provider that targets the /audio/speech endpoint.
Package speech provides an OpenAI-compatible TTS provider that targets the /audio/speech endpoint.
opencode/go
Package opencodego provides OpenCode Go through its Completions endpoint, and through Responses or Anthropic Messages for the models documented there.
Package opencodego provides OpenCode Go through its Completions endpoint, and through Responses or Anthropic Messages for the models documented there.
openrouter/speech
Package speech provides an OpenRouter TTS provider.
Package speech provides an OpenRouter TTS provider.
openrouter/videos
Package videos provides OpenRouter video generation support.
Package videos provides OpenRouter video generation support.
providertest
Package providertest is the seam conformance suite for chat providers.
Package providertest is the seam conformance suite for chat providers.
volcengine/speech
Package speech provides a Volcengine SAMI TTS provider.
Package speech provides a Volcengine SAMI TTS provider.

Jump to

Keyboard shortcuts

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