UNPKG

@convex-dev/agent

Version:

A agent component for Convex.

46 lines 1.79 kB
import type { WithoutSystemFields } from "convex/server"; import type { ThreadDoc } from "../component/schema.js"; import type { AgentComponent, RunMutationCtx, RunQueryCtx } from "./types.js"; /** * Create a thread to store messages with an Agent. * @param ctx The context from a mutation or action. * @param component The Agent component, usually `components.agent`. * @param args The associated thread metadata. * @returns The id of the created thread. */ export declare function createThread(ctx: RunMutationCtx, component: AgentComponent, args?: { userId?: string | null; title?: string; summary?: string; }): Promise<string>; /** * Get the metadata for a thread. * @param ctx A ctx object from a query, mutation, or action. * @param args.threadId The thread to get the metadata for. * @returns The metadata for the thread. */ export declare function getThreadMetadata(ctx: RunQueryCtx, component: AgentComponent, args: { threadId: string; }): Promise<ThreadDoc>; export declare function updateThreadMetadata(ctx: RunMutationCtx, component: AgentComponent, args: { threadId: string; patch: Partial<WithoutSystemFields<ThreadDoc>>; }): Promise<{ _creationTime: number; _id: string; status: "active" | "archived"; summary?: string | undefined; title?: string | undefined; userId?: string | undefined; }>; /** * Search for threads by title, paginated. * @param ctx The context passed from the query/mutation/action. * @returns The threads matching the search, paginated. */ export declare function searchThreadTitles(ctx: RunQueryCtx, component: AgentComponent, { userId, query, limit, }: { userId?: string | undefined; query: string; limit?: number; }): Promise<ThreadDoc[]>; //# sourceMappingURL=threads.d.ts.map