# `PtcRunner.SubAgentError`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/sub_agent/error.ex#L1)

Exception raised by `SubAgent.run!/2` and `SubAgent.then!/2` when execution fails.

Contains the failed `Step` for inspection and debugging.

## Fields

- `message`: Human-readable error description
- `step`: The `Step` struct containing failure details

## Example

    try do
      SubAgent.run!(agent, llm: llm)
    rescue
      e in SubAgentError ->
        IO.inspect(e.step.fail.reason)
        IO.inspect(e.step.fail.message)
    end

---

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