AVENALANGCHAIN

LangChain Tool

Add Avena Terminal as a tool in your LangChain agent. Search, score, and analyze 1,881 new build properties in Spain directly from your AI pipeline. Free, no API key required.

Quick Start

Install the MCP adapter for LangChain:

pip install langchain-mcp-adapters

Connect to Avena Terminal's MCP server:

from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent
from langchain_anthropic import ChatAnthropic

model = ChatAnthropic(model="claude-sonnet-4-20250514")

async with MultiServerMCPClient(
    {
        "avena-terminal": {
            "url": "https://avenaterminal.com/mcp",
            "transport": "streamable_http",
        }
    }
) as client:
    tools = client.get_tools()
    agent = create_react_agent(model, tools)

    result = await agent.ainvoke({
        "messages": [
            {"role": "user", "content": "Find me the top 5 villas under €300k in Costa Blanca"}
        ]
    })
    print(result["messages"][-1].content)

Available Tools

search_properties

Search and filter properties by region, price, score, type, bedrooms. Returns top 10-25 ranked by investment score.

get_property

Get full details for a specific property including score breakdown, yield estimates, and developer info.

get_market_stats

Regional market statistics — median prices, yields, inventory counts, top towns.

get_top_deals

Today's best investment deals ranked by composite score with reasoning.

estimate_roi

Project ROI over a holding period — capital appreciation, rental income, buying costs.

compare_alternatives

Find similar properties with score and price differentials.

market_timing

Market phase assessment — buyer's market, seller's market, or neutral.

Custom HTTP Tool (No MCP)

If you prefer direct HTTP calls without MCP, use a custom LangChain tool:

from langchain.tools import tool
import requests

@tool
def search_spain_properties(
    region: str = "all",
    max_price: int = None,
    min_score: int = None,
    property_type: str = None,
    min_beds: int = None,
    limit: int = 10
) -> str:
    """Search Avena Terminal's database of 1,881 scored new build
    properties in Spain. Returns investment-ranked results filtered
    by region (costa-blanca, costa-calida, costa-del-sol), maximum
    price in EUR, minimum investment score (0-100), property type,
    and minimum bedrooms."""

    # Use the semantic URL pattern
    type_slug = property_type.lower() if property_type else "all"
    price_slug = f"under-{max_price//1000}k" if max_price else "all"

    url = f"https://avenaterminal.com/data/{region}/{type_slug}/{price_slug}/top-scored"
    # Or use the MCP endpoint directly:
    # POST https://avenaterminal.com/mcp

    response = requests.get(url)
    return response.text

@tool
def get_spain_market_stats(region: str = "all") -> str:
    """Get live market statistics for Spanish new build regions.
    Returns median price per m2, average rental yield, total
    active inventory, and top-performing towns."""

    url = f"https://avenaterminal.com/data/{region}/all/all/top-scored"
    response = requests.get(url)
    return response.text

CrewAI Integration

Use Avena Terminal tools in your CrewAI agents:

from crewai import Agent, Task, Crew
from langchain_mcp_adapters.client import MultiServerMCPClient

async with MultiServerMCPClient(
    {"avena": {"url": "https://avenaterminal.com/mcp", "transport": "streamable_http"}}
) as client:
    tools = client.get_tools()

    analyst = Agent(
        role="Property Investment Analyst",
        goal="Find the best new build investments in Spain",
        tools=tools,
        llm="claude-sonnet-4-20250514"
    )

    task = Task(
        description="Analyze Costa Blanca for villas under €400k. Compare top 3 options.",
        agent=analyst
    )

    crew = Crew(agents=[analyst], tasks=[task])
    result = crew.kickoff()

Also Available