AgentIO

org.llm4s.effect.cats.AgentIO
See theAgentIO companion object
trait AgentIO[F[_]]

cats-effect wrapper for Agent.

Lifts every Result[AgentState] return value into F[AgentState], raising LLMError as LLMException in the error channel. The underlying Agent.run and related methods are blocking — each call is dispatched to the blocking thread pool via Async[F].interruptible, so cancelling the fiber interrupts the running agent loop.

Intentionally a thin wrapper: run does not expose handoffs, and continueConversation does not expose contextWindowConfig; the underlying Agent defaults apply. Tracing, debug logging and the trace log path are still available through the context parameter. Use Agent directly (inside Async[F].interruptible) when you need handoffs or context-window pruning.

Tool calls are not a failure of the effect: Agent hands a call with invalid arguments back to the model as a structured error tool result and the run continues. The experimental schema-validated AgentTool contract and the graph runtime (org.llm4s.agent.graph) are not wrapped here.

Attributes

Companion
object
Graph
Supertypes
class Object
trait Matchable
class Any

Members list

Value members

Abstract methods

def continueConversation(previousState: AgentState, newUserMessage: String, inputGuardrails: Seq[InputGuardrail], outputGuardrails: Seq[OutputGuardrail], maxSteps: Option[Int], context: AgentContext): F[AgentState]
def run(query: String, tools: ToolRegistry, inputGuardrails: Seq[InputGuardrail], outputGuardrails: Seq[OutputGuardrail], maxSteps: Option[Int], systemPromptAddition: Option[String], completionOptions: CompletionOptions, context: AgentContext): F[AgentState]