structuredagent

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrStructuredIOSchemaValidation = errors.New("structured I/O schema validation error")

ErrStructuredIOSchemaValidation is the umbrella error for all structured I/O schema validation failures.

View Source
var ErrStructuredInputSchemaValidation = errors.Join(
	errors.New("structured input schema validation error"),
	ErrStructuredIOSchemaValidation,
)

ErrStructuredInputSchemaValidation is returned when input JSON fails to match the expected schema. It satisfies errors.Is(err, ErrStructuredIOSchemaValidation).

View Source
var ErrStructuredOutputSchemaValidation = errors.Join(
	errors.New("structured output schema validation error"),
	ErrStructuredIOSchemaValidation,
)

ErrStructuredOutputSchemaValidation is returned when output JSON fails to match the expected schema. It satisfies errors.Is(err, ErrStructuredIOSchemaValidation).

Functions

func NewAgent

func NewAgent(wrapped adkagent.Agent, setters ...Option) (adkagent.Agent, error)

NewAgent creates an ADK agent wrapper around another agent and validates structured input/output using configured schemas.

Types

type Option

type Option func(*options)

Option customizes wrapper behavior at creation time.

func WithInputSchema

func WithInputSchema(inputSchema string) Option

WithInputSchema overrides default input JSON schema.

func WithMaxAccumulatedOutputBytes

func WithMaxAccumulatedOutputBytes(maxBytes int) Option

WithMaxAccumulatedOutputBytes sets the maximum number of output text bytes accumulated for schema validation in a single turn.

func WithOutputSchema

func WithOutputSchema(outputSchema string) Option

WithOutputSchema overrides default output JSON schema.

func WithOutputValidationRetries

func WithOutputValidationRetries(retries int) Option

WithOutputValidationRetries sets the number of retries for output schema validation failures. Default is 1 retry (2 total attempts).

func WithSystemInstruction

func WithSystemInstruction(instruction string) Option

WithSystemInstruction sets the system instruction for the agent. This instruction is prepended to the I/O requirements prompt.

Jump to

Keyboard shortcuts

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