submitresult

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package submitresult provides tool definitions for AI agents to submit their final results.

It exposes ClaudeTool and GoogleTool constructors that build executor tool metadata for the submit_result tool, which agents call to return a structured response at the end of a conversation.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClaudeTool

func ClaudeTool[Response any](opts Options[Response]) (claudetool.Metadata[Response], error)

ClaudeTool constructs the Claude executor metadata for the submit_result tool.

Example

ExampleClaudeTool demonstrates constructing the Claude submit_result tool metadata for a custom response type.

package main

import (
	"fmt"

	"chainguard.dev/driftlessaf/agents/submitresult"
)

func main() {
	type MyResult struct {
		Summary string `json:"summary" jsonschema:"required,description=Summary of findings"`
	}

	tool, err := submitresult.ClaudeTool[*MyResult](submitresult.Options[*MyResult]{
		Description:        "Submit the final analysis result.",
		PayloadDescription: "Structured analysis result.",
	})
	if err != nil {
		panic(err)
	}
	fmt.Println("tool name:", tool.Definition.Name)
}
Output:
tool name: submit_result

func ClaudeToolForResponse

func ClaudeToolForResponse[Response any]() (claudetool.Metadata[Response], error)

ClaudeToolForResponse constructs the submit_result tool using metadata inferred from the response type annotations.

func GoogleTool

func GoogleTool[Response any](opts Options[Response]) (googletool.Metadata[Response], error)

GoogleTool constructs the Google executor metadata for the submit_result tool.

func GoogleToolForResponse

func GoogleToolForResponse[Response any]() (googletool.Metadata[Response], error)

GoogleToolForResponse constructs the submit_result tool using metadata inferred from the response type annotations.

Types

type Options

type Options[Response any] struct {
	ToolName           string
	Description        string
	SuccessMessage     string
	PayloadFieldName   string
	PayloadDescription string
	Generator          *schema.Generator
}

Options configures the submit_result tool wiring.

func OptionsForResponse

func OptionsForResponse[T any]() Options[T]

OptionsForResponse returns an Options pre-populated from the annotations present on the response type T. Callers may further customize the returned struct before passing it to ClaudeTool or GoogleTool.

Jump to

Keyboard shortcuts

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