Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions apps/agent-forge/server/__tests__/approvalFlow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
AgentExecutor,
ToolRegistry,
AgentBuilder,
AgentType,
createMockProvider,
resumeAfterApproval,
type ToolDescriptor,
Expand Down Expand Up @@ -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' } })
Expand Down
2 changes: 0 additions & 2 deletions apps/agent-forge/server/buildAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
*/
import {
AgentBuilder,
AgentType,
ToolRegistry,
NoopSandbox,
LLMProviderRegistry,
Expand Down Expand Up @@ -180,7 +179,6 @@ export function buildAgentFromSpec(

const agent = AgentBuilder.create()
.setId(agentId)
.setType(AgentType.SmartAssistant)
.setName(spec.name)
.setPrompt(spec.prompt)
.setTools(toolsConfig)
Expand Down
5 changes: 2 additions & 3 deletions apps/agent-forge/server/compileHooks.test.ts
Original file line number Diff line number Diff line change
@@ -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', () => {
Expand Down Expand Up @@ -46,7 +46,6 @@ describe('compileHooksFromSpecPolicy', () => {
});

const agent = AgentBuilder.create()
.setType(AgentType.SmartAssistant)
.setName('Test Agent')
.addTool('sendEmail', { tool: 'sendEmail', options: {} })
.build();
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 1 addition & 2 deletions apps/agent-forge/src/graph/__tests__/graphToFlow.test.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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' },
};
Expand Down
3 changes: 1 addition & 2 deletions examples/openrouter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 || '';

Expand Down Expand Up @@ -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.`)
Expand Down
4 changes: 2 additions & 2 deletions examples/ops-pipeline/fixer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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(
Expand Down
3 changes: 1 addition & 2 deletions examples/ops-pipeline/fixer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -48,7 +48,6 @@ const FIXER_SYSTEM_PROMPT =
export function buildFixerAgent(name = 'fixer'): AgentConfig {
return {
name,
agentType: AgentType.SmartAssistant,
prompt: FIXER_SYSTEM_PROMPT,
};
}
Expand Down
3 changes: 1 addition & 2 deletions examples/ops-pipeline/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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.`,
Expand Down
3 changes: 1 addition & 2 deletions examples/ops-pipeline/monitor.test.ts
Original file line number Diff line number Diff line change
@@ -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> = {}): ErrorSignal {
Expand All @@ -15,7 +14,7 @@ function makeSignal(overrides: Partial<ErrorSignal> = {}): 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'] }),
};

Expand Down
2 changes: 0 additions & 2 deletions examples/ops-pipeline/pipeline.eval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 } },
};
Expand Down
3 changes: 1 addition & 2 deletions examples/ops-pipeline/slackInteractions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 0 additions & 2 deletions examples/tracing/weather-scenario.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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).
Expand Down
2 changes: 0 additions & 2 deletions src/context/compaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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' } },
},
Expand Down
9 changes: 1 addition & 8 deletions src/core/AgentBuilder.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');
});

Expand All @@ -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',
Expand All @@ -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',
Expand All @@ -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();
Expand All @@ -87,7 +82,6 @@ describe('AgentBuilder', () => {

it('should set locale', () => {
const agent = new AgentBuilder()
.setType(AgentType.SmartAssistant)
.setName('Test Agent')
.setLocale('ar')
.build();
Expand All @@ -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();
Expand Down
2 changes: 0 additions & 2 deletions src/deploy/kvCheckpointStore.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<string, string>; putCalls: [string, string][] } {
Expand Down Expand Up @@ -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: {} })
Expand Down
2 changes: 0 additions & 2 deletions src/evals/scorers.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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: {} })
Expand Down
Loading
Loading