TypeScript: Multi-agent teams and MCP servers

Coordinate specialists with AgentTeam

Just like Python's PraisonAIAgents, AgentTeam coordinates multiple TypeScript agents sequentially so the researcher's findings feed straight into the writer.

Example

import { Agent, AgentTeam } from 'praisonai';

const researcher = new Agent({
  name: 'Researcher',
  instructions: 'List 3 key facts about WebAssembly edge functions.',
});

const writer = new Agent({
  name: 'Writer',
  instructions: 'Turn the research notes into a 2-sentence product pitch.',
});

const team = new AgentTeam({
  agents: [researcher, writer],
  tasks: [
    'Gather 3 facts about WebAssembly edge functions.',
    'Write a 2-sentence pitch based on the research.',
  ],
});

const results = await team.start();
console.log(results);

Example explained

  • new AgentTeam({ agents, tasks }) — Runs each agent in sequence and forwards prior task outputs as context.
  • await team.start() — Executes the full multi-agent pipeline and returns every task result.

Attach an MCP tool server in TypeScript

Reuse any Model Context Protocol server (filesystem, GitHub, Postgres) from Node.js without rewriting integrations.

Example

import { Agent, MCP } from 'praisonai';

const fsTools = new MCP({
  command: 'npx',
  args: ['-y', '@modelcontextprotocol/server-filesystem', './docs'],
});

const docsAgent = new Agent({
  name: 'DocsAuditor',
  instructions: 'List markdown files and summarize missing titles.',
  tools: [fsTools],
});

console.log(await docsAgent.start('Audit the ./docs folder.'));

Example explained

  • new MCP({ command, args }) — Spawns a stdio MCP server and exposes its tools directly to the TS Agent.

Common pitfall: forgetting to shut down MCP child processes

In short-lived CLI scripts, close MCP clients in a finally block so Node exits cleanly instead of hanging on an open stdio pipe.

Reference: documentation