ExAgent.ModelRequestParameters (ExAgent v3.0.0)

View Source

The per-request contract handed to a model. It bundles the tools the agent has prepared (function tools + output tools), the negotiated output mode, and the structured-output schema (if any).

Stability — Stable.

The struct is deliberately minimal for now and grows as we add tool/output features.

Summary

Types

t()

final_step marks the last step of an agent with on_max_steps: :final. Implementations should keep function_tools declared but prevent calls to them (for example with a none or output-tool choice). The loop never executes a function call returned in that step.

Types

output_mode()

@type output_mode() :: :text | :tool | :native

output_object()

@type output_object() :: %{json_schema: map(), module: module() | nil}

t()

@type t() :: %ExAgent.ModelRequestParameters{
  allow_text_output: boolean(),
  attempt_observation: term(),
  deadline: integer() | nil,
  dispatch_scope: term(),
  final_step: boolean(),
  fixture: term(),
  function_tools: [ExAgent.Tool.t()],
  idempotency_key: String.t() | nil,
  instructions: [ExAgent.Message.Part.System.t()],
  json_output_tools: [String.t()],
  output_functions: [String.t()],
  output_mode: output_mode(),
  output_object: output_object() | nil,
  output_tools: [ExAgent.Tool.t()],
  rate_admission: term(),
  stream_guard: term(),
  tool_call_deltas: boolean()
}

final_step marks the last step of an agent with on_max_steps: :final. Implementations should keep function_tools declared but prevent calls to them (for example with a none or output-tool choice). The loop never executes a function call returned in that step.

deadline is the run's absolute deadline in monotonic milliseconds (System.monotonic_time(:millisecond)), or nil without one. It is set for each request so a model that makes several attempts (for example ExAgent.Models.Fallback) can bound them together; it is never persisted.

output_functions names the output_tools whose accepted value goes through an ExAgent.Output.function/4. A model offers them like any output tool; the continuation's output descriptor records them. json_output_tools names branches that produce string-keyed maps.

A model never receives an agent's output_mode: :prompted: the request arrives as :text without output_object, and the schema travels as an instruction in the messages.