org.llm4s.agent.graph.tool

Members list

Type members

Classlikes

trait AgentTool[A]

A tool the agent loop can call: typed arguments, validated against AgentToolSpec.argumentSchema and decoded with its codec before execute runs. A tool writes only the state keys in writes.

A tool the agent loop can call: typed arguments, validated against AgentToolSpec.argumentSchema and decoded with its codec before execute runs. A tool writes only the state keys in writes.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Asking[A, Q, Ans]
object AgentTool

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
AgentTool.type
final case class AgentToolSpec[A]

What a tool tells the model and the loop: its name, description and argument schema, how its arguments decode, an optional check on the decoded value, and the question it may ask.

What a tool tells the model and the loop: its name, description and argument schema, how its arguments decode, an optional check on the decoded value, and the question it may ask.

name must match [a-zA-Z0-9_-]{1,64}: apply throws IllegalArgumentException otherwise, and ToolSet.of refuses one too, so a spec built another way is still checked.

Arguments are validated against argumentSchema, the schema rendered non-strict, which is what core's Anthropic, Gemini and Vertex AI clients send. A call from a client that sends tools strict (OpenAI and the OpenAI-compatible ones) carries every property, which that schema also accepts.

Value parameters

hints

what the tool is likely to do, for a middleware to read; see ToolHints

question

the question this tool may ask; set by AgentTool.Asking

validateDecoded

a check on the decoded arguments; Left becomes an error the model sees

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object AgentToolSpec

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type

Checks raw tool-call arguments against the JSON Schema a tool sent to the provider.

Checks raw tool-call arguments against the JSON Schema a tool sent to the provider.

The default implementation supports exactly the subset core's SchemaDefinition emits: type (a string or an array of strings), description (ignored), properties, required, additionalProperties (boolean), enum, minLength, maxLength, minimum, maximum, exclusiveMinimum, exclusiveMaximum, multipleOf, items, minItems, maxItems and uniqueItems. Any other keyword, and a supported one with a malformed value (a bound that is not a number, a length or count that is not a non-negative whole number, a non-boolean uniqueItems, a required that is not an array of strings, an enum that is not an array, properties that is not an object), is reported by unsupported so a tool set can refuse it when it is built, rather than silently skip the constraint on every call.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any

Attributes

Companion
trait
Supertypes
class Object
trait Matchable
class Any
Self type
final case class ToolContext

What a tool call knows: the run, the call's id, the call's IdempotencyKey, the thread state it may read, and whether the call has been approved. Built with ToolContext(...); a field added later gets a default there and a with* setter, so existing callers keep compiling.

What a tool call knows: the run, the call's id, the call's IdempotencyKey, the thread state it may read, and whether the call has been approved. Built with ToolContext(...); a field added later gets a default there and a with* setter, so existing callers keep compiling.

A tool with an external side effect passes idempotencyKey to the system it calls (an Idempotency-Key header, a client token, a unique column), because the runtime may run the same call more than once: a retrying wrapper, recover after a failure, cancellation or crash, and an approval each run it again with the same key.

Attributes

Companion
object
Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
object ToolContext

Attributes

Companion
class
Supertypes
trait Product
trait Mirror
class Object
trait Matchable
class Any
Self type

What a tool call produced, as data.

What a tool call produced, as data.

Attributes

Supertypes
trait Enum
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final case class ToolQuestion[Q, Ans](questionCodec: ReadWriter[Q], answerCodec: ReadWriter[Ans])

The codecs of a tool's question and of the answer it takes.

The codecs of a tool's question and of the answer it takes.

Attributes

Supertypes
trait Serializable
trait Product
trait Equals
class Object
trait Matchable
class Any
Show all
final class ToolSet

The tools an agent loop offers, in order, with the validator that checks their arguments. Built only through ToolSet.of, so every name is valid and unique, every argument schema is an object, and every schema keyword is one the validator checks.

The tools an agent loop offers, in order, with the validator that checks their arguments. Built only through ToolSet.of, so every name is valid and unique, every argument schema is an object, and every schema keyword is one the validator checks.

Attributes

Companion
object
Supertypes
class Object
trait Matchable
class Any
object ToolSet

Attributes

Companion
class
Supertypes
class Object
trait Matchable
class Any
Self type
ToolSet.type