Documentation
¶
Overview ¶
Package responsesexecutor runs stateless, streaming Responses conversations with client-side tools and validated terminal submissions. Clients and route attribution are supplied by the caller; this package never loads credentials.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config[Response any] struct { Model string Attribution agenttrace.Attribution UserPrompt *promptbuilder.Prompt SystemInstructions *promptbuilder.Prompt UserPromptSuffix *promptbuilder.Prompt MaxTurns int ToolCallConcurrency int MaxTokens int64 // Effort is sent verbatim. Routed callers validate model support against // the route's capabilities; direct callers must select a supported level. Effort effort.Level Submit submitresult.Options[Response] ResultValidators []callbacks.ResultValidator[Response] ResourceLabels map[string]string // RequestTimeout bounds each streaming HTTP attempt. Zero inherits the // execution deadline. This is a total timeout, not an idle timeout. RequestTimeout time.Duration // ExecutionTimeout bounds the conversation, including tools and retries. // Zero selects 30 minutes. A shorter caller deadline always wins. ExecutionTimeout time.Duration }
Config configures a credential-free Responses executor. Zero numeric limits select defaults: 200 turns, 32768 output tokens, and 10 concurrent tools. Concurrent tools must synchronize shared state themselves. Reasoning and cache tokens are subsets of output and input tokens, respectively, not extra usage.
type Interface ¶
type Interface[Request promptbuilder.Bindable, Response any] interface { Execute(context.Context, Request, map[string]toolcall.Tool[Response]) (Response, error) }
Interface executes a native Responses conversation with provider-neutral tools.
func New ¶
func New[Request promptbuilder.Bindable, Response any](client responses.ResponseService, cfg Config[Response]) (Interface[Request, Response], error)
New constructs a native Responses executor using an already configured client. It does not access the network or inspect ambient authentication variables.
Example ¶
package main
import (
"fmt"
"time"
"chainguard.dev/driftlessaf/agents/agenttrace"
"chainguard.dev/driftlessaf/agents/executor/openai/responsesexecutor"
"chainguard.dev/driftlessaf/agents/promptbuilder"
"github.com/openai/openai-go/v3/responses"
)
type request struct{}
func (request) Bind(p *promptbuilder.Prompt) (*promptbuilder.Prompt, error) { return p, nil }
func main() {
type answer struct {
Summary string `json:"summary"`
}
prompt, err := promptbuilder.NewPrompt("Inspect the supplied synthetic fixture and submit your result.")
if err != nil {
panic(err)
}
// The application supplies a transport-configured service. Construction
// itself never loads credentials or makes an inference request.
var service responses.ResponseService
_, err = responsesexecutor.New[request](service, responsesexecutor.Config[answer]{
Model: "us.openai.gpt-5.6-sol", UserPrompt: prompt,
Attribution: agenttrace.Attribution{ProviderName: "aws.bedrock", System: "aws.bedrock", LogicalModel: "gpt-5.6-sol", Protocol: "openai-responses"},
MaxTurns: 5, MaxTokens: 2048, ToolCallConcurrency: 1,
RequestTimeout: 15 * time.Minute,
ExecutionTimeout: time.Hour,
})
fmt.Println(err)
}
Output: <nil>