LangChain Integration
Give your LangChain agents the ability to research any company with a single tool call.
Tool Definition
Copy this tool definition into your LangChain agent. Replace YOUR_KEY with your API key.
from langchain.tools import StructuredTool
from pydantic import BaseModel, Field
import requests
class AnalyzeWebsiteInput(BaseModel):
url: str = Field(
description="The website URL to analyze (e.g., 'https://vercel.com')"
)
def analyze_website(url: str) -> dict:
"""Get comprehensive intelligence about any website including
company info, tech stack, contact details, and trust signals."""
response = requests.post(
"https://theindex.dev/api/v1/analyze",
json={"url": url},
headers={"Authorization": "Bearer idx_live_YOUR_KEY"}
)
return response.json()
website_intel_tool = StructuredTool.from_function(
func=analyze_website,
name="analyze_website",
description=(
"Get comprehensive intelligence about any website including "
"company info, tech stack, contact details, and trust signals. "
"Use this when you need to research a company or website."
),
args_schema=AnalyzeWebsiteInput,
)Usage with an Agent
from langchain_openai import ChatOpenAI
from langchain.agents import AgentExecutor, create_openai_tools_agent
from langchain_core.prompts import ChatPromptTemplate
llm = ChatOpenAI(model="gpt-4")
prompt = ChatPromptTemplate.from_messages([
("system", "You are a helpful research assistant."),
("human", "{input}"),
])
agent = create_openai_tools_agent(llm, [website_intel_tool], prompt)
executor = AgentExecutor(agent=agent, tools=[website_intel_tool])
result = executor.invoke({
"input": "Research vercel.com and tell me what tech stack they use"
})