Tutorial

How to Plug Scavio into a Kimi Agent Swarm

Wire Scavio into Moonshot Kimi's agent swarm runtime using MCP so every sub-agent gets real-time search without per-agent keys.

Moonshot's Kimi agent swarm runtime became popular in early 2026 for running 10-100 sub-agents on cheap context. The missing piece is grounded web search: Kimi ships without a built-in search tool. This tutorial wires Scavio into the Kimi swarm via MCP so every sub-agent shares one search backend.

Prerequisites

  • Kimi swarm runtime (kimi-swarm CLI)
  • A Scavio API key
  • Node.js 20+
  • @scavio/mcp installed globally

Walkthrough

Step 1: Install the Scavio MCP server

One install exposes Scavio as a typed MCP toolset.

Bash
npm install -g @scavio/mcp

Step 2: Register the MCP in Kimi swarm config

Kimi reads ~/.kimi/swarm.json for shared tools.

JSON
{
  "sharedTools": {
    "scavio": {
      "transport": "mcp",
      "command": "scavio-mcp",
      "env": { "SCAVIO_API_KEY": "sk_live_..." }
    }
  }
}

Step 3: Declare tool access per agent role

Grant search only to research sub-agents, not planners.

JSON
{
  "roles": {
    "researcher": { "tools": ["scavio.search", "scavio.reddit_search"] },
    "planner": { "tools": [] }
  }
}

Step 4: Launch the swarm

Kimi routes search calls through the shared MCP, so 50 agents share one API key.

Bash
kimi-swarm run ./workflow.yaml --agents 50

Step 5: Verify tool hits in logs

Each Scavio call is logged with the calling agent id for audit.

Bash
kimi-swarm logs --tool scavio.search --tail

Python Example

Python
import os, requests

API_KEY = os.environ['SCAVIO_API_KEY']

def kimi_tool_search(query: str):
    r = requests.post('https://api.scavio.dev/api/v1/search',
        headers={'x-api-key': API_KEY},
        json={'query': query})
    return r.json().get('organic_results', [])[:5]

if __name__ == '__main__':
    print(kimi_tool_search('Moonshot Kimi swarm 2026'))

JavaScript Example

JavaScript
const API_KEY = process.env.SCAVIO_API_KEY;
export async function kimiSearch(query) {
  const r = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST',
    headers: { 'x-api-key': API_KEY, 'Content-Type': 'application/json' },
    body: JSON.stringify({ query })
  });
  const data = await r.json();
  return data.organic_results?.slice(0, 5) || [];
}

Expected Output

JSON
50 Kimi sub-agents share one Scavio key. Logs show per-agent tool hits with ~40ms overhead per call. Total swarm cost: ~1 credit per research sub-agent call.

Related Tutorials

Frequently Asked Questions

Most developers complete this tutorial in 15 to 30 minutes. You will need a Scavio API key (free tier works) and a working Python or JavaScript environment.

Kimi swarm runtime (kimi-swarm CLI). A Scavio API key. Node.js 20+. @scavio/mcp installed globally. A Scavio API key gives you 500 free credits per month.

Yes. The free tier includes 500 credits per month, which is more than enough to complete this tutorial and prototype a working solution.

Scavio has a native LangChain package (langchain-scavio), an MCP server, and a plain REST API that works with any HTTP client. This tutorial uses the raw REST API, but you can adapt to your framework of choice.

Start Building

Wire Scavio into Moonshot Kimi's agent swarm runtime using MCP so every sub-agent gets real-time search without per-agent keys.