Files
matchmaking-v2/app/main.py
raulgupta 89ca9ad647 Initial commit: matchmaking-v2 on-demand multi-board job-search agent
On-demand Scout service (replaces the nightly aggregator):
- FastAPI agent-mesh service; card name "matchmaking-service" (HTTP /a2a/tasks
  + Redis-stream worker matching the sibling-service pattern)
- run_search: parallel multi-board sweep (Naukri/blackfalcondata + Foundit +
  LinkedIn), city-filtered at the board, cheapest-per-result first
- per-board adapters + normalizers -> ScoutJob with rich read-only details and
  offsite apply links; recall mode + MVQ guard
- result cache for dev replay ($0); per-board cost knobs; retry-on-5xx
- research/: engine design, board cost economics, India-actor shortlist, POC
2026-06-18 19:22:03 +05:30

52 lines
1.4 KiB
Python

"""matchmaking-v2 — FastAPI app (course-service mold).
Serves: the agent card (discovery), /a2a/tasks (orchestrator entry), /api/v1/health.
On-demand by design — no corpus DB, no nightly ingestion.
"""
from __future__ import annotations
import logging
from contextlib import asynccontextmanager
from fastapi import FastAPI
from fastapi.middleware.cors import CORSMiddleware
from app.adk.worker import RedisStreamWorker
from app.api.v1 import router as api_router
from app.a2a.card import router as a2a_card_router
from app.a2a.tasks import router as a2a_tasks_router
from app.config import get_settings
logging.basicConfig(level=get_settings().LOG_LEVEL)
_settings = get_settings()
_worker = RedisStreamWorker(redis_url=_settings.ORCHESTRATOR_REDIS_URL or _settings.REDIS_URL)
@asynccontextmanager
async def lifespan(_: FastAPI):
await _worker.start()
try:
yield
finally:
await _worker.stop()
def create_app() -> FastAPI:
s = get_settings()
app = FastAPI(title="Matchmaking v2", version="2.0.0", lifespan=lifespan)
app.add_middleware(
CORSMiddleware,
allow_origins=s.cors_origins_list,
allow_credentials=s.cors_origins_list != ["*"],
allow_methods=["*"],
allow_headers=["*"],
)
app.include_router(api_router, prefix=s.API_PREFIX)
app.include_router(a2a_card_router)
app.include_router(a2a_tasks_router)
return app
app = create_app()