Agents
Agents API
@galya/agents is a typed client for the Galya API—index, search, rerank, ask, and explain relative to users or entities. Request/response shapes are defined in openapi.yaml (galya.io).
Typical flow: index your catalog → search or rerank for a user entity → optionally ask / explain for natural-language answers.
import { GalyaApiClient, GALYA_DEFAULT_API_V1_BASE_URL } from "@galya/agents";
const api = new GalyaApiClient({
apiKey: process.env.GALYA_SECRET_KEY!,
workspaceId: "ws_…",
baseUrl: GALYA_DEFAULT_API_V1_BASE_URL,
});
const { results } = await api.search(
{ relativeToEntityId: "ent_…", inTermsOfEntityType: "content" },
{ query: "minimalist coastal interiors" },
);
await api.indexContent({ entityId: "ent_…", content: { /* … */ } });
await api.ask(
{ relativeToEntityId: "ent_…", inTermsOfEntityType: "content" },
{ query: "What would this user like for a weekend trip?" },
);Methods: search · rerank · ask · explain · indexContent · indexContentBatch · createEntity · getEntity · deleteEntity · registerEntityType · getEntityType · listClusters · getCluster
For LLM agents, see tools.