Skip to content

Commit c9500a4

Browse files
committed
refactor(agent-runtime): extract helpers from run-agent-step.ts (Commit 2.3)
Creates agent-step-helpers.ts with extracted functions: - initializeAgentRun: Sets up agent template, system prompt, and tools - buildInitialMessages: Constructs initial message history - buildToolDefinitions: Converts ToolSet to serializable format - prepareStepContext: Prepares context for an agent step (token counting) - handleOutputSchemaRetry: Handles missing output schema validation - Error utilities: extractErrorMessage, isPaymentRequiredError, getErrorStatusCode Improvements: - Adds comprehensive unit tests (35 tests) for all pure helpers - Adds explicit interface types (InitializeAgentRunFullParams, SerializableToolDefinition, etc.) - Adds JSDoc documentation with usage examples - Organizes code with section headers - Makes dependencies explicit in interface definitions
1 parent 990494c commit c9500a4

File tree

3 files changed

+1332
-261
lines changed

3 files changed

+1332
-261
lines changed

0 commit comments

Comments
 (0)