PtcRunner.SubAgent.Runner (PtcRunner v0.12.0)

Copy Markdown View Source

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.

Summary

Functions

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

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

Functions

resolve_self_tools(tools, agent)

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

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

run(agent, opts)

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