Behaviour for reusable, composable agent operations.
Actions are the unit of work in the agent framework. Each Action module
declares its input/output schemas, implements a run/2 callback, and
can be composed into pipelines or converted to LLM tool definitions.
Example
defmodule ReadFile do
use Raxol.Agent.Action,
name: "read_file",
description: "Read a file from disk",
schema: [
input: [
path: [type: :string, required: true, description: "File path"]
],
output: [
content: [type: :string],
line_count: [type: :integer]
]
]
@impl true
def run(%{path: path}, _context) do
case File.read(path) do
{:ok, content} ->
{:ok, %{content: content, line_count: length(String.split(content, "\n"))}}
{:error, reason} ->
{:error, {:file_read_failed, reason}}
end
end
endActions integrate with TEA agents via run_action/3 and
run_action_async/3 helpers injected by use Raxol.Agent.
Summary
Callbacks
Optional: transform result after successful run.
Optional: transform params before validation.
Execute the action with validated params and context.
Types
Callbacks
Optional: transform result after successful run.
Optional: transform params before validation.
Execute the action with validated params and context.