API Reference beam_agent v#0.1.0

Copy Markdown View Source

Modules

BeamAgent is a general-purpose Elixir agent harness: an LLM-driven tool-use loop, deterministic context compression, guardrails, and post-run verification, built as OTP processes so each run is isolated — one crashing has no effect on any other — and supervised for automatic cleanup.

Public API for executing agents.

Owns the information sent to the model.

Thin dispatcher over the individual guardrail checks, each its own module: BeamAgent.Guardrails.MaxIterations, MaxContextMessages, MaxExecutionTime, and MaxToolCalls. All read their options from the same guardrails keyword list passed to BeamAgent.Runner.start_link/1 (via BeamAgent.API.run/2's :guardrails opt) — there's no shared config struct, each check just looks up its own key with its own default.

Ensures that the final model-facing context is within its configured message limit.

Prevents an agent from executing for longer than the allowed time.

Guardrail for enforcing maximum iteration limits.

Prevents an agent executing more than the allowed tool calls.

Behaviour implemented by every LLM provider.

Configuration for the LLM client.

Deterministic LLM implementation used to exercise the agent harness.

Represents a completed outcome of a single agent execution.

Converts internal execution state into a structured BeamAgent.Run representation, capturing the goal, answer, status, trace, and timestamps of the agent's execution.

Dynamically supervises individual agent executions.

Executes one isolated agent run.

Holds the runtime state for a single agent execution.

Behaviour implemented by every tool the agent can execute.

A tool that always raises. Exists to exercise runner crash isolation — that a tool blowing up takes down only its own run, not the caller or any other concurrent run (see BeamAgent.RunSupervisor).

A simple module for echoing values.

Dispatches a tool call to the module registered for it.

A tool that sleeps for a specified duration. Testing execution time guardrail

Provides tracing functionality for the agent.

Represents a single trace entry.

Verifies whether an agent execution satisfied the expected conditions.

Behaviour implemented by every verifier.

Default verifier: checks that the run finished, produced an answer, and called every tool listed under :required_tools.