Hermes v0.14.0 a introduit la prise en charge native des outils MCP, ce qui permet de donner facilement à votre agent une recherche web en direct sans wrappers d'API personnalisés. Ce tutoriel configure Scavio en tant que fournisseur de recherche MCP dans Hermes, afin que votre agent puisse répondre aux questions avec des données web en temps réel au lieu de se fier uniquement à sa date limite d'apprentissage.
Prérequis
- Hermes Agent v0.14.0 ou version ultérieure installé
- Python 3.11+
- Une clé API Scavio provenant de https://scavio.dev
- Le package du serveur MCP Scavio (pip install scavio-mcp)
Parcours
Étape 1: Installer et configurer le serveur MCP Scavio
Installez le package du serveur MCP Scavio et configurez le fichier de configuration qu'Hermes lira pour découvrir les outils disponibles.
# Install the Scavio MCP server
pip install scavio-mcp
# Create the MCP server config
cat > mcp_config.json << 'CONFIG'
{
"mcpServers": {
"scavio": {
"command": "scavio-mcp",
"env": {
"SCAVIO_API_KEY": "your-api-key"
},
"tools": ["web_search", "news_search"]
}
}
}
CONFIG
# Verify the server starts
scavio-mcp --health-checkÉtape 2: Enregistrer les outils MCP dans Hermes v0.14.0
Indiquez à Hermes le fichier de configuration MCP afin qu'il découvre les outils Scavio au démarrage. Hermes v0.14.0 lit les schémas des outils MCP et les met à disposition de l'agent.
from hermes import Agent, MCPToolProvider
# Load MCP tools from config
mcp_provider = MCPToolProvider.from_config("mcp_config.json")
# Create the Hermes agent with MCP tools
agent = Agent(
model="hermes-3",
tools=mcp_provider.get_tools(),
system_prompt="""You are a research assistant with live web search.
Use the web_search tool to find current information.
Always cite your sources with URLs."""
)
# Verify tools are registered
for tool in agent.available_tools:
print(f"Tool: {tool.name} - {tool.description}")Étape 3: Exécuter des requêtes de recherche via l'agent
Exécutez l'agent avec des requêtes qui déclenchent une recherche web. Hermes décide automatiquement quand appeler l'outil de recherche et intègre les résultats dans sa réponse.
import asyncio
async def research_query(agent: Agent, question: str) -> str:
response = await agent.run(question)
# Access tool call details
for step in response.steps:
if step.tool_call:
print(f"Tool used: {step.tool_call.name}")
print(f"Query sent: {step.tool_call.arguments.get('query')}")
result_count = len(step.tool_call.result.get("results", []))
print(f"Results returned: {result_count}")
return response.final_answer
async def main():
mcp_provider = MCPToolProvider.from_config("mcp_config.json")
agent = Agent(
model="hermes-3",
tools=mcp_provider.get_tools(),
system_prompt="Research assistant with live web search. Cite sources."
)
answer = await research_query(agent, "What are the top MCP servers in May 2026?")
print(f"Answer: {answer}")
asyncio.run(main())Exemple Python
import asyncio
from hermes import Agent, MCPToolProvider
async def main():
# Set up MCP tools from Scavio
mcp_provider = MCPToolProvider.from_config("mcp_config.json")
agent = Agent(
model="hermes-3",
tools=mcp_provider.get_tools(),
system_prompt="Research assistant with web search. Always cite sources."
)
# Run a query
response = await agent.run("What are the latest AI agent frameworks in 2026?")
for step in response.steps:
if step.tool_call:
print(f"Searched: {step.tool_call.arguments.get('query')}")
print(f"Results: {len(step.tool_call.result.get('results', []))}")
print(f"Answer: {response.final_answer}")
asyncio.run(main())Exemple JavaScript
// mcp_config.json must be in the working directory
// Hermes JS SDK example
import { Agent, MCPToolProvider } from "@hermes-ai/sdk";
const mcpProvider = MCPToolProvider.fromConfig("mcp_config.json");
const agent = new Agent({
model: "hermes-3",
tools: mcpProvider.getTools(),
systemPrompt: "Research assistant with web search. Cite sources."
});
async function main() {
const response = await agent.run("Latest AI agent frameworks in 2026?");
for (const step of response.steps) {
if (step.toolCall) {
console.log("Searched:", step.toolCall.arguments.query);
console.log("Results:", (step.toolCall.result.results || []).length);
}
}
console.log("Answer:", response.finalAnswer);
}
main();Sortie attendue
Tool: web_search - Search the web using Scavio
Searched: latest AI agent frameworks 2026
Results: 10
Answer: Based on current web results, the top AI agent frameworks in 2026 include...