From 528ef1f40e2b872ff2bec30f8ead2a3c13e3ecc2 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sun, 8 Feb 2026 20:09:39 -0800 Subject: [PATCH] fix: add deprecation warning for agent.model + e2e model tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Warn at startup when agent.model is present in lettabot.yaml (deprecated, now ignored) - Add e2e tests for model listing and agent model retrieval - Remove stale model field from existing e2e test (BotConfig no longer has it) Written by Cameron ◯ Letta Code "The best way to predict the future is to invent it." -- Alan Kay --- e2e/bot.e2e.test.ts | 1 - e2e/models.e2e.test.ts | 30 ++++++++++++++++++++++++++++++ src/main.ts | 3 +++ 3 files changed, 33 insertions(+), 1 deletion(-) create mode 100644 e2e/models.e2e.test.ts diff --git a/e2e/bot.e2e.test.ts b/e2e/bot.e2e.test.ts index c5f6102..5719c7d 100644 --- a/e2e/bot.e2e.test.ts +++ b/e2e/bot.e2e.test.ts @@ -31,7 +31,6 @@ describe.skipIf(SKIP_E2E)('e2e: LettaBot with Letta Cloud', () => { // Initialize bot with test config bot = new LettaBot({ - model: 'claude-sonnet-4-20250514', // Good balance of speed/quality workingDir: tempDir, agentName: 'e2e-test', }); diff --git a/e2e/models.e2e.test.ts b/e2e/models.e2e.test.ts new file mode 100644 index 0000000..c174cfd --- /dev/null +++ b/e2e/models.e2e.test.ts @@ -0,0 +1,30 @@ +/** + * E2E Tests for Model API + * + * Tests model listing and retrieval against Letta Cloud. + * Requires LETTA_API_KEY and LETTA_E2E_AGENT_ID environment variables. + * + * Run with: npm run test:e2e + */ + +import { describe, it, expect } from 'vitest'; +import { listModels, getAgentModel } from '../src/tools/letta-api.js'; + +const SKIP_E2E = !process.env.LETTA_API_KEY || !process.env.LETTA_E2E_AGENT_ID; + +describe.skipIf(SKIP_E2E)('e2e: Model API', () => { + it('lists available models from Letta Cloud', async () => { + const models = await listModels(); + expect(models.length).toBeGreaterThan(0); + // Known providers should always exist on Letta Cloud + const handles = models.map(m => m.handle); + expect(handles.some(h => h.includes('anthropic') || h.includes('openai'))).toBe(true); + }, 30000); + + it('retrieves the current agent model', async () => { + const agentId = process.env.LETTA_E2E_AGENT_ID!; + const model = await getAgentModel(agentId); + expect(model).toBeTruthy(); + expect(typeof model).toBe('string'); + }, 30000); +}); diff --git a/src/main.ts b/src/main.ts index 70dbd8d..50a5021 100644 --- a/src/main.ts +++ b/src/main.ts @@ -21,6 +21,9 @@ const yamlConfig = loadConfig(); const configSource = existsSync(resolveConfigPath()) ? resolveConfigPath() : 'defaults + environment variables'; console.log(`[Config] Loaded from ${configSource}`); console.log(`[Config] Mode: ${yamlConfig.server.mode}, Agent: ${yamlConfig.agent.name}`); +if (yamlConfig.agent.model) { + console.warn('[Config] WARNING: agent.model in lettabot.yaml is deprecated and ignored. Use `lettabot model set ` instead.'); +} applyConfigToEnv(yamlConfig); // Sync BYOK providers on startup (async, don't block)