ExAgent.ModelRequestParameters (ExAgent v2.2.2)

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).

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 | :prompted | :auto

output_object()

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

t()

@type t() :: %ExAgent.ModelRequestParameters{
  allow_text_output: boolean(),
  deadline: integer() | nil,
  final_step: boolean(),
  function_tools: [ExAgent.Tool.t()],
  idempotency_key: String.t() | nil,
  instructions: [ExAgent.Message.Part.System.t()],
  output_mode: output_mode(),
  output_object: output_object() | nil,
  output_tools: [ExAgent.Tool.t()],
  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.