Skip to content

abha224/AI-agent-hack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cadbury — AI Marketplace Concierge

This is a Next.js project bootstrapped with create-next-app.

Getting Started

First, run the development server:

pnpm dev

Open http://localhost:3000 with your browser to see the result.

AgentMarket Scaffold

This repository also includes a scaffold for:

  • Next.js web app with Vercel AI SDK (ai) + @ai-sdk/google
  • Python LangGraph negotiation service
  • Shared TypeScript contracts package

Project Layout

  • apps/web: Next.js App Router project with AI SDK endpoints
  • services/negotiation-langgraph: FastAPI + LangGraph negotiation backend
  • packages/contracts: shared zod schemas/types

Environment

Copy .env.example to .env.local and set values:

  • NEXT_PUBLIC_SUPABASE_URL / NEXT_PUBLIC_SUPABASE_ANON_KEY / SUPABASE_SERVICE_ROLE_KEY
  • GEMINI_API_KEY
  • NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY / CLERK_SECRET_KEY
  • ELEVENLABS_API_KEY (optional)
  • GOOGLE_GENERATIVE_AI_API_KEY
  • NEGOTIATION_SERVICE_URL
  • PAGEINDEX_API_KEY — PageIndex API key (Bearer token)
  • PAGEINDEX_API_BASE_URL — REST host, default https://api.pageindex.ai (listing document upload)
  • PAGEINDEX_UPLOAD_PATH — upload path (default /documents/upload)
  • PAGEINDEX_MCP_URL — HTTP MCP endpoint for document search/read tools, default https://api.pageindex.ai/mcp
  • WEB_EVIDENCE_MCP_URL
  • A2A_AGENT_BASE_URL

Run Negotiation Service

The backend is split into buyer, seller, and gateway processes. The web app talks to the gateway on port 8000 (NEGOTIATION_SERVICE_URL).

Docker: web app + negotiation stack (recommended for deployment)

From the repository root, build and run the Next.js app together with buyer, seller, and gateway:

cp .env.example .env
# Set at least GOOGLE_GENERATIVE_AI_API_KEY (chat). Optional: PAGEINDEX_*, SUPABASE_*.
docker compose up --build
  • Web UI: http://localhost:3000
  • Gateway (REST): http://localhost:8000 — the web container uses NEGOTIATION_SERVICE_URL=http://negotiation-gateway:8000 on the Docker network (you do not set this manually for Compose).

Details: docker/README.md. To expose the FastAPI negotiation gateway on the internet (CORS, HTTPS, PUBLIC_GATEWAY_URL), see "Expose the FastAPI gateway on the internet" in that file.

Docker Compose (negotiation services only, no web):

cd services/negotiation-langgraph
docker compose up --build

Or run three local shells (see services/negotiation-langgraph/README.md) and start uvicorn app.main:app on port 8000 for the gateway.

Starter Endpoints

Web (Next.js):

  • POST /api/chat
  • POST /api/negotiations/start
  • POST /api/listings/{listingId}/documents (multipart with files)

Negotiation service:

  • GET /health
  • POST /negotiations/start
  • POST /negotiations/{thread_id}/step

PageIndex Seller Upload → Buyer Query Flow

Official API host: https://api.pageindex.ai. The negotiation service and web upload both authenticate with PAGEINDEX_API_KEY as Authorization: Bearer <key>.

Cursor MCP (same tools as the negotiation service):

{
  "mcpServers": {
    "pageindex": {
      "type": "http",
      "url": "https://api.pageindex.ai/mcp",
      "headers": {
        "Authorization": "Bearer your_api_key"
      }
    }
  }
}
  • Seller uploads listing documents through POST /api/listings/{listingId}/documents.
  • The web route uploads files to PageIndex ingestion API with folder_id = listingId.
  • During negotiation steps, the service queries PageIndex MCP tools within that same folder.

Thread Event Persistence

The Next.js API routes persist negotiation events to Supabase table thread_events.

create table if not exists public.thread_events (
  id bigint generated always as identity primary key,
  thread_id text not null,
  event_type text not null,
  source text not null,
  request_id text,
  payload jsonb not null,
  created_at timestamptz not null default now()
);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors