← Work

PolyAgent

Conversational AI agent that searches LeBonCoin via Claude.

Year2025
RoleDesign · Development · Architecture
CategoryAI · Tool · Full-stack
Live site
PolyAgent — screenshot
Context

LeBonCoin has no good conversational search. You type keywords, scroll through noise, and miss deals. PolyAgent lets you chat naturally — "I'm looking for a 3-room apartment in Lyon under 800€" — and the agent refines, searches, and shows you exactly what matches.

Challenge

Connecting an LLM agent to a real search backend via MCP stdio, handling streaming responses with tool calls, and making the conversational flow feel natural while the agent toggles between asking questions and fetching results.

Key Decisions

FastAPI + SSE streaming

Server-Sent Events keep the conversation flowing in real time. The backend streams LLM tokens and tool results as they arrive — no polling, no WebSocket complexity.

MCP stdio for LeBonCoin

The agent talks to leboncoin-mcp via JSON-RPC over stdio — a clean separation between the agent logic and the search backend. Easy to swap for other platforms.

OpenAI-compatible API

Works with any OpenAI-compatible endpoint (9router, Gemini, Claude). Tool calling is handled at the API level — the agent just defines tools and the LLM decides when to call them.

Vanilla frontend + i18n

No framework overhead. HTML/CSS/JS with marked.js for Markdown rendering. Trilingual (FR/EN/ES) from day one with a simple locale object.

Stack
PythonFastAPISSEOpenAI APIMCPHTMLCSSJavaScriptmarked.js
Results

Working conversational agent with real-time search, clickable choices, favorite saves (localStorage), persistent sessions, and trilingual support. Deployed locally, extensible to any OpenAI-compatible API.

Learnings
  1. MCP stdio is a clean abstraction for connecting LLMs to external tools — the protocol is simple and the separation of concerns is real.
  2. SSE streaming makes conversational AI feel instant — the user sees tokens appear as the model generates them, not after a full response.
Next ProjectNutrAI