Search by

adachsoft / ai-agent-final-report

Arkadiusz Adach

Generates a final report when an AI agent run stops at a configured limit.

Package info

gitlab.com/a.adach/ai-agent-final-report

Issues

pkg:composer/adachsoft/ai-agent-final-report

Statistics

Installs: 21

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.1 2026-11-27 22:04 UTC

This package is auto-updated.

Last update: 2026-11-27 21:05:26 UTC


README

A framework-independent package that generates a short final report when an adachsoft/ai-agent run stops because of a configured limit. The model is invoked without tools on a temporary copy of the conversation, which is deleted after the attempt. The report can optionally be appended to the original conversation.

Installation

Install the package with Composer:

composer require adachsoft/ai-agent-final-report

Requirements

This package requires PHP 8.3 or later.

Configuration

Add the extension to an agent definition:

{
  "extensions": {
    "final_report": {
      "on": ["step_budget", "duration_budget"],
      "append_to_conversation": true
    }
  }
}

The on setting is required and must be a non-empty list of non-empty limit-reason strings. prompt is optional; its default asks for completed work, remaining work, exact work state, and the next step. The {limit_reason} placeholder is replaced before invoking the model. append_to_conversation defaults to true.

Usage

The following integration example shows how to call the service after an agent run reaches a configured limit.

Application integration

The application must:

  1. Provide a ReportModelInvokerInterface implementation that invokes the configured agent model with tools disabled, using the supplied temporary conversation ID and prompt.
  2. Call FinalReportService::generate() after a run finishes with a limit reason, passing the source conversation ID, agent ID, limit reason, and the agent's extensions.
  3. Handle the returned report, which is null when the extension does not apply, its configuration is invalid, the invocation fails, or the model returns no text.

For example:

$report = $finalReportService->generate(
    conversationId: $conversationId,
    agentId: $agentId,
    limitReason: $limitReason,
    extensions: $agentExtensions,
);

When append_to_conversation is enabled, the service appends one assistant message to the original conversation with runtime_notice and limit_reason metadata. The invocation prompt and any model interaction remain on the temporary conversation and are not added to the original history.

This package depends only on adachsoft/ai-agent; the application owns the model invoker and the integration with its run lifecycle.