Skip to content

Commit e03bcdf

Browse files
committed
refactor(agent-runtime): extract helpers from run-agent-step.ts (Commit 2.3)
Extracts 6 helper functions from run-agent-step.ts into agent-step-helpers.ts: - initializeAgentRun: Resolves agent template, starts run, builds system prompt and tools - buildInitialMessages: Constructs initial message history - buildToolDefinitions: Converts ToolSet to serializable format for token counting - prepareStepContext: Prepares context for agent step including token counting - handleOutputSchemaRetry: Handles missing output schema validation - Error utilities: extractErrorMessage, isPaymentRequiredError, getErrorStatusCode Includes comprehensive unit tests (35 tests) with section headers for readability. Fixes model parameter in callTokenCountAPI to ensure correct tokenizer is used.
1 parent 990494c commit e03bcdf

File tree

3 files changed

+1333
-261
lines changed

3 files changed

+1333
-261
lines changed

0 commit comments

Comments
 (0)