BoundAgent

org.llm4s.agent.delegation.BoundAgent
See theBoundAgent companion object
@Experimental
final class BoundAgent[I, O]

A TypedAgent compiled onto a runtime by TypedAgent.bind: what the task tools run, and what run runs with no parent - from a graph node, or a test.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Concrete methods

def id: AgentId

The subagent's id.

The subagent's id.

Attributes

def recover(ref: ChildRef, config: RunConfig): Result[TaskOutcome[O]]

Continues the failed or interrupted standalone run ref names - a Refused(Failed)'s child - with config, re-running only failed or unstarted work, as Agent.recover does; its outcome maps as run's does. A delegated child's ref is refused, as for resume; so is a thread with nothing to recover (GraphError.NothingToRecover).

Continues the failed or interrupted standalone run ref names - a Refused(Failed)'s child - with config, re-running only failed or unstarted work, as Agent.recover does; its outcome maps as run's does. A delegated child's ref is refused, as for resume; so is a thread with nothing to recover (GraphError.NothingToRecover).

Attributes

def resume(ref: ChildRef, answers: Map[InterruptId, Value], config: RunConfig): Result[TaskOutcome[O]]

Answers some of the pending interrupts of the suspended standalone run ref names - a TaskOutcome.Suspended's child - as Agent.resume takes them, and continues it with config; its outcome maps as run's does. A delegated child's ref is refused (ValidationError): its parent continues it (rule 19). The runtime's refusals - an answer to an interrupt that is not pending (GraphError.InvalidResume), a thread not suspended - come back unchanged, as does a cancellation; either way the thread stays, for another call.

Answers some of the pending interrupts of the suspended standalone run ref names - a TaskOutcome.Suspended's child - as Agent.resume takes them, and continues it with config; its outcome maps as run's does. A delegated child's ref is refused (ValidationError): its parent continues it (rule 19). The runtime's refusals - an answer to an interrupt that is not pending (GraphError.InvalidResume), a thread not suspended - come back unchanged, as does a cancellation; either way the thread stays, for another call.

Attributes

def run(input: I, config: RunConfig): Result[TaskOutcome[O]]

Runs the subagent once, on a new top-level thread of its runtime, with config, and returns its outcome: its report, the refusal its status or its typed answer's failure gives, or its suspension. The thread, named by the outcome's child.threadId (depth 0, no tool call), stays in the runtime until deleted; resume continues a suspended one. A run that fails with work left to recover is Refused(Failed), its child naming the failed run, for recover. Any other failure - a cancellation included - is Left, which names no thread, so that thread is forgotten once its run has ended (as for Agent.run(query)).

Runs the subagent once, on a new top-level thread of its runtime, with config, and returns its outcome: its report, the refusal its status or its typed answer's failure gives, or its suspension. The thread, named by the outcome's child.threadId (depth 0, no tool call), stays in the runtime until deleted; resume continues a suspended one. A run that fails with work left to recover is Refused(Failed), its child naming the failed run, for recover. Any other failure - a cancellation included - is Left, which names no thread, so that thread is forgotten once its run has ended (as for Agent.run(query)).

Attributes

Concrete fields

val definition: TypedAgent[I, O]