Skip to documentation
Documentation navigation

Documentation navigation

Documentation / guides

Overview

Assemble a provider-neutral request and validate optional features before encoding.

developer

inference.Request is the complete provider-neutral input to Client.Invoke or Client.Stream. It keeps model identity, per-agent instructions, ordered messages, tools, structured output, tool choice, and per-call sampling in one value.

Request surface

type Request struct {
	Model             model.Model
	System            string
	Messages          content.AgenticMessages
	TransientMessages int
	Tools             []Tool
	Output            *OutputSchema
	ToolChoice        ToolChoice
	Override          *model.Sampling
}
FieldOwnership and behavior
ModelSecret-free descriptor; validate before use
SystemPer-call system instruction, separate from message history
MessagesOrdered sealed conversation turns
ToolsTool definitions exposed to the model
OutputOptional portable JSON object contract
TransientMessagesCount of trailing messages excluded from cache breakpoints
ToolChoiceAutomatic, required, or named tool behavior
OverrideOptional per-call replacement for model sampling
request := inference.Request{
	Model: model.CustomModel(model.ProviderName("acme"), model.APIFormatOpenAI, "https://api.example.test", "chat-1"),
	System: "Answer with evidence.",
	Messages: content.AgenticMessages{&content.UserMessage{Message: content.Message{
		Role: content.RoleUser,
		Blocks: []content.Block{&content.TextBlock{Text: "What changed?"}},
	}}},
}
if err := inference.ValidateRequestFeatures(request); err != nil {
	panic(err)
}

The Harness model request step is the canonical consumer path when a request is produced inside a Harness loop.

Proof

Related: Model selection, Conversation input, Feature validation.

← back to documentation