# `PtcRunner.SubAgent.Loop.ReturnValidation`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/sub_agent/loop/return_validation.ex#L1)

Return type validation for SubAgent execution.

Validates return values against the agent's parsed signature and
formats validation errors for LLM feedback.

# `format_error_for_llm`

```elixir
@spec format_error_for_llm(PtcRunner.SubAgent.Definition.t(), term(), [
  PtcRunner.SubAgent.Signature.validation_error()
]) :: String.t()
```

Format validation error for LLM feedback.

Builds an actionable error message that helps the LLM fix the return type.

# `validate`

```elixir
@spec validate(PtcRunner.SubAgent.Definition.t(), term()) ::
  :ok | {:error, [PtcRunner.SubAgent.Signature.validation_error()]}
```

Validate return value against agent's parsed signature.

Returns `:ok` or `{:error, [validation_error()]}`.

---

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