Skip to content

v0.3.0 — prompts move to the step

Choose a tag to compare

@timmcleod timmcleod released this 24 Jul 21:59

Breaking change: HasWorkflowPrompt is removed. An agent's prompt is workflow context, not agent behavior — so it's now defined on the step, and the same agent can be asked different things in different workflows:

AgentWorkflow::define('contract-review')
    ->step(ExtractClausesAgent::class,
        prompt: fn ($s) => 'Extract the key clauses: '.$s->get('document'))
    ->step(RiskAnalysisAgent::class,
        prompt: fn ($s) => 'Assess the risk of: '.$s->get('steps.ExtractClausesAgent.text'));
  • step($target, prompt:) — closure over workflow state, or a plain string for static prompts
  • when(..., thenPrompt:, elsePrompt:) — prompts for agent branch targets
  • evaluate(..., prompt:) — per-iteration prompt for the loop body
  • No prompt:? The state's prompt key is used as before.

Migration: move each agent's workflowPrompt() body into the prompt on the step that uses it, then delete the interface from the agent. String prompts now count toward the definition hash (changing one is a behavior change under strict drift mode).