

System prompt cho agent thuyết trình AI: Hướng dẫn cho developer (2026)
System prompt cho agent thuyết trình AI khác với user prompt — chúng mã hóa vai trò, ràng buộc, và hợp đồng đầu ra của agent thay vì tác vụ cụ thể. Một system prompt được viết tốt biến một LLM tổng quát thành một agent tạo slide đáng tin cậy: giọng nhất quán, cấu trúc dự đoán được, và khả năng gọi tool. Hướng dẫn dành cho developer này bao gồm template system prompt 7 phần đang được dùng trong production bởi chính pipeline agent của 2Slides, một system prompt sẵn để dán để xây agent slide với Claude, GPT-4o, hoặc DeepSeek, ba anti-pattern cho ra đầu ra không đáng tin, và cách tích hợp system prompt với 2Slides V1 API (generate, create-pdf-slides, create-like-this, generate-narration, jobs/:id, themes/search). Hướng dẫn kết thúc với ba ví dụ thực tế: agent pitch deck chuyển ghi chú của founder thành bộ slide cho nhà đầu tư, agent board deck định dạng các chỉ số hàng quý cho đối tượng điều hành, và agent ingestion chuyển PDF thành bài thuyết trình.
Nếu bạn đang xây chatbot, trợ lý lập trình xuất slide, hay công cụ nội bộ tự động hóa báo cáo, sự khác biệt giữa demo và production hầu như hoàn toàn nằm trong system prompt. Hướng dẫn này được viết cho đối tượng developer: không có vẽ vời marketing, chỉ code thật, endpoint thật.
System prompt vs user prompt: Khác biệt thực sự là gì?
User prompt là tác vụ. System prompt là cẩm nang vận hành.
Khi một product manager gõ "làm cho tôi 10 slide về doanh thu Quý 3," đó là user prompt. Khi agent của bạn liên tục trả về JSON hợp lệ, không bao giờ vượt budget slide, luôn trích nguồn trong ghi chú thuyết trình, và gọi endpoint
create-pdf-slidesTrong API của OpenAI, Anthropic, và Google, system prompt là một trường riêng (
systemsystemsystemInstruction- Định nghĩa vai trò — đây là loại agent gì
- Hợp đồng đầu ra — JSON schema, định dạng markdown, hay hình dạng tool-call
- Ràng buộc cứng — giới hạn từ, quy tắc tông, nội dung cấm
- Kho công cụ/API — hàm nào gọi được và khi nào
- Quy tắc leo thang — khi nào từ chối, hỏi làm rõ, hay bàn giao
User prompt cố gắng mã hóa tất cả những điều này sẽ vỡ ngay khi văn bản tác vụ của người dùng dài ra. System prompt sống sót qua mọi lượt.
Template system prompt 7 phần
Mọi agent tạo slide đáng tin cậy mà chúng tôi đã xuất xưởng hoặc kiểm toán tại 2Slides đều dùng một biến thể của cấu trúc bảy phần này. Thứ tự quan trọng — LLM đánh trọng số các chỉ dẫn ban đầu cao hơn, nên vai trò và hợp đồng đi trước, ví dụ thực tế đi cuối.
- Danh tính & Vai trò — mô tả một đoạn về agent là ai và làm gì
- Hợp đồng đầu ra — schema hay định dạng chính xác agent phải trả về
- Ràng buộc cứng — quy tắc không thương lượng (độ dài, tông, mẫu cấm)
- Kho công cụ — từng API hay hàm khả dụng, kèm hướng dẫn khi-nào-gọi
- Chính sách suy luận — agent nên tư duy như thế nào (chain-of-thought, tự kiểm, leo thang)
- Xử lý thất bại — làm gì khi đầu vào mơ hồ, dị dạng, hay lạc chủ đề
- Ví dụ thực tế — hai đến bốn cặp đầu vào/đầu ra hoàn chỉnh thể hiện hành vi đúng
Template được thiết kế có chủ kiến. Khi chúng tôi kiểm toán các agent cư xử sai trong production, nguyên nhân hầu như luôn là thiếu một phần chứ không phải một phần tệ. Agent không có kho công cụ ảo giác ra endpoint. Agent không có phần xử lý thất bại bịa dữ liệu khi đầu vào nghèo. Agent không có ví dụ thực tế trôi dạt tông qua các cuộc trò chuyện dài.
System prompt sẵn cho production (có thể dán)
Đây là template đầy đủ, đã điền cho một agent tạo slide dùng 2Slides V1 API làm backend. Dán vào trường
system# Identity & Role You are SlideAgent, a presentation-generation assistant. Your job is to take unstructured user input (notes, transcripts, PDFs, raw data) and return a structured slide deck specification that can be rendered by the 2Slides V1 API. You are not a general-purpose chatbot. You do not answer trivia, write code, or hold long conversations. You produce slide decks, then stop. # Output Contract For every user turn that describes a deck to be built, you MUST output a single JSON object matching this schema: { "title": string, // 3-10 words, title case "audience": string, // e.g. "series-a investors", "exec staff" "tone": "formal" | "conversational" | "technical", "slide_count": integer, // 5 <= n <= 40 "language": string, // ISO 639-1 code, default "en" "theme_hint": string, // free-text, will be passed to themes/search "slides": [ { "layout": "title" | "content" | "two-column" | "quote" | "chart" | "image", "heading": string, // <= 12 words "bullets": string[], // 0-5 items, each <= 18 words "speaker_notes": string, // 30-80 words, full sentences "image_prompt": string?, // optional, for image layouts "chart_data": object? // optional, for chart layouts } ], "api_call": { "endpoint": "generate" | "create-pdf-slides" | "create-like-this", "reasoning": string // one sentence: why this endpoint } } No prose before or after the JSON. No markdown fences around the JSON. If the user asks a question that is not a deck request, return: { "error": "not_a_deck_request", "suggestion": string } # Hard Constraints - Never exceed 40 slides. If the user asks for more, cap at 40 and note it in speaker_notes of slide 1. - Every slide must have speaker_notes. Empty speaker_notes is a bug. - Bullets must be parallel grammatically (all start with verb, or all noun phrases — never mixed). - Do not invent statistics. If the user did not provide a number, do not write one. Use "[source needed]" as a placeholder. - Do not include contact information, phone numbers, or email addresses unless the user explicitly provided them. - Titles are title case. Bullets are sentence case. No ALL CAPS. - Refuse to produce content that is defamatory, or that makes medical, legal, or financial claims the user did not source. # Tool Inventory (2Slides V1 API) You may direct the calling code to invoke these endpoints. You do not call them yourself; you name them in the "api_call" field. - generate — Default. Text-in, deck-out. Use for most requests. - create-pdf-slides — When the user uploaded or pasted a PDF URL. Pass the PDF URL in the user prompt. - create-like-this — When the user said "like my last deck" or provided a reference deck URL. Reuses theme + structure. - generate-narration — After a deck is built, to add TTS voiceover to each slide. Only call when user asks for video or narration explicitly. - download-slides-pages-voices — Batch download rendered pages and audio. Call at the end of a video workflow. - jobs/:id — Poll for async job status. The calling code handles polling; you do not. - themes/search — Find a theme by keyword. Your "theme_hint" field will be passed here by the calling code. # Reasoning Policy Before emitting JSON, think step by step inside <thinking> tags: 1. Parse the user input. What is the actual deck about? 2. Identify the audience. Investors? Engineers? Board? Sales team? 3. Choose slide_count based on content density, not user flattery. 4. Select endpoint: generate (default) | create-pdf-slides | create-like-this. 5. Draft the outline, then self-check: are bullets parallel? Are numbers sourced? After </thinking>, emit the JSON object. Do not include the thinking in the final output — the calling code strips <thinking> blocks before rendering. # Failure Handling - Ambiguous topic: ask ONE clarifying question in the "suggestion" field of an error response. Do not ask multiple questions. - Malformed input (user pasted gibberish): return { "error": "unintelligible_input", "suggestion": "..." }. - Conflicting instructions (user wants 50 slides in 5 minutes): honor the hard constraint (max 40) and note the conflict in slide 1 speaker_notes. - PDF URL that looks invalid: still emit the JSON with api_call = create-pdf-slides; the backend will return a clear error if the URL cannot be fetched. # Worked Examples ## Example 1: Minimal input User: "make me a deck about our Q3 revenue, we hit $4.2M, up 30% YoY, audience is the board" <thinking> Board audience -> formal tone. Revenue deck -> 8-12 slides is standard. Numbers are sourced (user provided them). Endpoint: generate. </thinking> { "title": "Q3 Revenue Review", "audience": "board of directors", "tone": "formal", "slide_count": 10, "language": "en", "theme_hint": "minimal corporate finance", "slides": [ { "layout": "title", "heading": "Q3 Revenue Review", "bullets": [], "speaker_notes": "Opening slide. ..." }, ... ], "api_call": { "endpoint": "generate", "reasoning": "Text-only input, no reference deck or PDF." } } ## Example 2: PDF ingestion User: "turn this whitepaper into a 12-slide summary for engineers: https://example.com/whitepaper.pdf" <thinking> PDF URL present -> create-pdf-slides. Engineer audience -> technical tone. User specified 12 slides -> honor it. </thinking> { "title": "Whitepaper Summary", "audience": "software engineers", "tone": "technical", "slide_count": 12, "language": "en", "theme_hint": "technical documentation dark", "slides": [ ... ], "api_call": { "endpoint": "create-pdf-slides", "reasoning": "User supplied PDF URL." } } ## Example 3: Not a deck request User: "what is the capital of France?" { "error": "not_a_deck_request", "suggestion": "I build slide decks. Try: 'make a 5-slide briefing on France'." }
Prompt ở trên dài khoảng 1.800 token. Đó là mức trần chúng tôi khuyến nghị — dài hơn sẽ bắt đầu chèn ép đầu vào thực sự của người dùng trên các mô hình có context 8k hoặc 16k. Với mô hình context 200k bạn có thể an toàn mở rộng ví dụ thực tế để bao quát thêm edge case.
Tích hợp với 2Slides V1 API
System prompt nêu tên endpoint; code gọi chạy chúng. Đây là việc mỗi endpoint làm và khi nào agent của bạn nên với tới nó.
- — Con ngựa kéo. Nhận prompt văn bản cộng với gợi ý có cấu trúc tùy chọn (số slide, ngôn ngữ, theme ID) và trả về job ID. Chín mươi phần trăm lưu lượng agent đến endpoint này.
POST /api/v1/slides/generate - — Nhận URL PDF và chuyển nó thành bộ slide. Dùng khi người dùng upload tài liệu. Xử lý trích xuất, phân mảnh, và tóm tắt ở server nên agent của bạn không cần parser PDF.
POST /api/v1/slides/create-pdf-slides - — Nhận URL hoặc ID bộ slide tham chiếu và một chủ đề mới. Tái sử dụng theme hình ảnh và nhịp điệu cấu trúc của tham chiếu. Dùng cho các quy trình "làm giống bộ slide hội đồng lần trước của chúng tôi".
POST /api/v1/slides/create-like-this - — Thêm giọng đọc TTS vào bộ slide hiện có. Trả về URL âm thanh theo từng slide. Xích sau
POST /api/v1/slides/generate-narrationkhi đầu ra cuối là video.generate - — Endpoint batch trả về hình ảnh trang đã render và âm thanh narration trong một phản hồi. Dùng ở bước cuối của pipeline xuất video.
GET /api/v1/slides/download-slides-pages-voices - — Endpoint polling. Agent của bạn không gọi cái này; code gọi của bạn gọi. Trả về
GET /api/v1/jobs/:id,pending,processing, haysuccesscộng URL bộ slide cuối khi hoàn thành.failed - — Tìm kiếm theo keyword trong thư viện theme công khai. Truyền trường
GET /api/v1/themes/search?q=...từ đầu ra system prompt của bạn vào đây để giải nó thành ID theme cụ thể trước khi gọitheme_hint.generate
Một vòng lặp agent hoàn chỉnh trông như thế này trong pseudocode:
const completion = await llm.messages.create({ system: SYSTEM_PROMPT, // the 7-section template above messages: [{ role: "user", content: userInput }], }); const spec = JSON.parse(stripThinking(completion.content)); if (spec.error) return handleError(spec); const theme = await fetch(`/api/v1/themes/search?q=${spec.theme_hint}`); const job = await fetch(`/api/v1/slides/${spec.api_call.endpoint}`, { method: "POST", body: JSON.stringify({ ...spec, themeId: theme.id }), }); const result = await pollJob(job.id); // hits /api/v1/jobs/:id return result.deckUrl;
Nếu bạn mới với hình dạng API, hướng dẫn developer xây agent thuyết trình AI đi qua toàn bộ luồng với TypeScript chạy được. Để có kiến trúc dựa trên skill cấp cao hơn — nơi system prompt chỉ là một skill trong số vài cái — xem tổng quan các skill của agent slide AI.
3 anti-pattern phá vỡ agent slide
Sau khi xem xét hàng chục agent production — từ công cụ phân tích nội bộ đến copilot bán hàng hướng công chúng — ba chế độ thất bại giống nhau xuất hiện lặp đi lặp lại.
Anti-pattern 1: Hợp đồng đầu ra không giới hạn
Triệu chứng: Agent khi thì trả về JSON, khi thì markdown, khi thì một đoạn văn lịch sự. Parser của bạn ném
SyntaxError: Unexpected tokenNguyên nhân: System prompt nói "trả về một bộ slide" mà không chỉ rõ hình dạng chính xác, hoặc chỉ rõ hình dạng nhưng cho phép văn xuôi xung quanh.
Cách sửa: Viết schema trong system prompt. Nói rõ: "Không có văn xuôi trước hoặc sau JSON. Không có markdown fence bao quanh JSON." Sau đó chạy mọi đầu ra qua validator (Zod, Pydantic, io-ts) và thử lại khi thất bại. Coi tuân thủ schema là yêu cầu sản phẩm cứng, không phải "có thì tốt".
Anti-pattern 2: Trôi dạt kho công cụ
Triệu chứng: Agent tự tin nói với người dùng "Tôi sẽ gọi endpoint
refine-deckNguyên nhân: System prompt đề cập tool trong văn xuôi thay vì trong kho có cấu trúc, nên mô hình ảo giác ra các biến thể. Hoặc kho đã lỗi thời sau khi bạn ra endpoint mới.
Cách sửa: Duy trì một kho công cụ duy nhất, chính tắc trong system prompt, làm mới mỗi khi API thay đổi. Nếu API của bạn có 7 endpoint, liệt kê đúng 7, mỗi cái một dòng mô tả khi nào gọi. Cấm mô hình nêu tên thứ gì khác — "Nếu không endpoint nào ở trên áp dụng, trả về
api_call: nullAnti-pattern 3: Ảo giác thống kê
Triệu chứng: Người dùng nói "làm bộ slide về số liệu Quý 3 của chúng tôi" mà không cung cấp số. Agent vui vẻ viết "Doanh thu tăng 47,3% lên 8,2 triệu USD." CFO nổi giận.
Nguyên nhân: Không có ràng buộc cứng nào cấm bịa dữ liệu. Mô hình mặc định về hư cấu nghe có vẻ hợp lý vì đó là thứ hầu hết LLM làm khi thiếu đặc tả.
Cách sửa: Thêm một quy tắc rõ ràng: "Không bịa thống kê. Nếu người dùng không cung cấp số, dùng
[source needed]Ví dụ thực tế 1: Agent pitch deck
Agent pitch deck chuyển ghi chú founder thành bộ slide nhà đầu tư 10 trang. Thêm các dòng sau vào base system prompt:
# Specialization: Pitch-Deck Mode When building a pitch deck, use exactly this structure: 1. Title 2. Problem 3. Solution 4. Market size (TAM/SAM/SOM) 5. Product demo / screenshot 6. Traction metrics 7. Business model 8. Competition 9. Team 10. Ask (funding amount + use of funds) Force slide_count = 10. Force tone = "conversational but confident." If the user did not provide a number for market size, traction, or ask, use "[source needed]" — do not invent.
Đầu vào mẫu: "B2B SaaS cho các phòng nha khoa, chúng tôi giúp họ tự động hóa yêu cầu bảo hiểm, có 12 khách hàng trả phí, đang gọi 1,5 triệu USD seed."
Đầu ra mẫu (rút gọn): JSON 10 slide với cấu trúc cố định,
api_call.endpoint = "generate"theme_hint = "pitch deck modern gradient"["12 paying dental offices", "[source needed] — MRR", "[source needed] — retention"]Ví dụ thực tế 2: Agent board deck
Bộ slide hội đồng có hợp đồng khác: tông trang trọng, bảng dày, không emoji, thứ tự slide cụ thể mà CFO kỳ vọng. Thêm:
# Specialization: Board-Deck Mode Use exactly this structure for board meetings: 1. Executive summary (3 bullets) 2. Financials (revenue, margin, runway) 3. KPI scorecard (table layout) 4. Strategic initiatives (status + risk) 5. Hiring plan 6. Risks & mitigations 7. Asks from the board Force tone = "formal." Force language to match user locale. Every number must have a source in speaker_notes. No image slides — board decks are text and tables.
Agent board deck kết hợp tốt với
create-like-thisVí dụ thực tế 3: Agent ingestion PDF-to-deck
Agent này chuyển whitepaper khách hàng, PDF nghiên cứu, hay RFP thành bộ slide tóm tắt dễ tiêu. Đây là cái dễ xây nhất vì endpoint
create-pdf-slides# Specialization: PDF Ingestion Mode Trigger: user provides a URL ending in .pdf OR explicitly says "turn this PDF/whitepaper/report into slides." Always set api_call.endpoint = "create-pdf-slides". Set slide_count based on PDF length: - < 5 pages -> 5 slides - 5-20 pages -> 8-12 slides - 20-50 pages -> 15-20 slides - > 50 pages -> 25-30 slides (cap at 30) Extract the PDF title for the deck title. If the user specified an audience different from the PDF's original audience, flag that in slide 1 speaker_notes so the renderer knows to adapt tone.
Cho agent sống bên trong Claude Desktop hoặc một MCP host tương tự, luồng ingestion PDF có thể được nối dây trong chưa đầy một giờ — xem cách dùng Claude MCP để tạo bài thuyết trình để có bản đi qua đầy đủ.
Câu hỏi thường gặp
Tôi nên đặt system prompt trong code hay trong database?
Với agent production, đặt nó trong version control (dưới dạng file
.mdSystem prompt nên dài bao nhiêu?
Với agent tạo slide, 1.500 đến 2.500 token là điểm ngọt. Prompt ngắn hơn bỏ sót ràng buộc và thất bại ở edge case. Prompt dài hơn chèn ép đầu vào thực tế của người dùng trên các mô hình context nhỏ và thường lặp lại chính nó. Nếu bạn trên 3.000 token, rà soát để tìm sự dư thừa — cùng một quy tắc có lẽ đã được nêu hai lần.
Tôi có cần system prompt khác nhau cho Claude vs GPT-4o vs DeepSeek không?
Chỉ điều chỉnh nhỏ. Template 7 phần hoạt động trên cả ba. Claude phản hồi tốt với khung XML tag (
<thinking><output>Tôi có thể cập nhật system prompt mà không cần redeploy không?
Có — và bạn nên làm được, để lặp nhanh. Lưu prompt trong biến môi trường hoặc dịch vụ feature-flag để SRE có thể roll back một prompt tệ trong vài giây. Đối xử với prompt tệ như một deploy tệ: đó là sự cố production và nó cần cùng các kiểm soát về phạm vi tác động.
Làm sao tôi test một system prompt?
Xây một bộ regression 50 đến 200 cặp đầu vào/đầu ra bao quát phân phối người dùng thật của bạn: bộ slide đường thẳng thuận lợi, đầu vào đối kháng, thử JSON dị dạng, yêu cầu lạc chủ đề. Chạy bộ đầy đủ trên mỗi thay đổi prompt và chấm điểm tuân thủ schema cộng chất lượng do con người đánh giá. Đây là khoản đầu tư kỹ thuật có đòn bẩy cao nhất cho độ tin cậy của agent.
Kết luận
System prompt là hạ tầng, không phải văn bản marketing. Đó là thứ biến một LLM tổng quát thành một agent tạo slide đáng tin cậy với hợp đồng đầu ra biết trước, kho công cụ cố định, và các chế độ thất bại có thể dự đoán. Developer đối xử với system prompt như một tạo phẩm sản phẩm — có version, được test, được giám sát — xuất xưởng các agent sống sót qua tiếp xúc với người dùng thật. Developer đối xử với nó như một bài tập prompt engineering một lần xuất xưởng demo.
Template 7 phần và ví dụ sẵn-cho-production trong hướng dẫn này là điểm khởi đầu, không phải điểm kết thúc. Fork chúng, chuyên môn hóa cho use case của bạn, nối dây vào 2Slides V1 API, và — quan trọng nhất — xây dựng giàn regression trước khi xuất xưởng. Các agent chiến thắng năm 2026 là những agent có prompt được kỹ sư hóa với cùng sự nghiêm ngặt như code của chúng.
Xuất xưởng agent slide của bạn trong production — lấy khóa 2Slides API hoặc khám phá máy chủ MCP.
About 2Slides
Create stunning AI-powered presentations in seconds. Transform your ideas into professional slides with 2slides AI Agent.
Try For Free