ScavioScavio
ProductoPreciosDocumentación
Iniciar sesionComenzar
  1. Inicio
  2. Tutoriales
  3. Cómo crear una herramienta de búsqueda Scavio para CrewAI
Tutorial

Cómo crear una herramienta de búsqueda Scavio para CrewAI

Cree una CrewAI BaseTool personalizada que busque en Google, Reddit, YouTube y Amazon a través de la API de Scavio. Tripulación de agentes con búsqueda y análisis.

Obtener clave API gratisDocumentacion API

CrewAI se entrega con SerperDevTool para la búsqueda de Google, pero solo cubre una plataforma. La creación de una BaseTool personalizada con Scavio brinda a sus agentes de CrewAI acceso a datos de Google, Reddit, YouTube, Amazon, Walmart y TikTok a través de una única herramienta a $0,005 por búsqueda. Este tutorial crea la herramienta y la conecta a un equipo de investigación y análisis.

Requisitos previos

  • Python 3.8+
  • Crewai instalado (pip install Crewai)
  • Una clave API de Scavio de scavio.dev
  • Una clave API de LLM para la tripulación

Guia paso a paso

Paso 1: Crear la BaseTool de búsqueda de Scavio

Implemente una CrewAI BaseTool con soporte de búsqueda multiplataforma.

Python
import os, requests
from crewai.tools import BaseTool
from typing import Optional

API_KEY = os.environ['SCAVIO_API_KEY']
SH = {'x-api-key': API_KEY, 'Content-Type': 'application/json'}

class ScavioSearchTool(BaseTool):
    name: str = 'scavio_search'
    description: str = 'Search the web for current information. Supports platforms: google, reddit, youtube, amazon, walmart. Default is google. Returns structured results with titles, links, and snippets.'

    def _run(self, query: str, platform: Optional[str] = None) -> str:
        body = {'query': query, 'country_code': 'us'}
        if platform and platform != 'google':
            body['platform'] = platform
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=SH, json=body).json()
        results = data.get('organic_results', [])[:5]
        formatted = []
        for r in results:
            formatted.append(f"{r.get('position', 0)}. {r['title']}\n   {r.get('link', '')}\n   {r.get('snippet', '')[:120]}")
        return f'Results for "{query}" ({platform or "google"}):\n' + '\n\n'.join(formatted)

search_tool = ScavioSearchTool()
print(search_tool._run('best python framework 2026')[:200])

Paso 2: Definir los agentes del equipo de investigación

Cree un agente investigador y un agente analista que utilicen la herramienta de búsqueda.

Python
from crewai import Agent, Task, Crew

researcher = Agent(
    role='Senior Researcher',
    goal='Find comprehensive, current data on the given topic using web search across multiple platforms',
    backstory='You are an expert researcher who searches Google for official sources, Reddit for user opinions, and YouTube for tutorial coverage.',
    tools=[search_tool],
    verbose=True
)

analyst = Agent(
    role='Data Analyst',
    goal='Analyze research findings and produce actionable insights with data-backed recommendations',
    backstory='You synthesize data from multiple sources into clear, honest analysis. You note when data is limited or uncertain.',
    tools=[],
    verbose=True
)

print('Agents defined: Researcher (with search tool) + Analyst')

Paso 3: Crea tareas y reúne al equipo

Defina tareas de investigación y análisis, luego dirija el equipo.

Python
def run_research_crew(topic):
    research_task = Task(
        description=f'Research "{topic}" thoroughly. Search Google for top results, then search Reddit for real user opinions. Return raw findings organized by source.',
        expected_output='Structured research findings from Google and Reddit with links and key quotes.',
        agent=researcher
    )
    analysis_task = Task(
        description=f'Analyze the research findings on "{topic}". Identify consensus opinions, areas of disagreement, and produce a ranked recommendation with honest tradeoffs.',
        expected_output='Ranked analysis with pros/cons and a clear recommendation. Note any data gaps.',
        agent=analyst
    )
    crew = Crew(
        agents=[researcher, analyst],
        tasks=[research_task, analysis_task],
        verbose=True
    )
    result = crew.kickoff()
    return result

result = run_research_crew('best SERP API for Python developers')
print(f'\n--- Final Output ---\n{str(result)[:500]}')

Paso 4: Agregar tareas de búsqueda específicas de la plataforma

Amplíe el equipo para buscar en Reddit, YouTube y Amazon para obtener análisis más completos.

Python
def multi_platform_crew(topic):
    google_task = Task(
        description=f'Search Google for "{topic}" and list the top 5 results with titles, URLs, and key points from snippets.',
        expected_output='Top 5 Google results with summaries.',
        agent=researcher
    )
    reddit_task = Task(
        description=f'Search Reddit for "{topic}" to find real user discussions, complaints, and recommendations. Quote specific user opinions.',
        expected_output='Reddit discussion summary with quoted opinions.',
        agent=researcher
    )
    synthesis_task = Task(
        description='Synthesize Google authority sources and Reddit user opinions into a balanced recommendation. Flag where official claims differ from user experience.',
        expected_output='Balanced analysis contrasting official sources with real user experience.',
        agent=analyst
    )
    crew = Crew(agents=[researcher, analyst],
                tasks=[google_task, reddit_task, synthesis_task], verbose=True)
    result = crew.kickoff()
    print(f'Crew complete. Search cost estimate: ~$0.020-0.040')
    return result

multi_platform_crew('best SERP API 2026')

Ejemplo en Python

Python
import os, requests
from crewai.tools import BaseTool

SH = {'x-api-key': os.environ['SCAVIO_API_KEY'], 'Content-Type': 'application/json'}

class ScavioSearch(BaseTool):
    name: str = 'web_search'
    description: str = 'Search Google, Reddit, YouTube, Amazon via Scavio API.'
    def _run(self, query: str) -> str:
        data = requests.post('https://api.scavio.dev/api/v1/search',
            headers=SH, json={'query': query, 'country_code': 'us'}).json()
        return '\n'.join(f"{r['title'][:50]}" for r in data.get('organic_results', [])[:3])

tool = ScavioSearch()
print(tool._run('best serp api'))

Ejemplo en JavaScript

JavaScript
// CrewAI is Python-only. Use the REST API directly in JS:
const SH = { 'x-api-key': process.env.SCAVIO_API_KEY, 'Content-Type': 'application/json' };
async function search(query, platform) {
  const body = { query, country_code: 'us' };
  if (platform) body.platform = platform;
  const data = await fetch('https://api.scavio.dev/api/v1/search', {
    method: 'POST', headers: SH, body: JSON.stringify(body)
  }).then(r => r.json());
  return (data.organic_results || []).slice(0, 3).map(r => r.title.slice(0, 50));
}
const results = await search('best serp api');
console.log(results.join('\n'));

Salida esperada

JSON
Results for "best python framework 2026" (google):
1. FastAPI - Modern Python Web Framework
   https://fastapi.tiangolo.com
   FastAPI is a modern, fast web framework for building APIs with Python...

Agents defined: Researcher (with search tool) + Analyst

[Researcher] Searching Google for 'best SERP API for Python developers'...
[Researcher] Searching Reddit for user opinions...
[Analyst] Analyzing findings from 2 sources...

--- Final Output ---
Based on research across Google and Reddit:
1. Scavio ($0.005/query) - Multi-platform, good for agents
2. SerpAPI ($0.005/query) - Established, Google-focused
3. DataForSEO ($0.002/query) - Cheapest for volume

Crew complete. Search cost estimate: ~$0.020-0.040

Tutoriales relacionados

  • Cómo crear un agente de búsqueda LangGraph con control presupuestario
  • Cómo agregar búsqueda web a un agente Hermes a través de MCP
  • Cómo crear un puente de contexto de agente para los resultados de búsqueda

Preguntas frecuentes

La mayoria de los desarrolladores completan este tutorial en 15 a 30 minutos. Necesitaras una clave API de Scavio (el plan gratuito funciona) y un entorno de Python o JavaScript.

Python 3.8+. Crewai instalado (pip install Crewai). Una clave API de Scavio de scavio.dev. Una clave API de LLM para la tripulación. Una clave API de Scavio te da 50 creditos gratuitos al registrarte.

Si. El plan gratuito incluye 50 creditos al registrarte, mas que suficiente para completar este tutorial y crear un prototipo funcional.

Scavio tiene un paquete nativo de LangChain (langchain-scavio), un servidor MCP y una API REST simple que funciona con cualquier cliente HTTP. Este tutorial usa the raw REST API, pero puedes adaptarlo al framework que prefieras.

Recursos relacionados

Best Of

La mejor API de búsqueda para agentes de CrewAI en 2026

Read more
Use Case

Herramienta de búsqueda CrewAI

Read more
Use Case

Acceso web de IA de código abierto 2026

Read more
Comparison

Parallel Web Systems vs Scavio

Read more
Best Of

La mejor API de búsqueda para CrewAI en 2026

Read more
Solution

Construye una herramienta de búsqueda personalizada para CrewAI con Scavio

Read more

Empieza a construir

Cree una CrewAI BaseTool personalizada que busque en Google, Reddit, YouTube y Amazon a través de la API de Scavio. Tripulación de agentes con búsqueda y análisis.

Obtener clave API gratuitaLeer la documentacion
ScavioScavio

API de busqueda en tiempo real para agentes de IA. Busca en todas las plataformas, no solo en Google.

Producto

  • Funciones
  • Precios
  • Panel
  • Afiliados

Desarrolladores

  • Documentacion
  • Referencia de API
  • Inicio rapido
  • Integracion MCP
  • Python SDK

Alternativas

  • Alternativa a Tavily
  • Alternativa a SerpAPI
  • Alternativa a Firecrawl
  • Alternativa a Exa

Herramientas

  • Formateador JSON
  • cURL a codigo
  • Contador de tokens
  • Todas las herramientas

© 2026 Scavio. Todos los derechos reservados.

Featured on TAAFT
Terminos de servicioPolitica de privacidad