Skip to content

planner ​

plannerAgent drafts a plan, generates source, and requests approval with the plan, source, and detected effects before running it. It checks the result with verifierAgent and can regenerate the program after findings. A source-generation failure invokes codingAgent directly.

Use codingAgent for a task that does not need a generated orchestration program. An optional plan skips the initial planning call.

The model reports progress in a sentence beside each tool call, and nothing prints it by default. std::agents/lib/toolkits shows the callback that does.

Effects ​

std::agents::planApprove ​

Approve a generated program after inspecting its plan, source, and detected effects.

ts
/** Approve a generated program after inspecting its plan, source, and detected effects. */
effect std::agents::planApprove {
  plan: string;
  source: string;
  effects: string
}

(source)

Functions ​

buildTools ​

ts
buildTools(): any[]

Return the planner's project lookup, skill, and communication tools.

Returns: any[]

(source)

planCodePrompt ​

ts
planCodePrompt(task: string, planText: string): string

Build an instruction to generate an Agency program for a task and plan.

Parameters:

NameTypeDefault
taskstring
planTextstring

Returns: string

(source)

renderEffects ​

ts
renderEffects(effects: Result<EffectsByExport>): string

Render detected interrupt effects for approval, or explain that analysis failed.

Parameters:

NameTypeDefault
effectsResult<EffectsByExport>

Returns: string

(source)

runApproved ​

ts
runApproved(
  task: string,
  plan: string,
  src: string,
  state: PlanState,
): PlanState raises <std::agents::planApprove, std::guard, std::run>

Show a generated plan and source for approval, then run and verify it if approved.

Parameters:

NameTypeDefault
taskstring
planstring
srcstring
statePlanState

Returns: PlanState

Throws: std::agents::planApprove, std::run, std::guard

Needs: fileRead, fileWrite, subprocess

(source)

plannerAgent ​

ts
@guarded(cost: maxCost, time: maxTime)
plannerAgent(
  task: string,
  context: string = "",
  plan: string = "",
  maxCost: number = $100.00,
  maxTime: number = 60m,
  model: string = "",
  provider: string = "",
  session: string = "",
  extraTools: any[] = [],
): Result<string> raises <std::agents::planApprove, std::guard, std::run>

Generate an Agency program that composes agents to solve a complex task, request approval, run it, and check the result.

Parameters:

NameTypeDefaultDescription
taskstring
contextstring""
planstring""Seed plan that skips the planning call when nonempty.
maxCostnumber$100.00Cost budget in USD across the generated work.
maxTimenumber60mTime budget in milliseconds.
modelstring""Model override for the planning call only, or "" for the ambient model.
providerstring""Provider for the planning model, ignored when model is empty.
sessionstring""Named conversation for the planning call, unused when a seed plan is given.
extraToolsany[][]Tools added to the planning call only.

Returns: Result<string>

Throws: std::guard, std::agents::planApprove, std::run

Needs: fileRead, fileWrite, subprocess

(source)