ExAgent.RunContext (ExAgent v0.1.0)

Copy Markdown View Source

The context object threaded through dynamic instructions, tool calls and output validators during a single run.

It carries the user-supplied deps, the model, the full message history, the accumulated token usage, per-tool retry counters and the current step/position info. The :deps value is application-defined; document its expected shape with @spec in your tools.

Summary

Functions

Build a fresh context for a run.

Types

t()

@type t() :: %ExAgent.RunContext{
  deps: term(),
  max_retries: non_neg_integer(),
  messages: [ExAgent.Message.t()],
  metadata: map(),
  model: ExAgent.Model.model(),
  prompt: String.t() | nil,
  retries: %{required(String.t()) => non_neg_integer()},
  retry: non_neg_integer(),
  run_step: non_neg_integer(),
  tool_call_id: String.t() | nil,
  tool_name: String.t() | nil,
  usage: ExAgent.Message.Usage.t()
}

Functions

new(opts \\ [])

@spec new(keyword()) :: t()

Build a fresh context for a run.