ADK.RunConfig (ADK v0.0.1-alpha.1)

Copy Markdown View Source

Configuration struct for controlling Runner execution behavior.

Mirrors Python ADK's RunConfig for parity. All new fields are optional (nil by default) and only take effect when explicitly set.

Fields

  • :streaming_mode:none, :sse, or :live (default: :none)
  • :max_llm_calls — Maximum number of LLM calls per run (default: 500). Values ≤ 0 are allowed (meaning unbounded) but emit a warning. Values ≥ @max_integer are rejected.
  • :output_format — Output format hint, e.g. "text", "json" (default: "text")
  • :speech_config — Speech configuration map (voice, language) (default: nil)
  • :generate_config — Generation config overrides (temperature, etc.) (default: %{})
  • :response_modalities — Output modalities, e.g. ["text"], ["audio"] (default: nil)
  • :output_config — Structured output config: response_mime_type, response_schema (default: nil)
  • :support_cfc — Enable Compositional Function Calling via Live API (default: false)
  • :custom_metadata — Arbitrary metadata map for the invocation (default: nil)
  • :get_session_config — Configuration for getting a session (num_recent_events, after_timestamp) (default: nil)
  • :output_audio_transcription — Audio transcription config for output (default: %{})
  • :input_audio_transcription — Audio transcription config for input (default: %{})

Examples

config = ADK.RunConfig.new(streaming_mode: :sse, max_llm_calls: 10)
ADK.Runner.run(runner, "user", "sess", "hello", run_config: config)

# Structured JSON output
config = ADK.RunConfig.new(
  output_config: %{
    response_mime_type: "application/json",
    response_schema: %{type: "object", properties: %{name: %{type: "string"}}}
  }
)

Summary

Functions

Create a RunConfig with validation, returning {:ok, config} or {:error, reason}.

Returns the max integer value (mirrors Python's sys.maxsize).

Create a new RunConfig.

Types

get_session_config()

@type get_session_config() :: %{
  optional(:num_recent_events) => non_neg_integer(),
  optional(:after_timestamp) => float()
}

output_config()

@type output_config() :: %{
  optional(:response_mime_type) => String.t(),
  optional(:response_schema) => map()
}

proactivity_config()

@type proactivity_config() :: %{optional(:proactive_audio) => boolean()}

session_resumption_config()

@type session_resumption_config() :: %{optional(:transparent) => boolean()}

streaming_mode()

@type streaming_mode() :: :none | :sse | :live

t()

@type t() :: %ADK.RunConfig{
  context_window_compression: map() | nil,
  custom_metadata: map() | nil,
  enable_affective_dialog: boolean() | nil,
  generate_config: map(),
  get_session_config: get_session_config() | nil,
  input_audio_transcription: map() | nil,
  max_llm_calls: integer(),
  output_audio_transcription: map() | nil,
  output_config: output_config() | nil,
  output_format: String.t(),
  proactivity: proactivity_config() | nil,
  realtime_input_config: map() | nil,
  response_modalities: [String.t()] | nil,
  session_resumption: session_resumption_config() | nil,
  speech_config: map() | nil,
  streaming_mode: streaming_mode(),
  support_cfc: boolean()
}

Functions

build(opts \\ [])

@spec build(keyword()) :: {:ok, t()} | {:error, String.t()}

Create a RunConfig with validation, returning {:ok, config} or {:error, reason}.

Examples

iex> {:ok, config} = ADK.RunConfig.build(streaming_mode: :live)
iex> config.streaming_mode
:live

iex> {:error, _} = ADK.RunConfig.build(streaming_mode: :invalid)

max_integer()

@spec max_integer() :: pos_integer()

Returns the max integer value (mirrors Python's sys.maxsize).

Values at or above this threshold are rejected by validate_max_llm_calls/1.

new(opts \\ [])

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

Create a new RunConfig.

Each instance gets its own independent output_audio_transcription and input_audio_transcription maps (not shared references).

Examples

iex> config = ADK.RunConfig.new()
iex> config.streaming_mode
:none

iex> config = ADK.RunConfig.new(streaming_mode: :sse, max_llm_calls: 5)
iex> config.max_llm_calls
5