# `Jido.AI.Validation`
[🔗](https://github.com/agentjido/jido_ai/blob/v2.4.0/lib/jido_ai/validation.ex#L1)

Validation utilities for Jido.AI runtime inputs.

This module centralizes prompt/input validation, callback validation, and
resource-bound checks used across actions and strategies.

# `callback`

```elixir
@type callback() :: function()
```

# `prompt`

```elixir
@type prompt() :: String.t()
```

# `validation_result`

```elixir
@type validation_result() :: :ok | {:error, reason :: term()}
```

# `callback_timeout`

```elixir
@spec callback_timeout() :: integer()
```

Returns the default callback timeout in milliseconds.

# `max_hard_turns`

```elixir
@spec max_hard_turns() :: integer()
```

Returns the hard upper bound for max-turn validation.

# `max_input_length`

```elixir
@spec max_input_length() :: integer()
```

Returns the maximum allowed general input length.

# `max_prompt_length`

```elixir
@spec max_prompt_length() :: integer()
```

Returns the maximum allowed custom prompt length.

# `validate_and_sanitize_prompt`

```elixir
@spec validate_and_sanitize_prompt(prompt()) :: {:ok, prompt()} | {:error, atom()}
```

Validates prompt input and returns a sanitized version.

# `validate_and_wrap_callback`

```elixir
@spec validate_and_wrap_callback(callback(), keyword()) ::
  {:ok, callback()} | {:error, atom()}
```

Validates and wraps callbacks with timeout protection.

# `validate_callback`

```elixir
@spec validate_callback(callback()) :: validation_result()
```

Validates callback arity and type.

Wrapped callbacks are invoked with a single argument, so only arity-1
callbacks are valid.

# `validate_custom_prompt`

```elixir
@spec validate_custom_prompt(prompt(), keyword()) ::
  {:ok, prompt()} | {:error, atom()}
```

Validates custom prompts used for system-level behavior.

# `validate_max_turns`

```elixir
@spec validate_max_turns(integer()) :: {:ok, integer()} | {:error, atom()}
```

Validates and caps requested max-turn counts.

# `validate_prompt`

```elixir
@spec validate_prompt(prompt()) :: validation_result()
```

Validates prompt input without transforming it.

# `validate_string`

```elixir
@spec validate_string(String.t() | nil, keyword()) ::
  {:ok, String.t()} | {:error, atom()}
```

Validates generic string input with length and control-byte checks.

---

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