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

Internal execution boundary for `%PtcRunner.SubAgent.Definition{}` agents.

Holds the Definition run path — validation, context preparation, the
single-shot fast path, and dispatch to `PtcRunner.SubAgent.Loop` — so that
internal callers (the public facade, the compiler) can execute a Definition
without going through `PtcRunner.SubAgent`. This keeps a single source of
truth for Definition execution and avoids the facade back-edge in the
SubAgent dependency cycle.

The string-convenience and `CompiledAgent` forms of `run/2` remain on the
public `PtcRunner.SubAgent` facade; only Definition execution lives here.

# `resolve_self_tools`

Resolves `:self` sentinels in a tools map to `SubAgentTool` structs.

Public so the facade's prompt-preview path can reuse the same resolution.

# `run`

```elixir
@spec run(
  PtcRunner.SubAgent.Definition.t(),
  keyword()
) :: {:ok, PtcRunner.Step.t()} | {:error, PtcRunner.Step.t()}
```

Executes a `%Definition{}` agent with the given runtime options.

Validates the LLM, prepares context (handling Step auto-chaining), then
dispatches to either the single-shot fast path or `Loop.run/2`. Returns
`{:ok, Step.t()}` or `{:error, Step.t()}`.

---

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