Docs/Foundational Primitives/Prompts

Prompts & Multimodal Content

AgentCore supports flexible prompt structures including text prompts, system messages, conversation history arrays, and multimodal inputs (images and files).

Simple String Prompts

Pass a string directly to agent.run():

simple-prompt.ts
1import { Agent } from "@bablusingh-dev/agentcore";
2
3const agent = new Agent({
4 provider: "openai",
5 model: "gpt-4o-mini",
6});
7
8const response = await agent.run("Explain quantum entanglement in 2 sentences.");
9console.log(response.text);

System & Message Options

Pass an object with system instructions, message history, or custom prompts:

messages-prompt.ts
1const response = await agent.run({
2 system: "You are a senior TypeScript architect.",
3 messages: [
4 { role: "user", content: "Should we use interfaces or types?" },
5 { role: "assistant", content: "Interfaces are extendable, while types support unions." },
6 ],
7 prompt: "Summarize the key takeaway.",
8});

Multimodal Prompts (Images & Files)

Send structured content parts with images or documents to vision-capable models:

multimodal-prompt.ts
1const response = await agent.run({
2 messages: [
3 {
4 role: "user",
5 content: [
6 { type: "text", text: "What is shown in this UI diagram?" },
7 { type: "image", image: "https://example.com/diagram.png" },
8 ],
9 },
10 ],
11});