Add Pi Research Agent package
CI / Lint & Type Check (push) Canceled after 0s
CI / Test (push) Canceled after 0s

Autonomous research agent with web search, source analysis, and report synthesis.
Built on Pi agent core. Available as CLI, programmatic API, and MCP server.

Features:
- 4 built-in tools: web_search, read_url, save_note, synthesize_report
- CLI with TUI and print modes
- Programmatic API via ResearchAgent class
- MCP server with 3 tools: research, quick_search, read_url
- Skills system for custom research behavior
- Automatic .env file loading for API keys
- Configurable max turns, output formats (markdown/JSON/bullet)
- Automatic report saving to research-output/
This commit is contained in:
Emil
2026-06-04 18:12:11 +03:00
parent dc7b547f62
commit e196593c84
50 changed files with 3552 additions and 21 deletions
@@ -0,0 +1,59 @@
/**
* MCP Client Example
*
* Demonstrates how to call the research agent MCP server from another agent.
*
* Run with:
* TAVILY_API_KEY=*** \
* OPENROUTER_API_KEY=*** \
* npx tsx examples/mcp-client.ts
*/
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { join } from "node:path";
const mcpServerPath = join(import.meta.dirname, "../dist/mcp-cli.js");
const transport = new StdioClientTransport({
command: "node",
args: [mcpServerPath],
env: {
...process.env,
},
});
const client = new Client({
name: "example-client",
version: "1.0.0",
});
await client.connect(transport);
console.log("Connected to research agent MCP server\n");
const toolsResult = await client.listTools();
console.log("Available tools:");
for (const tool of toolsResult.tools) {
console.log(` - ${tool.name}: ${tool.description}`);
}
console.log();
console.log("Starting research on 'Rust async runtime'...\n");
const result = await client.callTool({
name: "quick_search",
arguments: {
query: "Rust async runtime tokio vs async-std 2026",
maxResults: 5,
},
});
console.log("Search results:");
for (const content of result.content) {
if (content.type === "text") {
console.log(content.text);
}
}
await client.close();