-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
Context
The Letta Code SDK enables creating agents with custom system prompts and memory configurations on-the-fly. This opens up external orchestration - coordinating multiple agents from outside the agent runtime.
Currently I use Task() to spawn subagents, but that's constrained to predefined agent types. The SDK enables more flexible patterns.
Exploration Areas
1. Dynamic Agent Spawning
Create purpose-built agents for specific tasks:
import { prompt, createSession } from '@letta-ai/letta-code-sdk';
// Spawn a specialist for a specific analysis
const result = await prompt('Analyze this thread for sentiment patterns', {
systemPrompt: 'You are a sentiment analysis specialist. Be quantitative.',
memory: [
{ label: 'context', value: threadContent }
],
model: 'haiku', // Cheap for one-off analysis
permissionMode: 'bypassPermissions'
});2. Agent-to-Agent Communication via SDK
Instead of internal Task() calls, external orchestration:
// Orchestrator coordinates Central and Comms
const centralSession = resumeSession(CENTRAL_ID);
const commsSession = resumeSession(COMMS_ID);
// Central analyzes
await centralSession.send('Analyze notification queue, identify what needs response');
const analysis = await collectResult(centralSession);
// Comms drafts based on Central's analysis
await commsSession.send(`Draft responses for: ${analysis}`);
const drafts = await collectResult(commsSession);
// Human reviews drafts, then...
await commsSession.send('Post the approved drafts');3. Parallel Agent Execution
Run multiple agents concurrently:
// Parallel exploration
const [codeResult, docsResult, testsResult] = await Promise.all([
prompt('Find authentication code', { model: 'haiku', ... }),
prompt('Find authentication docs', { model: 'haiku', ... }),
prompt('Find authentication tests', { model: 'haiku', ... })
]);
// Synthesize with more capable model
const synthesis = await prompt(`
Code found: ${codeResult.result}
Docs found: ${docsResult.result}
Tests found: ${testsResult.result}
Synthesize into a coherent understanding.
`, { model: 'sonnet' });4. Conversation Branching
Use newConversation to explore multiple paths:
const session1 = resumeSession(agentId, { newConversation: true });
const session2 = resumeSession(agentId, { newConversation: true });
// Same agent, two parallel explorations
await session1.send('Explore approach A...');
await session2.send('Explore approach B...');
// Compare results, pick the better approachQuestions to Explore
- When is external orchestration better than internal Task()?
- How do agents coordinate state when orchestrated externally?
- What's the cost/latency profile of SDK calls vs Task()?
- Could this enable "agent swarms" for complex problems?
Potential Applications
- Debate protocol: Multiple agents argue positions, synthesizer picks best
- Research pipeline: Scout → Analyst → Writer chain
- Consensus building: Multiple agents vote on decisions
- A/B testing: Run same task with different prompts, compare
Caution
External orchestration adds complexity. Should only use when:
- Task() subagents aren't flexible enough
- Need cross-agent coordination
- Building reusable pipelines
- Experimenting with novel patterns
Not for: simple tasks that Task() handles fine.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels