enhancement
major
minor
defect
critical
major
minor
Problem
The tests of the engine run agents on recorded model answers. tl-ai-eval has a ScriptedProvider among its test sources, and several tests of tl-ai-core have their own nested providers (TestReplyWithoutAnswer, TestModelFailover, TestTaskPlanWithoutApproval, ...). None of them is in a jar an application can depend on.
So an application that tests its own agent definition, skills and tools without a real model has to write such a provider itself. The control application tl-factory (TopLogic/tl-factory#24) does exactly that, with a copy of the pattern of about 140 lines.
Proposal
Ship one reusable provider for recorded answers in a jar applications can use in their tests: the test-jar of tl-ai-core, or a small test-support module. It:
- plays a scripted sequence of answers (text and tool calls) for the requests of a run;
- records the requests it received, so a test can assert what was sent to the model, e.g. that no credential appears;
- is configurable as a model of LLMProviderService in a test configuration.
The engine's own tests that carry nested copies use it.
Test
One engine agent test moved to the shared provider passes unchanged. The provider is usable from a module that depends only on the published artifact.
Lösung
- Der Provider liegt in den Testquellen von tl-ai-core (Paket com.top_logic.tl.ai.core.provider) und wird damit im Test-Jar von tl-ai-core (Classifier tests) ausgeliefert, das jedes Modul ohnehin veröffentlicht. Eine Anwendung bindet ihn mit <type>test-jar</type><scope>test</scope> ein; er braucht nur Hauptklassen von tl-ai-core.
- ScriptedModel: ein LLMProvider mit einem Skript, das pro Anfrage die Antwort (Text, Tool-Aufrufe, Thinking, Finish-Reason) liefert oder eine ProviderException wirft, und der die empfangenen Anfragen aufzeichnet. Direkt an einen AgentLoop übergebbar. Eine Hilfsfunktion baut ein Skript aus einer festen Folge von Antworten.
- ScriptedProvider: die LLMProviderConfig für eine Testkonfiguration von LLMProviderService; delegiert an ein statisch installiertes ScriptedModel. install(script) setzt die Aufzeichnung zurück, requests() liefert die gesendeten Anfragen.
- Der bisherige ScriptedProvider aus tl-ai-eval zieht dorthin um; die Tests von tl-ai-eval und die geschachtelten Kopien in tl-ai-core verwenden den gemeinsamen Provider, soweit ihr Verhalten als Skript ausdrückbar ist (Fehlschlagen/Ablehnen als ProviderException, Failover über request.model()).
- Ein Abschnitt in den Entwicklerartikeln des Kapitels ai beschreibt das Testen eigener Agenten ohne Modell (Abhängigkeit, Konfiguration, install / requests).