From e13ba1cd3fcc25f41a1c54549edb922daf69ea55 Mon Sep 17 00:00:00 2001 From: Claude Date: Thu, 1 Oct 2026 15:24:39 +0000 Subject: [PATCH] [EPIC-D][LOU-D34.2] Apps, examples and tests stop calling the deprecated setType() Drop setType(AgentType.SmartAssistant) and incidental agentType literals from Agent Forge, examples and tests (kept where a test is about the deprecated type: AgentBuilder.test.ts, data/mocks+models tests). ContextBuilder no longer casts agent.agentType; metadata omits agentType when unset. Co-Authored-By: Claude Fable 5.1 Claude-Session: https://claude.ai/code/session_016bY29ibQgv3MDdjAbUT4YR --- .../server/__tests__/approvalFlow.test.ts | 2 - apps/agent-forge/server/buildAgent.ts | 2 - apps/agent-forge/server/compileHooks.test.ts | 5 +- .../src/graph/__tests__/graphToFlow.test.ts | 3 +- examples/openrouter/index.ts | 3 +- examples/ops-pipeline/fixer.test.ts | 4 +- examples/ops-pipeline/fixer.ts | 3 +- examples/ops-pipeline/index.ts | 3 +- examples/ops-pipeline/monitor.test.ts | 3 +- examples/ops-pipeline/pipeline.eval.ts | 2 - .../ops-pipeline/slackInteractions.test.ts | 3 +- examples/tracing/weather-scenario.ts | 2 - src/context/compaction.test.ts | 2 - src/core/AgentBuilder.test.ts | 9 +--- src/deploy/kvCheckpointStore.test.ts | 2 - src/evals/scorers.test.ts | 2 - src/execution/AgentExecutor.test.ts | 46 ------------------- src/execution/ApprovalGate.test.ts | 3 -- src/execution/ContextBuilder.test.ts | 15 ++++-- src/execution/ContextBuilder.ts | 6 +-- src/execution/DelegationTool.test.ts | 21 ++++----- src/execution/agentStream.test.ts | 4 +- src/execution/cancellation.test.ts | 6 +-- src/execution/durableExecution.test.ts | 4 +- src/execution/genAiSemconv.test.ts | 3 +- src/execution/maxSteps.test.ts | 4 +- src/execution/modelSelection.test.ts | 2 - src/execution/otel.test.ts | 2 - src/execution/parallelToolCalls.test.ts | 4 +- src/execution/resume.test.ts | 15 ------ src/execution/sandbox-wiring.test.ts | 5 -- src/execution/subagentInheritance.test.ts | 7 ++- src/execution/toolArgsValidation.test.ts | 2 - src/execution/toolErrorResult.test.ts | 2 - src/execution/toolErrors.test.ts | 4 +- src/execution/usage.test.ts | 2 - src/flows/FlowExecutor.test.ts | 2 - src/providers/toolCallTurns.contract.test.ts | 2 - src/skills/skills.test.ts | 5 +- src/storage/sqlite/SqliteStore.test.ts | 2 - src/tools/defineTool.test.ts | 3 -- src/tools/mcp/mcpResult.test.ts | 2 - src/tools/workspace/shellTool.test.ts | 3 +- 43 files changed, 55 insertions(+), 171 deletions(-) diff --git a/apps/agent-forge/server/__tests__/approvalFlow.test.ts b/apps/agent-forge/server/__tests__/approvalFlow.test.ts index 8209cb7f9..233e0cfea 100644 --- a/apps/agent-forge/server/__tests__/approvalFlow.test.ts +++ b/apps/agent-forge/server/__tests__/approvalFlow.test.ts @@ -22,7 +22,6 @@ import { AgentExecutor, ToolRegistry, AgentBuilder, - AgentType, createMockProvider, resumeAfterApproval, type ToolDescriptor, @@ -65,7 +64,6 @@ describe('approval-gate pause/resume (FileApprovalStore + FileCheckpointStore)', const agent = AgentBuilder.create() .setId(agentId) - .setType(AgentType.SmartAssistant) .setName('gated-agent') .setPrompt('You are a helpful agent.') .setTools({ dangerous: { tool: 'dangerous' } }) diff --git a/apps/agent-forge/server/buildAgent.ts b/apps/agent-forge/server/buildAgent.ts index 18fb4b941..fc6f82b78 100644 --- a/apps/agent-forge/server/buildAgent.ts +++ b/apps/agent-forge/server/buildAgent.ts @@ -16,7 +16,6 @@ */ import { AgentBuilder, - AgentType, ToolRegistry, NoopSandbox, LLMProviderRegistry, @@ -180,7 +179,6 @@ export function buildAgentFromSpec( const agent = AgentBuilder.create() .setId(agentId) - .setType(AgentType.SmartAssistant) .setName(spec.name) .setPrompt(spec.prompt) .setTools(toolsConfig) diff --git a/apps/agent-forge/server/compileHooks.test.ts b/apps/agent-forge/server/compileHooks.test.ts index 7bc61895c..1f03a7c85 100644 --- a/apps/agent-forge/server/compileHooks.test.ts +++ b/apps/agent-forge/server/compileHooks.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it, vi } from 'vitest'; -import { AgentExecutor, NoopSandbox, ToolRegistry, AgentBuilder, AgentType, createMockProvider } from '@loushy/build-ai-agent'; +import { AgentExecutor, NoopSandbox, ToolRegistry, AgentBuilder, createMockProvider } from '@loushy/build-ai-agent'; import { compileHooksFromSpecPolicy, isSerializedHookList, type SerializedHook } from './compileHooks'; describe('isSerializedHookList', () => { @@ -46,7 +46,6 @@ describe('compileHooksFromSpecPolicy', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('sendEmail', { tool: 'sendEmail', options: {} }) .build(); @@ -102,7 +101,7 @@ describe('compileHooksFromSpecPolicy', () => { const generateSpy = vi.fn(provider.generate.bind(provider)); const spiedProvider = { ...provider, generate: generateSpy }; - const agent = AgentBuilder.create().setType(AgentType.SmartAssistant).setName('Test Agent').build(); + const agent = AgentBuilder.create().setName('Test Agent').build(); await AgentExecutor.execute({ agent, diff --git a/apps/agent-forge/src/graph/__tests__/graphToFlow.test.ts b/apps/agent-forge/src/graph/__tests__/graphToFlow.test.ts index 350b905b5..ae1de84e3 100644 --- a/apps/agent-forge/src/graph/__tests__/graphToFlow.test.ts +++ b/apps/agent-forge/src/graph/__tests__/graphToFlow.test.ts @@ -1,5 +1,5 @@ import { describe, expect, it } from 'vitest'; -import { AgentType, FlowExecutor, MockLLMProvider, type AgentConfig } from '@loushy/build-ai-agent'; +import { FlowExecutor, MockLLMProvider, type AgentConfig } from '@loushy/build-ai-agent'; import { graphToFlow, hasRouterNode } from '../graphToFlow'; import { graphToSpec } from '../graphToSpec'; import type { AgentGraphSpec } from '../types'; @@ -167,7 +167,6 @@ describe('a branching graph actually executes different paths via FlowExecutor a const agent: AgentConfig = { id: 'branch-agent', name: 'Branch Agent', - agentType: AgentType.SmartAssistant, prompt: 'You are a routing test agent.', settings: { model: 'mock-1' }, }; diff --git a/examples/openrouter/index.ts b/examples/openrouter/index.ts index 5acacd740..6f89abe39 100644 --- a/examples/openrouter/index.ts +++ b/examples/openrouter/index.ts @@ -8,7 +8,7 @@ * snippets: basic, streaming, compare, tools, agent-builder, models, * cost, errors, conversation, capabilities */ -import { LLMProviderRegistry, AgentBuilder, AgentType, Message } from '../../src/index'; +import { LLMProviderRegistry, AgentBuilder, Message } from '../../src/index'; const apiKey = process.env.OPENROUTER_API_KEY || ''; @@ -125,7 +125,6 @@ async function toolCalling() { /** Configuring an agent to use OpenRouter via AgentBuilder. */ async function agentBuilder() { const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Travel Assistant') .setPrompt(`You are a helpful travel assistant. You provide information about destinations, travel tips, and help plan trips. Be concise and informative.`) diff --git a/examples/ops-pipeline/fixer.test.ts b/examples/ops-pipeline/fixer.test.ts index 0cbd4c362..498d7a57a 100644 --- a/examples/ops-pipeline/fixer.test.ts +++ b/examples/ops-pipeline/fixer.test.ts @@ -82,7 +82,7 @@ describe('runFixer', () => { describe('createFixerDelegateTool', () => { it('delegates to the fixer agent and extracts a patch from its response', async () => { const provider = makeScriptedProvider(FENCED_DIFF_RESPONSE); - const fixerAgent = { name: 'fixer', agentType: 0 as any, prompt: 'fix it' }; + const fixerAgent = { name: 'fixer', prompt: 'fix it' }; const delegateTool = createFixerDelegateTool({ agent: fixerAgent, provider }); const result: any = await delegateTool.tool.execute!({ task: 'fix sig-1' }, {} as any); @@ -92,7 +92,7 @@ describe('createFixerDelegateTool', () => { it('throws EmptyPatchError when the delegated fixer agent has no extractable diff', async () => { const provider = makeScriptedProvider('I am not sure how to fix this.'); - const fixerAgent = { name: 'fixer', agentType: 0 as any, prompt: 'fix it' }; + const fixerAgent = { name: 'fixer', prompt: 'fix it' }; const delegateTool = createFixerDelegateTool({ agent: fixerAgent, provider }); await expect(delegateTool.tool.execute!({ task: 'fix sig-1' }, {} as any)).rejects.toBeInstanceOf( diff --git a/examples/ops-pipeline/fixer.ts b/examples/ops-pipeline/fixer.ts index be67104c2..2e769c8d8 100644 --- a/examples/ops-pipeline/fixer.ts +++ b/examples/ops-pipeline/fixer.ts @@ -20,7 +20,7 @@ import { ExecuteOptions, ExecutionResult, } from '../../src/execution/AgentExecutor'; -import { AgentConfig, AgentType, ToolDescriptor } from '../../src/types'; +import { AgentConfig, ToolDescriptor } from '../../src/types'; import { LLMProvider } from '../../src/providers'; import { createDelegateTool, @@ -48,7 +48,6 @@ const FIXER_SYSTEM_PROMPT = export function buildFixerAgent(name = 'fixer'): AgentConfig { return { name, - agentType: AgentType.SmartAssistant, prompt: FIXER_SYSTEM_PROMPT, }; } diff --git a/examples/ops-pipeline/index.ts b/examples/ops-pipeline/index.ts index 62a72764a..220191b4c 100644 --- a/examples/ops-pipeline/index.ts +++ b/examples/ops-pipeline/index.ts @@ -26,7 +26,7 @@ * GitHub token and LLM provider instead. */ import * as http from 'node:http'; -import { AgentType, ToolDescriptor } from '../../src/types'; +import { ToolDescriptor } from '../../src/types'; import { ToolRegistry } from '../../src/tools'; import { verifySlackSignature } from '../../src/triggers'; import { LLMProvider } from '../../src/providers/llm'; @@ -126,7 +126,6 @@ function buildGatedToolRegistry(provider: LLMProvider): ToolRegistry { const MONITOR_AGENT = { name: 'ops-monitor', - agentType: AgentType.SmartAssistant, prompt: 'You are an ops monitor. When an alert fires, delegate it to the fixer agent via the ' + `${DELEGATE_TOOL_NAME} tool.`, diff --git a/examples/ops-pipeline/monitor.test.ts b/examples/ops-pipeline/monitor.test.ts index 40e1da98b..0bf99bda6 100644 --- a/examples/ops-pipeline/monitor.test.ts +++ b/examples/ops-pipeline/monitor.test.ts @@ -1,7 +1,6 @@ import { describe, it, expect, vi } from 'vitest'; import { handleErrorSignal, buildMonitorPrompt, ErrorSignal, startMonitorServer } from './monitor'; import { AgentExecutor } from '../../src/execution/AgentExecutor'; -import { AgentType } from '../../src/types'; import { createMockProvider } from '../../src/providers/mock'; function makeSignal(overrides: Partial = {}): ErrorSignal { @@ -15,7 +14,7 @@ function makeSignal(overrides: Partial = {}): ErrorSignal { } const executeOptions = { - agent: { name: 'monitor', agentType: AgentType.SmartAssistant, prompt: 'You are the monitor.' }, + agent: { name: 'monitor', prompt: 'You are the monitor.' }, provider: createMockProvider({ responses: ['ack'] }), }; diff --git a/examples/ops-pipeline/pipeline.eval.ts b/examples/ops-pipeline/pipeline.eval.ts index fc9842ed8..04ffeaffe 100644 --- a/examples/ops-pipeline/pipeline.eval.ts +++ b/examples/ops-pipeline/pipeline.eval.ts @@ -28,7 +28,6 @@ import { describe, it, expect } from 'vitest'; import { defineEval } from '../../src/evals/defineEval'; import { toolCallOrder } from '../../src/evals/scorers'; -import { AgentType } from '../../src/types'; import { ToolRegistry } from '../../src/tools'; import { secretScanGuardrail, createDiffSizeGuardrail } from '../../src/execution/guardrails'; import { startOpsPipeline } from './index'; @@ -60,7 +59,6 @@ evalToolRegistry.register(DELEGATE_TOOL_NAME, evalDelegateTool); const evalMonitorAgent = { name: 'ops-monitor', - agentType: AgentType.SmartAssistant, prompt: `You are an ops monitor. When an alert fires, delegate it to the fixer agent via the ${DELEGATE_TOOL_NAME} tool.`, tools: { [DELEGATE_TOOL_NAME]: { tool: DELEGATE_TOOL_NAME } }, }; diff --git a/examples/ops-pipeline/slackInteractions.test.ts b/examples/ops-pipeline/slackInteractions.test.ts index a53182344..b64210bd0 100644 --- a/examples/ops-pipeline/slackInteractions.test.ts +++ b/examples/ops-pipeline/slackInteractions.test.ts @@ -9,7 +9,6 @@ import { import { ApprovalStore, ExecutionSnapshot, PendingApproval } from '../../src/execution/ApprovalGate'; import { ToolRegistry } from '../../src/tools'; import { createMockProvider } from '../../src/providers/mock'; -import { AgentType } from '../../src/types'; describe('extractApprovalIdFromInteraction', () => { it('extracts the approvalId from a fix_it block_actions click', () => { @@ -61,7 +60,7 @@ describe('handleSlackInteraction routes to the REAL resumeAfterApproval', () => createdAt: new Date().toISOString(), }; const snapshot: ExecutionSnapshot = { - agent: { name: 'fixer', agentType: AgentType.SmartAssistant, prompt: 'fix it' }, + agent: { name: 'fixer', prompt: 'fix it' }, currentMessages: [], pendingToolCall: pending, steps: 1, diff --git a/examples/tracing/weather-scenario.ts b/examples/tracing/weather-scenario.ts index edc70256b..cabaabb44 100644 --- a/examples/tracing/weather-scenario.ts +++ b/examples/tracing/weather-scenario.ts @@ -9,7 +9,6 @@ import { tool } from 'ai'; import { z } from 'zod'; import { AgentExecutor } from '../../src/execution/AgentExecutor'; import { AgentBuilder } from '../../src/core'; -import { AgentType } from '../../src/types'; import { ToolRegistry } from '../../src/tools'; import { LLMProvider, GenerateOptions, GenerateResult } from '../../src/providers'; import type { TraceExporter } from '../../src/execution/tracing'; @@ -74,7 +73,6 @@ function createWeatherToolRegistry(): ToolRegistry { function createWeatherAgent() { return AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Weather Agent') .setPrompt('You are a helpful weather assistant.') // A priced model id, so spans carry `loushy.cost_usd` (the provider is still a mock). diff --git a/src/context/compaction.test.ts b/src/context/compaction.test.ts index 922ee5144..5996f075d 100644 --- a/src/context/compaction.test.ts +++ b/src/context/compaction.test.ts @@ -14,7 +14,6 @@ import { AgentExecutor } from '../execution/AgentExecutor'; import { defineTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { mockModel } from '../testing'; -import { AgentType } from '../types'; const BIG = 'x'.repeat(4_000); // about 1,000 tokens @@ -222,7 +221,6 @@ describe('compaction in a run', () => { agent: { id: 'a', name: 'Agent', - agentType: AgentType.SmartAssistant, prompt: 'Read pages.', tools: { fetch_page: { tool: 'fetch_page' } }, }, diff --git a/src/core/AgentBuilder.test.ts b/src/core/AgentBuilder.test.ts index 074c85cbd..827e67fb4 100644 --- a/src/core/AgentBuilder.test.ts +++ b/src/core/AgentBuilder.test.ts @@ -19,9 +19,7 @@ describe('AgentBuilder', () => { it('should throw error when name is missing', () => { expect(() => { - new AgentBuilder() - .setType(AgentType.SmartAssistant) - .build(); + new AgentBuilder().build(); }).toThrow('Agent name is required'); }); @@ -47,7 +45,6 @@ describe('AgentBuilder', () => { it('should add tools correctly', () => { const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('calendar', { tool: 'calendarSchedule', @@ -62,7 +59,6 @@ describe('AgentBuilder', () => { it('should remove tools correctly', () => { const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('calendar', { tool: 'calendarSchedule', @@ -77,7 +73,6 @@ describe('AgentBuilder', () => { it('should set custom ID', () => { const customId = 'my-custom-id'; const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setId(customId) .build(); @@ -87,7 +82,6 @@ describe('AgentBuilder', () => { it('should set locale', () => { const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setLocale('ar') .build(); @@ -98,7 +92,6 @@ describe('AgentBuilder', () => { it('should set metadata', () => { const metadata = { key: 'value', number: 123 }; const agent = new AgentBuilder() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setMetadata(metadata) .build(); diff --git a/src/deploy/kvCheckpointStore.test.ts b/src/deploy/kvCheckpointStore.test.ts index 7e12a1037..1189297cc 100644 --- a/src/deploy/kvCheckpointStore.test.ts +++ b/src/deploy/kvCheckpointStore.test.ts @@ -18,7 +18,6 @@ import { ApprovalStore, PendingApproval, ExecutionSnapshot } from '../execution/ import { AgentExecutor } from '../execution/AgentExecutor'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; /** Simple in-memory stand-in for a real Cloudflare KV namespace binding. */ function createMockKV(): KVBinding & { data: Map; putCalls: [string, string][] } { @@ -163,7 +162,6 @@ describe('KVCheckpointStore', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .addTool('lookup', { tool: 'lookup', options: {} }) diff --git a/src/evals/scorers.test.ts b/src/evals/scorers.test.ts index 1abf1ab38..c9cb68ccf 100644 --- a/src/evals/scorers.test.ts +++ b/src/evals/scorers.test.ts @@ -4,7 +4,6 @@ import { AgentExecutor, ExecutionResult } from '../execution/AgentExecutor'; import { ToolCall, LLMProvider, GenerateOptions, GenerateResult } from '../providers/llm'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; function fakeResult( text: string, @@ -153,7 +152,6 @@ describe('toolCallOrder() against a genuine AgentExecutor.execute() result', () }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('search', { tool: 'search', options: {} }) .addTool('summarize', { tool: 'summarize', options: {} }) diff --git a/src/execution/AgentExecutor.test.ts b/src/execution/AgentExecutor.test.ts index 0ed406f9a..c4f78343e 100644 --- a/src/execution/AgentExecutor.test.ts +++ b/src/execution/AgentExecutor.test.ts @@ -5,7 +5,6 @@ import { CompactedLLMProviderError } from './errors'; import { createMockProvider } from '../providers/mock'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; import { Span, TraceExporter } from './tracing'; import { LLMProvider, GenerateResult } from '../providers'; @@ -25,7 +24,6 @@ describe('AgentExecutor', () => { describe('execute', () => { it('should execute simple agent', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setPrompt('You are a helpful assistant') .build(); @@ -45,7 +43,6 @@ describe('AgentExecutor', () => { it('should handle string input', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setPrompt('You are helpful') .build(); @@ -61,7 +58,6 @@ describe('AgentExecutor', () => { it('should handle message array input', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -80,7 +76,6 @@ describe('AgentExecutor', () => { it('should emit events', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -113,7 +108,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('getCurrentDate', { tool: 'getCurrentDate', options: {} }) .build(); @@ -136,7 +130,6 @@ describe('AgentExecutor', () => { it('should respect maxSteps', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -158,7 +151,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -173,7 +165,6 @@ describe('AgentExecutor', () => { it('should accumulate token usage', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -192,7 +183,6 @@ describe('AgentExecutor', () => { it('should include system prompt', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setPrompt('You are a pirate') .build(); @@ -220,7 +210,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -254,7 +243,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -292,7 +280,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -341,7 +328,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -369,7 +355,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -440,7 +425,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -505,7 +489,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -556,7 +539,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -692,7 +674,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -817,7 +798,6 @@ describe('AgentExecutor', () => { }; const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setPrompt('You are a pirate') .build(); @@ -845,7 +825,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -929,7 +908,6 @@ describe('AgentExecutor', () => { const checkpointStore = makeCheckpointStore(); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -975,7 +953,6 @@ describe('AgentExecutor', () => { it('should pass temperature and maxTokens', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1009,7 +986,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('slowTool', { tool: 'slowTool', options: {} }) .build(); @@ -1104,7 +1080,6 @@ describe('AgentExecutor', () => { it('propagates errors thrown by a hook callback', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1136,7 +1111,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('failingTool', { tool: 'failingTool', options: {} }) .build(); @@ -1262,7 +1236,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('echoTool', { tool: 'echoTool', options: {} }) .build(); @@ -1312,7 +1285,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('echoTool', { tool: 'echoTool', options: {} }) .build(); @@ -1356,7 +1328,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('echoTool', { tool: 'echoTool', options: {} }) .build(); @@ -1388,7 +1359,6 @@ describe('AgentExecutor', () => { it('works without an exporter (execute() behaves as before)', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1405,7 +1375,6 @@ describe('AgentExecutor', () => { describe('guiding runtime error messages (LOU-H12)', () => { it('throws naming "provider" with a corrective snippet when provider is omitted', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1428,7 +1397,6 @@ describe('AgentExecutor', () => { it('throws naming "input" with a corrective snippet when input is omitted', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1453,7 +1421,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1481,7 +1448,6 @@ describe('AgentExecutor', () => { const spiedProvider = { ...provider, generate: generateSpy }; const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1518,7 +1484,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('noop', { tool: 'noop', options: {} }) .build(); @@ -1578,7 +1543,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('sendEmail', { tool: 'sendEmail', options: {} }) .build(); @@ -1605,7 +1569,6 @@ describe('AgentExecutor', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1621,7 +1584,6 @@ describe('AgentExecutor', () => { it('does not run any hooks when none are provided (backward compatible default)', async () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1682,7 +1644,6 @@ describe('AgentExecutor', () => { const scripted = makeScriptedProvider([rawError]); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1715,7 +1676,6 @@ describe('AgentExecutor', () => { }); const scripted = makeScriptedProvider([rawError]); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1751,7 +1711,6 @@ describe('AgentExecutor', () => { responses: ['calling boom', 'done'], }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('boom', { tool: 'boom', options: {} }) .build(); @@ -1789,7 +1748,6 @@ describe('AgentExecutor', () => { const raw = abortError(); const scripted = makeScriptedProvider([raw]); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1804,7 +1762,6 @@ describe('AgentExecutor', () => { const generate = vi.fn(base.generate); const scripted: LLMProvider = { ...base, generate }; const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1832,7 +1789,6 @@ describe('AgentExecutor', () => { }); const scripted = makeScriptedProvider([rawError, 'success']); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1863,7 +1819,6 @@ describe('AgentExecutor', () => { }); const scripted = makeScriptedProvider([rawError]); // always throws const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); @@ -1895,7 +1850,6 @@ describe('AgentExecutor', () => { }); const scripted = makeScriptedProvider([rawError, 'success']); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .build(); diff --git a/src/execution/ApprovalGate.test.ts b/src/execution/ApprovalGate.test.ts index f6065222f..2635659b9 100644 --- a/src/execution/ApprovalGate.test.ts +++ b/src/execution/ApprovalGate.test.ts @@ -1,6 +1,5 @@ import { describe, it, expect } from 'vitest'; import { ExecutionSnapshot, StorageServiceApprovalStore, PendingApproval } from './ApprovalGate'; -import { AgentType } from '../types'; import { StorageService, FileSystemAdapter, PathAdapter } from '../storage/StorageService'; /** @@ -46,7 +45,6 @@ function buildSnapshot(pending: PendingApproval): ExecutionSnapshot { agent: { id: pending.agentId, name: 'Test Agent', - agentType: AgentType.SmartAssistant, }, currentMessages: [{ role: 'user', content: 'do the thing' }], pendingToolCall: pending, @@ -60,7 +58,6 @@ describe('Execution - ApprovalGate types', () => { agent: { id: 'agent-1', name: 'Test Agent', - agentType: AgentType.SmartAssistant, prompt: 'You are a helpful assistant', }, currentMessages: [ diff --git a/src/execution/ContextBuilder.test.ts b/src/execution/ContextBuilder.test.ts index b6bb37a23..80b7bd01f 100644 --- a/src/execution/ContextBuilder.test.ts +++ b/src/execution/ContextBuilder.test.ts @@ -17,7 +17,6 @@ describe('ContextBuilder', () => { testAgent = { id: 'agent-1', name: 'Test Agent', - agentType: 'smart-assistant' as any, metadata: { description: 'A helpful assistant', }, @@ -156,15 +155,25 @@ describe('ContextBuilder', () => { memoryManager, }); - expect(context.metadata).toEqual({ + expect(context.metadata).toStrictEqual({ agentId: 'agent-1', agentName: 'Test Agent', - agentType: 'smart-assistant', hasMemories: true, memoryCount: 0, historyCount: 0, }); }); + + it('should omit agentType from metadata when the agent has none, and keep a deprecated one', async () => { + const untyped = await ContextBuilder.build({ agent: testAgent, input: 'Hello!' }); + expect('agentType' in untyped.metadata).toBe(false); + + const typed = await ContextBuilder.build({ + agent: { ...testAgent, agentType: 'smart-assistant' as any }, + input: 'Hello!', + }); + expect(typed.metadata.agentType).toBe('smart-assistant'); + }); }); describe('System Prompt Building', () => { diff --git a/src/execution/ContextBuilder.ts b/src/execution/ContextBuilder.ts index 263a9182e..fc8a5ac96 100644 --- a/src/execution/ContextBuilder.ts +++ b/src/execution/ContextBuilder.ts @@ -31,7 +31,7 @@ export interface ExecutionContext { metadata: { agentId: string; agentName: string; - agentType: string; + agentType?: string; hasMemories: boolean; memoryCount: number; historyCount: number; @@ -104,7 +104,7 @@ export class ContextBuilder { const metadata = { agentId: agent.id || '', agentName: agent.name, - agentType: agent.agentType as string, + ...(agent.agentType !== undefined && { agentType: agent.agentType }), hasMemories: !!memoryManager, memoryCount: 0, // Will be updated if memories are recalled historyCount: sessionHistory.length, @@ -317,7 +317,7 @@ export class ContextBuilder { return { agentId, agentName, - agentType, + ...(agentType !== undefined && { agentType }), hasMemories: contexts.some((c) => c.metadata.hasMemories), memoryCount: contexts.reduce((sum, c) => sum + c.metadata.memoryCount, 0), historyCount: contexts.reduce((sum, c) => sum + c.metadata.historyCount, 0), diff --git a/src/execution/DelegationTool.test.ts b/src/execution/DelegationTool.test.ts index 460f799a4..c9b8b5512 100644 --- a/src/execution/DelegationTool.test.ts +++ b/src/execution/DelegationTool.test.ts @@ -1,7 +1,6 @@ import { describe, it, expect, vi, afterEach } from 'vitest'; import { createDelegateTool, DelegationDepthExceededError } from './DelegationTool'; import { AgentExecutor } from './AgentExecutor'; -import { AgentType } from '../types'; import { ToolRegistry } from '../tools'; import type { LLMProvider } from '../providers'; import { mockModel } from '../testing'; @@ -23,7 +22,6 @@ describe('createDelegateTool', () => { const childAgent = { name: 'Child Agent', - agentType: AgentType.SmartAssistant, prompt: 'You are a helpful child agent', }; @@ -54,7 +52,6 @@ describe('createDelegateTool', () => { const childAgent = { name: 'Bare Agent', - agentType: AgentType.SmartAssistant, }; const delegateTool = createDelegateTool({ agent: childAgent, provider }); @@ -67,7 +64,7 @@ describe('createDelegateTool', () => { it('passes context history then the task message, in order', async () => { const provider = mockModel(['done']); - const agent = { name: 'Contextual Agent', agentType: AgentType.SmartAssistant }; + const agent = { name: 'Contextual Agent' }; const delegateTool = createDelegateTool({ agent, provider, contextMode: 'full-history' }); const context = [ @@ -86,7 +83,7 @@ describe('createDelegateTool', () => { it('falls back to task-only input when contextMode is the default "none"', async () => { const provider = mockModel(['done']); - const agent = { name: 'Contextual Agent', agentType: AgentType.SmartAssistant }; + const agent = { name: 'Contextual Agent' }; const delegateTool = createDelegateTool({ agent, provider }); const context = [{ role: 'user' as const, content: 'earlier question' }]; @@ -124,8 +121,8 @@ describe('createDelegateTool', () => { it('propagates depth across an A -> B -> A chain and throws once maxDepth is exceeded', async () => { const provider = makeMockProvider(vi.fn()); - const agentA = { name: 'Agent A', agentType: AgentType.SmartAssistant }; - const agentB = { name: 'Agent B', agentType: AgentType.SmartAssistant }; + const agentA = { name: 'Agent A' }; + const agentB = { name: 'Agent B' }; const delegateToB = createDelegateTool({ agent: agentB, provider, maxDepth: 2 }); const delegateToA = createDelegateTool({ agent: agentA, provider, maxDepth: 2 }); @@ -151,7 +148,7 @@ describe('createDelegateTool', () => { it('succeeds when a delegation chain is exactly maxDepth hops long', async () => { const provider = makeMockProvider(vi.fn()); - const agent = { name: 'Recursive Agent', agentType: AgentType.SmartAssistant }; + const agent = { name: 'Recursive Agent' }; const maxDepth = 2; const totalHops = maxDepth; @@ -181,7 +178,7 @@ describe('createDelegateTool', () => { it('fails when a delegation chain goes one hop beyond maxDepth', async () => { const provider = makeMockProvider(vi.fn()); - const agent = { name: 'Recursive Agent', agentType: AgentType.SmartAssistant }; + const agent = { name: 'Recursive Agent' }; const maxDepth = 2; const totalHops = maxDepth + 1; @@ -211,7 +208,7 @@ describe('createDelegateTool', () => { it('defaults maxDepth to 3 when omitted', async () => { const provider = makeMockProvider(vi.fn()); - const agent = { name: 'Recursive Agent', agentType: AgentType.SmartAssistant }; + const agent = { name: 'Recursive Agent' }; const delegateTool = createDelegateTool({ agent, provider }); let callCount = 0; @@ -263,8 +260,8 @@ describe('createDelegateTool', () => { const providerA = mockModel([delegating('go to B')], { onExhausted: 'repeat-last' }); const providerB = mockModel([delegating('go to A')], { onExhausted: 'repeat-last' }); - const agentA = { name: 'Agent A', agentType: AgentType.SmartAssistant, tools: { delegate: { tool: 'delegate' } } }; - const agentB = { name: 'Agent B', agentType: AgentType.SmartAssistant, tools: { delegate: { tool: 'delegate' } } }; + const agentA = { name: 'Agent A', tools: { delegate: { tool: 'delegate' } } }; + const agentB = { name: 'Agent B', tools: { delegate: { tool: 'delegate' } } }; const registryA = new ToolRegistry(); const registryB = new ToolRegistry(); diff --git a/src/execution/agentStream.test.ts b/src/execution/agentStream.test.ts index b9d5d467b..0a29286cb 100644 --- a/src/execution/agentStream.test.ts +++ b/src/execution/agentStream.test.ts @@ -14,7 +14,7 @@ import { createAgent } from '../createAgent'; import { defineTool, DefinedTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { mockModel, MockModel, MockTurn } from '../testing'; -import { AgentConfig, AgentType } from '../types'; +import { AgentConfig } from '../types'; import type { LLMProvider, StreamChunk } from '../providers'; /** Reads every event, then checks the invariants every run must satisfy. */ @@ -56,7 +56,7 @@ function agentWith(provider: LLMProvider, tools: DefinedTool[] = []) { function executorOptions(provider: LLMProvider, tools: DefinedTool[]) { const toolConfig: AgentConfig['tools'] = {}; for (const t of tools) toolConfig[t.name] = { tool: t.name }; - const agent: AgentConfig = { id: 'agent-1', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools: toolConfig }; + const agent: AgentConfig = { id: 'agent-1', name: 'Agent', prompt: 'p', tools: toolConfig }; const toolRegistry = new ToolRegistry(); toolRegistry.registerMany(tools); return { agent, provider, toolRegistry, input: 'go' }; diff --git a/src/execution/cancellation.test.ts b/src/execution/cancellation.test.ts index bb0f0b93d..27d560cbf 100644 --- a/src/execution/cancellation.test.ts +++ b/src/execution/cancellation.test.ts @@ -19,7 +19,7 @@ import { Checkpoint, CheckpointStore } from './checkpoint'; import { createMockProvider } from '../providers/mock'; import { createAgent } from '../createAgent'; import { ToolRegistry } from '../tools'; -import { AgentConfig, AgentType, ToolDescriptor } from '../types'; +import { AgentConfig, ToolDescriptor } from '../types'; import type { GenerateOptions, GenerateResult, LLMProvider, ToolCall } from '../providers'; const usage = { promptTokens: 1, completionTokens: 1, totalTokens: 2 }; @@ -61,7 +61,7 @@ function agentWithTools(...toolNames: string[]): AgentConfig { for (const name of toolNames) { tools[name] = { tool: name }; } - return { id: 'agent-1', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools }; + return { id: 'agent-1', name: 'Agent', prompt: 'p', tools }; } function registryWith(tools: Record): ToolRegistry { @@ -341,7 +341,7 @@ describe('AgentExecutor cancellation (LOU-V1)', () => { it('a delegated child agent is aborted together with its parent', async () => { const child = scriptedProvider(hangUntilAborted); - const childAgent: AgentConfig = { name: 'Child', agentType: AgentType.SmartAssistant }; + const childAgent: AgentConfig = { name: 'Child' }; const delegate = createDelegateTool({ agent: childAgent, provider: child.provider }); const parent = scriptedProvider(async () => ({ ...toolCallResult({ diff --git a/src/execution/durableExecution.test.ts b/src/execution/durableExecution.test.ts index e7a7074da..ca0d7cfd9 100644 --- a/src/execution/durableExecution.test.ts +++ b/src/execution/durableExecution.test.ts @@ -20,7 +20,7 @@ import { KVCheckpointStore } from '../deploy/kvCheckpointStore'; import { defineTool, DefinedTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { mockModel, MockTurn } from '../testing'; -import { AgentConfig, AgentType } from '../types'; +import { AgentConfig } from '../types'; import type { Message } from '../providers'; type Runs = Record; @@ -54,7 +54,7 @@ function tool(name: string, runs: Runs, options: ToolOptions = {}): DefinedTool function agentFor(tools: DefinedTool[]): AgentConfig { const config: AgentConfig['tools'] = {}; for (const t of tools) config[t.name] = { tool: t.name }; - return { id: 'agent-1', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools: config }; + return { id: 'agent-1', name: 'Agent', prompt: 'p', tools: config }; } function registryOf(tools: DefinedTool[]): ToolRegistry { diff --git a/src/execution/genAiSemconv.test.ts b/src/execution/genAiSemconv.test.ts index a1d683e22..aeda859ce 100644 --- a/src/execution/genAiSemconv.test.ts +++ b/src/execution/genAiSemconv.test.ts @@ -6,7 +6,7 @@ import { CAPTURE_CONTENT_ENV } from './semconv'; import { FlowExecutor } from '../flows/FlowExecutor'; import { ToolRegistry, defineTool } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType, AgentFlow } from '../types'; +import { AgentFlow } from '../types'; import { mockModel } from '../testing'; /** In-memory exporter: remembers every span, in start order, in its final state. */ @@ -30,7 +30,6 @@ function setup(tools: ToolRegistry = new ToolRegistry()) { tools.register(weather); const agent = { ...AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Weather Bot') .addTool('get_weather', { tool: 'get_weather', options: {} }) .build(), diff --git a/src/execution/maxSteps.test.ts b/src/execution/maxSteps.test.ts index 126e0ba2d..c6e3d22c7 100644 --- a/src/execution/maxSteps.test.ts +++ b/src/execution/maxSteps.test.ts @@ -13,7 +13,7 @@ import { createAgent } from '../createAgent'; import { defineTool, DefinedTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { mockModel, MockTurn } from '../testing'; -import { AgentConfig, AgentType } from '../types'; +import { AgentConfig } from '../types'; const ping = defineTool({ name: 'ping', @@ -39,7 +39,7 @@ function registryOf(tools: DefinedTool[]): ToolRegistry { function options(tools: DefinedTool[], script: MockTurn[]) { const config: AgentConfig['tools'] = {}; for (const t of tools) config[t.name] = { tool: t.name }; - const agent: AgentConfig = { id: 'a', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools: config }; + const agent: AgentConfig = { id: 'a', name: 'Agent', prompt: 'p', tools: config }; return { agent, provider: mockModel(script, { onExhausted: 'repeat-last' }), toolRegistry: registryOf(tools), input: 'go' }; } diff --git a/src/execution/modelSelection.test.ts b/src/execution/modelSelection.test.ts index 580cfcd4f..72b9460fa 100644 --- a/src/execution/modelSelection.test.ts +++ b/src/execution/modelSelection.test.ts @@ -9,11 +9,9 @@ import { describe, it, expect, vi } from 'vitest'; import { AgentExecutor } from './AgentExecutor'; import { createMockProvider } from '../providers/mock'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; function agentWith(settings?: { model: string }) { const builder = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Model Agent') .setPrompt('You are helpful'); return (settings ? builder.setSettings(settings) : builder).build(); diff --git a/src/execution/otel.test.ts b/src/execution/otel.test.ts index 46ea634e8..92327757e 100644 --- a/src/execution/otel.test.ts +++ b/src/execution/otel.test.ts @@ -11,7 +11,6 @@ import { AgentExecutor } from './AgentExecutor'; import { Span, TraceExporter } from './tracing'; import { ToolRegistry, defineTool } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; import { mockModel } from '../testing'; /** @@ -243,7 +242,6 @@ describe('createOtelTraceExporter GenAI metrics (LOU-D48)', () => { toolRegistry.register(weather); const agent = { ...AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Weather Bot') .addTool('get_weather', { tool: 'get_weather', options: {} }) .build(), diff --git a/src/execution/parallelToolCalls.test.ts b/src/execution/parallelToolCalls.test.ts index 1b445f749..d9cbc08dc 100644 --- a/src/execution/parallelToolCalls.test.ts +++ b/src/execution/parallelToolCalls.test.ts @@ -14,7 +14,7 @@ import { createAgent } from '../createAgent'; import { defineTool, DefinedTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { mockModel, MockToolCall } from '../testing'; -import { AgentConfig, AgentType } from '../types'; +import { AgentConfig } from '../types'; import type { Message } from '../providers'; interface Deferred { @@ -69,7 +69,7 @@ function instantTool(name: string, log: string[], extra: { needsApproval?: boole function agentFor(tools: DefinedTool[]): AgentConfig { const config: AgentConfig['tools'] = {}; for (const t of tools) config[t.name] = { tool: t.name }; - return { id: 'agent-1', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools: config }; + return { id: 'agent-1', name: 'Agent', prompt: 'p', tools: config }; } function registryOf(tools: DefinedTool[]): ToolRegistry { diff --git a/src/execution/resume.test.ts b/src/execution/resume.test.ts index 7b5e1f86c..3e77bad71 100644 --- a/src/execution/resume.test.ts +++ b/src/execution/resume.test.ts @@ -6,7 +6,6 @@ import { Checkpoint, CheckpointStore } from './checkpoint'; import { createMockProvider } from '../providers/mock'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; /** Simple in-memory ApprovalStore, good enough for resume tests. */ function createInMemoryApprovalStore(): ApprovalStore { @@ -58,7 +57,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -112,7 +110,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -157,7 +154,6 @@ describe('Execution - resumeAfterApproval', () => { const systemPrompt = 'You are a careful billing assistant.'; const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .setPrompt(systemPrompt) .addTool('chargeCard', { tool: 'chargeCard', options: {} }) @@ -210,7 +206,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -267,7 +262,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('delegate', { tool: 'delegate', options: {} }) .build(); @@ -309,7 +303,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -432,7 +425,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('lookup', { tool: 'lookup', options: {} }) .addTool('chargeCard', { tool: 'chargeCard', options: {} }) @@ -593,7 +585,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .addTool('lookup', { tool: 'lookup', options: {} }) @@ -719,7 +710,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('lookup', { tool: 'lookup', options: {} }) .addTool('chargeCard', { tool: 'chargeCard', options: {} }) @@ -853,7 +843,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .addTool('lookup', { tool: 'lookup', options: {} }) @@ -951,7 +940,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -1014,7 +1002,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); @@ -1068,7 +1055,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('sendEmail', { tool: 'sendEmail', options: {} }) .build(); @@ -1148,7 +1134,6 @@ describe('Execution - resumeAfterApproval', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); diff --git a/src/execution/sandbox-wiring.test.ts b/src/execution/sandbox-wiring.test.ts index 9e28d1c76..a5a2c2c9a 100644 --- a/src/execution/sandbox-wiring.test.ts +++ b/src/execution/sandbox-wiring.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, vi } from 'vitest'; import { AgentExecutor } from './AgentExecutor'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; import { SandboxAdapter } from '../security/sandbox'; import { mockModel } from '../testing'; @@ -34,7 +33,6 @@ describe('AgentExecutor sandbox wiring (LOU-F5 / LOU-F fix)', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('sandboxed', { tool: 'sandboxed', options: {} }) .build(); @@ -92,7 +90,6 @@ describe('AgentExecutor sandbox wiring (LOU-F5 / LOU-F fix)', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('unsandboxable', { tool: 'unsandboxable', options: {} }) .build(); @@ -147,7 +144,6 @@ describe('AgentExecutor sandbox wiring (LOU-F5 / LOU-F fix)', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('plain', { tool: 'plain', options: {} }) .build(); @@ -191,7 +187,6 @@ describe('AgentExecutor sandbox wiring (LOU-F5 / LOU-F fix)', () => { }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('sandboxed-noop', { tool: 'sandboxed-noop', options: {} }) .build(); diff --git a/src/execution/subagentInheritance.test.ts b/src/execution/subagentInheritance.test.ts index 10ec8f190..eb961a3b2 100644 --- a/src/execution/subagentInheritance.test.ts +++ b/src/execution/subagentInheritance.test.ts @@ -13,13 +13,12 @@ import type { Span, TraceExporter } from './tracing'; import { createAgent } from '../createAgent'; import { defineTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools/ToolRegistry'; -import { AgentType } from '../types'; import { mockModel, type MockTurn } from '../testing'; import type { Message } from '../providers'; import { KVCheckpointStore } from '../deploy/kvCheckpointStore'; import { SessionAwaitingApprovalError } from './errors'; -const lead = { name: 'lead', agentType: AgentType.SmartAssistant, prompt: 'You coordinate.' }; +const lead = { name: 'lead', prompt: 'You coordinate.' }; const task = (agent: string, prompt = 'do it', id = `${agent}-call`) => ({ name: 'task', @@ -275,7 +274,7 @@ describe('sub-agents inherit the parent runtime (LOU-Y1)', () => { const seen: string[] = []; const hooks = new HookRegistry(); hooks.register({ name: 'spy', preGenerate: (ctx) => void seen.push(ctx.subagent?.name ?? 'parent') }); - const child = { name: 'Billing', agentType: AgentType.SmartAssistant }; + const child = { name: 'Billing' }; const registry = new ToolRegistry(); registry.register( 'delegate', @@ -477,7 +476,7 @@ describe('approval inside a sub-agent (LOU-Y1)', () => { }, }) ); - const child = { name: 'Mailer', agentType: AgentType.SmartAssistant, tools: { send: { tool: 'send' } } }; + const child = { name: 'Mailer', tools: { send: { tool: 'send' } } }; const registry = new ToolRegistry(); registry.register( 'delegate', diff --git a/src/execution/toolArgsValidation.test.ts b/src/execution/toolArgsValidation.test.ts index 20e7cd676..973e12cd3 100644 --- a/src/execution/toolArgsValidation.test.ts +++ b/src/execution/toolArgsValidation.test.ts @@ -4,7 +4,6 @@ import { AgentExecutor, ExecutionEvent } from './AgentExecutor'; import { ToolArgumentsValidationError } from './index'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; import { HookRegistry } from './hooks'; const usage = { promptTokens: 1, completionTokens: 1, totalTokens: 2 }; @@ -50,7 +49,6 @@ function setup(descriptor: Parameters[1]) { const toolRegistry = new ToolRegistry(); toolRegistry.register('send', descriptor); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('send', { tool: 'send', options: {} }) .build(); diff --git a/src/execution/toolErrorResult.test.ts b/src/execution/toolErrorResult.test.ts index 13ca3763c..60cb3d3a1 100644 --- a/src/execution/toolErrorResult.test.ts +++ b/src/execution/toolErrorResult.test.ts @@ -5,7 +5,6 @@ import { PropagatingToolError } from './propagatingToolError'; import { HookRegistry } from './hooks'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; const usage = { promptTokens: 1, completionTokens: 1, totalTokens: 2 }; @@ -52,7 +51,6 @@ function setup(execute: () => Promise) { tool: { parameters: z.object({}), execute } as any, }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('boom', { tool: 'boom', options: {} }) .build(); diff --git a/src/execution/toolErrors.test.ts b/src/execution/toolErrors.test.ts index 26c032e38..10d3e7059 100644 --- a/src/execution/toolErrors.test.ts +++ b/src/execution/toolErrors.test.ts @@ -16,7 +16,7 @@ import { defineTool, DefinedTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools'; import { loadMcpTools } from '../tools/mcp/McpToolLoader'; import { mockModel, MockTurn } from '../testing'; -import { AgentConfig, AgentType } from '../types'; +import { AgentConfig } from '../types'; import type { Message } from '../providers'; const input = z.object({ n: z.number() }); @@ -34,7 +34,7 @@ function simpleTool(name: string, extra: Partial[0 function agentFor(names: string[]): AgentConfig { const tools: AgentConfig['tools'] = {}; for (const name of names) tools[name] = { tool: name }; - return { id: 'agent-1', name: 'Agent', agentType: AgentType.SmartAssistant, prompt: 'p', tools }; + return { id: 'agent-1', name: 'Agent', prompt: 'p', tools }; } function registryOf(tools: DefinedTool[]): ToolRegistry { diff --git a/src/execution/usage.test.ts b/src/execution/usage.test.ts index 489d47944..543b2fe76 100644 --- a/src/execution/usage.test.ts +++ b/src/execution/usage.test.ts @@ -10,7 +10,6 @@ import type { Span, TraceExporter } from './tracing'; import type { Checkpoint, CheckpointStore } from './checkpoint'; import { ToolRegistry } from '../tools'; import { defineTool } from '../tools/defineTool'; -import { AgentType } from '../types'; import type { AgentConfig } from '../types'; import { mockModel } from '../testing'; import { formatUsage, normalizeUsage } from '../models'; @@ -25,7 +24,6 @@ const echo = defineTool({ const agent = (overrides: Partial = {}): AgentConfig => ({ id: 'a', name: 'Agent', - agentType: AgentType.SmartAssistant, tools: { echo: { tool: 'echo' } }, ...overrides, }); diff --git a/src/flows/FlowExecutor.test.ts b/src/flows/FlowExecutor.test.ts index dc304325b..5d29089d5 100644 --- a/src/flows/FlowExecutor.test.ts +++ b/src/flows/FlowExecutor.test.ts @@ -698,7 +698,6 @@ describe('FlowExecutor', () => { // the event `data` payloads legitimately differ, since the tools do // different things). const { createDelegateTool } = await import('../execution/DelegationTool'); - const { AgentType } = await import('../types'); const childProvider = new MockLLMProvider({ name: 'mock-child', @@ -707,7 +706,6 @@ describe('FlowExecutor', () => { const childAgent = { name: 'Delegate Test Agent', - agentType: AgentType.SmartAssistant, prompt: 'You are a test child agent', }; diff --git a/src/providers/toolCallTurns.contract.test.ts b/src/providers/toolCallTurns.contract.test.ts index ad06a36dc..680b657ec 100644 --- a/src/providers/toolCallTurns.contract.test.ts +++ b/src/providers/toolCallTurns.contract.test.ts @@ -35,7 +35,6 @@ import type { Checkpoint } from '../execution/checkpoint'; import { AgentExecutor } from '../execution/AgentExecutor'; import { ToolRegistry } from '../tools'; import { AgentBuilder } from '../core'; -import { AgentType } from '../types'; const usage = { promptTokens: 1, completionTokens: 2, totalTokens: 3 }; @@ -223,7 +222,6 @@ describe('AgentExecutor -> provider: second step sees the first step tool calls' }), }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Weather') .addTool('get_weather', { tool: 'get_weather', options: {} }) .build(); diff --git a/src/skills/skills.test.ts b/src/skills/skills.test.ts index 40168171e..55330d795 100644 --- a/src/skills/skills.test.ts +++ b/src/skills/skills.test.ts @@ -6,7 +6,6 @@ import { z } from 'zod'; import { createAgent } from '../createAgent'; import { AgentExecutor } from '../execution/AgentExecutor'; import { AgentBuilder } from '../core/AgentBuilder'; -import { AgentType } from '../types'; import { defineTool } from '../tools/defineTool'; import { ToolRegistry } from '../tools/ToolRegistry'; import { mockModel } from '../testing'; @@ -127,7 +126,7 @@ describe('skills wiring (createAgent)', () => { describe('skills wiring (AgentExecutor.execute)', () => { it('supports the skills option without mutating the caller registry or agent', async () => { const model = mockModel(['hi']); - const agent = AgentBuilder.create().setType(AgentType.SmartAssistant).setName('a').setPrompt('base').build(); + const agent = AgentBuilder.create().setName('a').setPrompt('base').build(); const registry = new ToolRegistry(); await AgentExecutor.execute({ agent, input: 'x', provider: model, toolRegistry: registry, skills: [review] }); @@ -139,7 +138,7 @@ describe('skills wiring (AgentExecutor.execute)', () => { it('uses the block alone when the agent has no prompt', async () => { const model = mockModel(['hi']); - const agent = AgentBuilder.create().setType(AgentType.SmartAssistant).setName('a').build(); + const agent = AgentBuilder.create().setName('a').build(); await AgentExecutor.execute({ agent, input: 'x', provider: model, skills: [review] }); expect(systemOf(model.calls[0]).startsWith('## Available skills')).toBe(true); }); diff --git a/src/storage/sqlite/SqliteStore.test.ts b/src/storage/sqlite/SqliteStore.test.ts index 08d6a16b3..9b0578ca7 100644 --- a/src/storage/sqlite/SqliteStore.test.ts +++ b/src/storage/sqlite/SqliteStore.test.ts @@ -27,7 +27,6 @@ import { AgentExecutor } from '../../execution/AgentExecutor'; import { resumeAfterApproval } from '../../execution/resume'; import { ToolRegistry } from '../../tools'; import { AgentBuilder } from '../../core'; -import { AgentType } from '../../types'; import { mockModel } from '../../testing'; const tempDirs: string[] = []; @@ -268,7 +267,6 @@ describe('SqliteStore end to end', () => { needsApproval: true, }); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('chargeCard', { tool: 'chargeCard', options: {} }) .build(); diff --git a/src/tools/defineTool.test.ts b/src/tools/defineTool.test.ts index 9899455a8..484a8a09d 100644 --- a/src/tools/defineTool.test.ts +++ b/src/tools/defineTool.test.ts @@ -6,7 +6,6 @@ import { createAgent } from '../createAgent'; import { createMockProvider } from '../providers/mock'; import { AgentBuilder } from '../core/AgentBuilder'; import { createDelegateTool } from '../execution/DelegationTool'; -import { AgentType } from '../types'; const input = z.object({ to: z.string(), subject: z.string() }); @@ -137,7 +136,6 @@ describe('entry points', () => { it('AgentBuilder.addTool(tool) keys the config by tool name', () => { const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('a') .setPrompt('p') .addTool(makeEmail()) @@ -154,7 +152,6 @@ describe('entry points', () => { const registry = new ToolRegistry(); registry.register(makeEmail('child_tool')); const child = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('child') .setPrompt('p') .addTool(makeEmail('child_tool')) diff --git a/src/tools/mcp/mcpResult.test.ts b/src/tools/mcp/mcpResult.test.ts index 62fc83924..634554d9b 100644 --- a/src/tools/mcp/mcpResult.test.ts +++ b/src/tools/mcp/mcpResult.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, vi } from 'vitest'; import type { Client } from '@modelcontextprotocol/sdk/client/index.js'; import { AgentExecutor } from '../../execution/AgentExecutor'; import { AgentBuilder } from '../../core'; -import { AgentType } from '../../types'; import { mockModel } from '../../testing'; import { ToolRegistry } from '..'; import { loadMcpTools } from './McpToolLoader'; @@ -110,7 +109,6 @@ describe('MCP result handling (LOU-Z2)', () => { const toolRegistry = new ToolRegistry(); toolRegistry.registerMany(await loadMcpTools(client, 'srv')); const agent = AgentBuilder.create() - .setType(AgentType.SmartAssistant) .setName('Test Agent') .addTool('srv__do_it', { tool: 'srv__do_it', options: {} }) .build(); diff --git a/src/tools/workspace/shellTool.test.ts b/src/tools/workspace/shellTool.test.ts index 6b07a06a4..3b252e775 100644 --- a/src/tools/workspace/shellTool.test.ts +++ b/src/tools/workspace/shellTool.test.ts @@ -2,7 +2,6 @@ import { describe, it, expect, vi } from 'vitest'; import { createAgent } from '../../createAgent'; import { AgentExecutor } from '../../execution/AgentExecutor'; import { AgentBuilder } from '../../core'; -import { AgentType } from '../../types'; import { ToolRegistry } from '../ToolRegistry'; import { mockModel } from '../../testing'; import type { DefinedTool } from '../defineTool'; @@ -27,7 +26,7 @@ describe('createShellTool (LOU-X6)', () => { const toolRegistry = new ToolRegistry(); toolRegistry.register(tool); - const agent = AgentBuilder.create().setType(AgentType.SmartAssistant).setName('a').addTool(tool).build(); + const agent = AgentBuilder.create().setName('a').addTool(tool).build(); const provider = mockModel([{ toolCalls: [{ name: 'shell', args: { command: 'rm -rf build' } }] }, 'done']); const save = vi.fn().mockResolvedValue(undefined); const result = await AgentExecutor.execute({