Legion.Executor (Legion v0.4.0)

View Source

Drives the LLM thinking loop for a single agent turn.

Given a complete message history, calls the LLM, parses its response, runs sandboxed code if needed, and recurses until the LLM signals completion.

Returns the final result and updated message history so the caller can persist context across turns.

Summary

Functions

Runs the LLM loop against the given message history.

Functions

run(agent_module, messages, config, bindings \\ [])

Runs the LLM loop against the given message history.

messages must already include the system prompt and the current user message.

Returns {:ok, result, messages, bindings} or {:cancel, reason, messages, bindings}.