AshAi.ToolLoop (ash_ai v1.0.0)

Copy Markdown View Source

Manages a ReqLLM conversation loop with tool calls.

This module is the primary orchestration API for tool-enabled conversations.

Summary

Functions

Runs the tool loop synchronously.

Streams events from the tool loop.

Functions

run(messages, opts)

Runs the tool loop synchronously.

stream(messages, opts)

Streams events from the tool loop.

Events:

  • {:content, text}
  • {:tool_call, %{id: id, name: name, arguments: args}}
  • {:tool_result, %{id: id, result: result}}
  • {:iteration, %IterationEvent{}}
  • {:error, reason}
  • {:done, %Result{}}