Creates a Vercel AI SDK LanguageModelV1 for a conversation thread.
The thread ID identifies the conversation and maintains message history server-side. If a thread with that ID already exists, the conversation continues. If not, a new thread is automatically created.
Use the returned model with generateText or streamText from the ai package.
Unique identifier for the conversation thread.
Optionalsettings: AgentSettingsOptional agent settings (application, capabilities, filters, etc.).
import { generateText, streamText } from 'ai'
const model = contentAgent.agent('my-thread-id', {
application: { key: 'projectId.datasetName' },
config: {
capabilities: { read: true, write: false },
},
})
// Non-streaming
const { text } = await generateText({ model, prompt: 'What blog posts do I have?' })
// Streaming
const { textStream } = await streamText({ model, prompt: 'Summarize my content' })
for await (const chunk of textStream) {
process.stdout.write(chunk)
}
Lists available applications for the organization.
Returns all Sanity Studio applications the authenticated user has access to.
Use the key from a returned application to target it when creating an agent.
Sends a one-shot prompt to the Content Agent (stateless).
Unlike .agent(), this does not create or use a conversation thread. Each call is independent with no message history or persistence. Ideal for simple, single-turn interactions.
Generation settings (application, capabilities, instructions, etc.).
The prompt message and request options.
A Content Agent provider instance returned by createContentAgent.
Provides two modes of interaction: