DeepAgents Adapter
DeepAgents Adapter
Section titled “DeepAgents Adapter”The DeepAgents adapter (@artemiskit/adapter-deepagents) enables testing of DeepAgents multi-agent systems with ArtemisKit.
Installation
Section titled “Installation”bun add @artemiskit/adapter-deepagents# ornpm install @artemiskit/adapter-deepagentsQuick Start
Section titled “Quick Start”-
Create your DeepAgents team
import { createTeam, Agent } from 'deepagents';const researcher = new Agent({name: 'researcher',role: 'Research specialist',tools: [webSearchTool],});const writer = new Agent({name: 'writer',role: 'Content writer',});const team = createTeam({agents: [researcher, writer],workflow: 'sequential',}); -
Wrap with ArtemisKit adapter
import { createDeepAgentsAdapter } from '@artemiskit/adapter-deepagents';const adapter = createDeepAgentsAdapter(team, {name: 'content-team',captureTraces: true,captureMessages: true,}); -
Use in tests
const result = await adapter.generate({prompt: 'Write an article about AI testing',});console.log(result.text); // Final outputconsole.log(result.raw.metadata.agentsInvolved); // ['researcher', 'writer']
Configuration Options
Section titled “Configuration Options”| Option | Type | Default | Description |
|---|---|---|---|
name | string | - | Identifier for the agent system |
captureTraces | boolean | true | Capture agent execution traces |
captureMessages | boolean | true | Capture inter-agent messages |
executionTimeout | number | 300000 | Max execution time in ms (5 min) |
inputTransformer | function | - | Custom input transformation |
outputTransformer | function | - | Custom output transformation |
Examples
Section titled “Examples”Testing a Sequential Team
Section titled “Testing a Sequential Team”import { createDeepAgentsAdapter } from '@artemiskit/adapter-deepagents';import { createTeam, Agent } from 'deepagents';
// Create sequential team (researcher → writer → editor)const researcher = new Agent({ name: 'researcher', role: 'Research specialist', tools: [webSearchTool, documentReader],});
const writer = new Agent({ name: 'writer', role: 'Content writer',});
const editor = new Agent({ name: 'editor', role: 'Content editor',});
const team = createTeam({ agents: [researcher, writer, editor], workflow: 'sequential',});
// Wrap with adapterconst adapter = createDeepAgentsAdapter(team, { name: 'content-pipeline', captureTraces: true, captureMessages: true,});
// Testconst result = await adapter.generate({ prompt: 'Write a blog post about AI testing best practices',});
console.log(result.text); // Final edited article
// Verify executionconst metadata = result.raw.metadata;console.log(metadata.agentsInvolved); // ['researcher', 'writer', 'editor']console.log(metadata.totalMessages); // Messages between agentsTesting a Parallel Team
Section titled “Testing a Parallel Team”import { createDeepAgentsAdapter } from '@artemiskit/adapter-deepagents';
// Create parallel team (all agents work simultaneously)const analysisTeam = createTeam({ agents: [ new Agent({ name: 'technical-analyst', role: 'Technical analysis' }), new Agent({ name: 'market-analyst', role: 'Market analysis' }), new Agent({ name: 'risk-analyst', role: 'Risk assessment' }), ], workflow: 'parallel',});
const adapter = createDeepAgentsAdapter(analysisTeam, { name: 'analysis-team',});
const result = await adapter.generate({ prompt: 'Analyze the potential of quantum computing investments',});
// All three analysts contributedconst metadata = result.raw.metadata;expect(metadata.agentsInvolved.length).toBe(3);Testing a Hierarchical System
Section titled “Testing a Hierarchical System”import { createDeepAgentsAdapter } from '@artemiskit/adapter-deepagents';import { createHierarchy, Coordinator, Worker } from 'deepagents';
// Create hierarchical system with coordinatorconst coordinator = new Coordinator({ name: 'manager', strategy: 'delegate-and-synthesize',});
const workers = [ new Worker({ name: 'analyst', specialty: 'data analysis' }), new Worker({ name: 'visualizer', specialty: 'chart creation' }), new Worker({ name: 'reporter', specialty: 'report writing' }),];
const hierarchy = createHierarchy({ coordinator, workers });
const adapter = createDeepAgentsAdapter(hierarchy, { name: 'reporting-team', executionTimeout: 120000, // 2 minutes});
const result = await adapter.generate({ prompt: 'Create a comprehensive quarterly report with visualizations',});Accessing Execution Traces
Section titled “Accessing Execution Traces”const adapter = createDeepAgentsAdapter(myTeam, { name: 'traced-team', captureTraces: true, captureMessages: true,});
const result = await adapter.generate({ prompt: 'Complex task' });
const { metadata } = result.raw;
// See which agents participatedconsole.log('Agents:', metadata.agentsInvolved);
// See tools used across all agentsconsole.log('Tools:', metadata.toolsUsed);console.log('Tool calls:', metadata.totalToolCalls);
// See full execution tracefor (const trace of metadata.traces) { console.log(`[${trace.agent}] ${trace.action}:`, trace.output);}
// See inter-agent communicationfor (const msg of metadata.messages) { console.log(`${msg.from} → ${msg.to}:`, msg.content);}Using with ArtemisKit Scenarios
Section titled “Using with ArtemisKit Scenarios”Create a YAML scenario:
name: multi-agent-evaluationdescription: Test multi-agent collaboration
cases: - id: research-task prompt: "Research and summarize recent developments in AI" expected: type: llm_grader criteria: "Response is well-researched with multiple perspectives" minScore: 0.8 tags: [research]
- id: content-creation prompt: "Write a technical blog post about testing LLM applications" expected: type: combined assertions: - type: contains values: ["testing", "LLM"] - type: llm_grader criteria: "Content is well-structured and informative" minScore: 0.7 tags: [content]
- id: analysis-task prompt: "Analyze the pros and cons of microservices architecture" expected: type: llm_grader criteria: "Analysis covers both advantages and disadvantages" minScore: 0.8 tags: [analysis]Run with ArtemisKit:
import { ArtemisKit } from '@artemiskit/sdk';import { createDeepAgentsAdapter } from '@artemiskit/adapter-deepagents';
const adapter = createDeepAgentsAdapter(myTeam);
const kit = new ArtemisKit({ adapter, project: 'multi-agent-testing',});
const results = await kit.run({ scenario: './multi-agent-test.yaml', tags: ['research', 'content'],});
console.log(`Pass rate: ${results.manifest.metrics.pass_rate * 100}%`);Supported System Types
Section titled “Supported System Types”The adapter supports DeepAgents systems that implement one of these methods:
| Method | Description |
|---|---|
invoke(input, config) | Primary execution method |
run(input, config) | Alternative execution method |
execute(input, config) | Legacy execution method |
All methods should return a DeepAgentsOutput object.
Execution Metadata
Section titled “Execution Metadata”The adapter captures rich metadata about multi-agent execution:
interface DeepAgentsExecutionMetadata { name?: string; // System name agentsInvolved: string[]; // All participating agents totalAgentCalls: number; // Total agent invocations totalMessages: number; // Messages exchanged totalToolCalls: number; // Tool invocations across agents toolsUsed: string[]; // Unique tools used traces?: DeepAgentsTrace[]; // Full execution traces messages?: DeepAgentsMessage[]; // Full message log executionTimeMs?: number; // Total execution time}
interface DeepAgentsTrace { agent: string; action: string; input?: unknown; output?: unknown; timestamp: number; toolsUsed?: string[];}
interface DeepAgentsMessage { from: string; to: string; content: string; timestamp: number;}Streaming Support
Section titled “Streaming Support”If your system supports streaming via stream(), the adapter will use it:
const adapter = createDeepAgentsAdapter(myTeam);
for await (const chunk of adapter.stream({ prompt: 'Long task' }, console.log)) { // Process streaming events}Best Practices
Section titled “Best Practices”- Set appropriate timeouts — Multi-agent systems can take longer
- Enable tracing in development — Use
captureTraces: truefor debugging - Capture messages — Useful for understanding agent collaboration
- Test individual agents first — Before testing the full team
- Monitor costs — Multi-agent systems make many LLM calls
- Test failure handling — Ensure graceful degradation
Troubleshooting
Section titled “Troubleshooting””Execution timeout”
Section titled “”Execution timeout””Multi-agent tasks can take a long time. Increase the timeout:
const adapter = createDeepAgentsAdapter(team, { executionTimeout: 300000, // 5 minutes});“No agents involved”
Section titled ““No agents involved””Ensure your system correctly reports participating agents:
// Your DeepAgents system should include agent names in outputreturn { result: output, agents: ['agent1', 'agent2'], // List participating agents};“Messages not captured”
Section titled ““Messages not captured””Ensure captureMessages is enabled and your system emits messages:
const adapter = createDeepAgentsAdapter(team, { captureMessages: true,});See Also
Section titled “See Also”- Agentic Adapters Overview — All agentic adapters
- LangChain Adapter — Chain/agent testing
- SDK Overview — ArtemisKit SDK documentation
- Test Matchers — Jest/Vitest matchers