Reference
API and data model
For the technically minded: what's stored, what's callable, and what's enforced.
Core tables
- profiles / user_roles - who you are and what you're allowed to open. Roles live in their own table, never on the profile.
- products / seller_adapters - the catalog and where it comes from.
- orders - a purchase, its total, currency and status.
- agents / knowledge_bases / kb_documents / api_tools - the agent builder.
- agent_runs - every run, with its tool calls, tokens, latency and cost in cents.
- negotiation_audit - append-only, hash-chained record of every negotiation turn.
- backend_config / allowed_calls - admin policy. Hosted runs enforce maintenance, daily quota, default model/search limit, and the agent.run enabled/rate settings.
Access rules
Every table has row-level security on. You can read your own rows; sellers can additionally read orders placed against their own products; admins have their own explicit policies. There is no client path that bypasses this.
Calling from your own code
App logic is exposed as typed server functions rather than a REST surface. From inside the app you call them directly; from outside, use the MCP server, which wraps the same operations with OAuth.
Server function, from a component
import { useServerFn } from "@tanstack/react-start";
import { listProducts } from "@/components/agentmesh/lib/marketplace/api.functions";
const fetchProducts = useServerFn(listProducts);
const { data } = useQuery({ queryKey: ["products"], queryFn: () => fetchProducts() });Running an agent
runAgent({ data: {
query: "quiet 14-inch laptop under $1800",
tier: "paid", // "free" keeps tool calls minimal
country: "CA",
category: "laptops",
web_search_limit: 2,
agent_id: "<optional custom agent>"
}})
// → { run_id, answer, engine, model, tool_calls, tokens, latency_ms, cost_cents, status }Local model endpoints
Both local runners are OpenAI-compatible, so the same two calls cover them:
Ollama (11434) and LM Studio (1234)
GET {baseUrl}/models
POST {baseUrl}/chat/completions
{ "model": "...", "messages": [...], "tools": [...], "tool_choice": "auto" }Public endpoints
- /mcp - the MCP server (OAuth-protected).
- /.well-known/oauth-protected-resource - OAuth discovery for MCP clients.