this repo has no description
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(bot): implement Letta agent creation workaround for Claude

- Create agent with letta-free first, then update llm_config
- Workaround for Letta bug where openai-proxy/ handles are rejected
- Use letta/letta-free for embeddings instead of OpenAI

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

alice cb0c0d91 44e9db85

+20 -9
+20 -9
src/bot.ts
··· 49 49 const usernameOrUnknown = username ?? 'unknown'; 50 50 console.log(`Creating new agent for user ${userId.toString()} (${usernameOrUnknown})`); 51 51 52 - // Create agent with basic configuration 53 - // For M1, we'll use a simple configuration. Later milestones will customize this. 54 - // Note: The model string should be in the format "provider/model-name" 55 - // The Letta server should be configured with the anthropic-proxy as a provider 52 + // Workaround for Letta bug: openai-proxy/ handles are rejected during creation 53 + // but work when set via llm_config modification. 54 + // Step 1: Create agent with letta-free model 56 55 const agentState = await client.agents.create({ 57 56 name: `user-${userId.toString()}-${usernameOrUnknown}`, 58 57 description: `ADHD support agent for Telegram user ${userId.toString()}`, 59 - // Using Claude Opus 4.5 via claude-proxy provider 60 - model: 'claude-proxy/claude-opus-4-5-20251101', 61 - embedding: 'openai/text-embedding-ada-002', 62 - // Memory blocks with system prompt for ADHD support 58 + model: 'letta/letta-free', 59 + embedding: 'letta/letta-free', 63 60 memory_blocks: [ 64 61 { 65 62 label: 'persona', ··· 75 72 ], 76 73 }); 77 74 78 - console.log(`Created agent ${agentState.id} for user ${userId.toString()}`); 75 + console.log(`Created agent ${agentState.id} with letta-free, modifying to use Claude...`); 76 + 77 + // Step 2: Update agent to use Claude Opus 4.5 via LiteLLM proxy 78 + await client.agents.update(agentState.id, { 79 + llm_config: { 80 + handle: 'openai/claude-opus-4-5-20251101', 81 + model: 'claude-opus-4-5-20251101', 82 + model_endpoint_type: 'openai', 83 + model_endpoint: 'http://litellm:4000', 84 + context_window: 200000, 85 + temperature: 0.7, 86 + }, 87 + }); 88 + 89 + console.log(`Agent ${agentState.id} configured with Claude Opus 4.5`); 79 90 80 91 // Store the mapping 81 92 userAgentMap.set(userId, agentState.id);