# `ADK.RunConfig`
[🔗](https://github.com/zeroasterisk/adk-elixir/blob/main/lib/adk/run_config.ex#L1)

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"}}}
      }
    )

# `get_session_config`

```elixir
@type get_session_config() :: %{
  optional(:num_recent_events) =&gt; non_neg_integer(),
  optional(:after_timestamp) =&gt; float()
}
```

# `output_config`

```elixir
@type output_config() :: %{
  optional(:response_mime_type) =&gt; String.t(),
  optional(:response_schema) =&gt; map()
}
```

# `proactivity_config`

```elixir
@type proactivity_config() :: %{optional(:proactive_audio) =&gt; boolean()}
```

# `session_resumption_config`

```elixir
@type session_resumption_config() :: %{optional(:transparent) =&gt; boolean()}
```

# `streaming_mode`

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

# `t`

```elixir
@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()
}
```

# `build`

```elixir
@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`

```elixir
@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`

```elixir
@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

---

*Consult [api-reference.md](api-reference.md) for complete listing*
