followUpRun static method

AgentScript followUpRun(
  1. String stepId,
  2. String startedAt, {
  3. String reply = 'Done.',
})

The flow of 04 16.5: queue, start, a status line and a step, a follow-up delivered and absorbed, a reply and the end.

Implementation

static AgentScript followUpRun(
  String stepId,
  String startedAt, {
  String reply = 'Done.',
}) => AgentScript([
  const AgentStep.queue(),
  const AgentStep.start(),
  const AgentStep.patch([
    {'op': 'add', 'path': '/status_line', 'value': 'Reading the thread'},
  ]),
  AgentStep.patch([
    {
      'op': 'add',
      'path': '/steps/$stepId',
      'value': {
        'id': stepId,
        'ordinal': 1,
        'kind': 'tool_call',
        'name': 'search',
        'title': 'Search the notes',
        'status': 'running',
        'started_at': startedAt,
      },
    },
  ]),
  const AgentStep.awaitFollowup(),
  const AgentStep.deliverFollowup(),
  const AgentStep.absorbFollowup(),
  AgentStep.patch([
    {'op': 'replace', 'path': '/steps/$stepId/status', 'value': 'completed'},
    {'op': 'replace', 'path': '/status_line', 'value': 'Writing the answer'},
  ]),
  AgentStep.reply(reply),
  const AgentStep.finish(),
]);