AgentTool

org.llm4s.agent.graph.tool.AgentTool
See theAgentTool companion trait
object AgentTool

Attributes

Companion
trait
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
AgentTool.type

Members list

Type members

Classlikes

abstract class Asking[A, Q, Ans](base: AgentToolSpec[A])(implicit evidence$1: ReadWriter[Q], evidence$2: ReadWriter[Ans]) extends AgentTool[A]

A tool that asks questions of type Q and takes answers of type Ans. Its spec is base with that question declared, so the loop encodes Ask(q) and decodes the answer with these codecs, then calls resume.

A tool that asks questions of type Q and takes answers of type Ans. Its spec is base with that question declared, so the loop encodes Ask(q) and decodes the answer with these codecs, then calls resume.

Attributes

Supertypes
trait AgentTool[A]
class Object
trait Matchable
class Any

Value members

Concrete methods

def apply[A](spec: AgentToolSpec[A], writes: Set[StateKey[_, _]])(run: (A, ToolContext) => ToolOutcome): AgentTool[A]

A tool from a spec and a function; it never asks questions.

A tool from a spec and a function; it never asks questions.

Attributes

def fromToolFunction(tool: ToolFunction[_, _]): AgentTool[Value]

Adapts a core ToolFunction: the spec takes its name, description and schema (as a SchemaDefinition[ujson.Value] - the type parameter is a phantom), and arguments arrive as raw JSON. Right(json) becomes Success(json), Left(error) an Error with its formatted message. It writes no state and never asks. Its name is not checked here; ToolSet.of refuses an invalid one.

Adapts a core ToolFunction: the spec takes its name, description and schema (as a SchemaDefinition[ujson.Value] - the type parameter is a phantom), and arguments arrive as raw JSON. Right(json) becomes Success(json), Left(error) an Error with its formatted message. It writes no state and never asks. Its name is not checked here; ToolSet.of refuses an invalid one.

Attributes