From aa7d6f41fb0123c00924e486ede9f83d8c47b45c Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 15:52:53 +0530 Subject: [PATCH 01/11] Added the use-cases in AI agent tools --- Document-Processing-toc.html | 3 + .../ai-agent-tools/customization.md | 4 +- .../ai-agent-tools/use-cases.md | 300 ++++++++++++++++++ 3 files changed, 304 insertions(+), 3 deletions(-) create mode 100644 Document-Processing/ai-agent-tools/use-cases.md diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index ac7f5252c..9ef881d0d 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -50,6 +50,9 @@
  • Example Prompts
  • +
  • + Use Cases +
  • diff --git a/Document-Processing/ai-agent-tools/customization.md b/Document-Processing/ai-agent-tools/customization.md index 24af667c6..5bc265572 100644 --- a/Document-Processing/ai-agent-tools/customization.md +++ b/Document-Processing/ai-agent-tools/customization.md @@ -25,9 +25,7 @@ cd Document-SDK-AI-Agent-Tools **Step 2: Create a Custom AI Agent Tool by Inheriting AgentToolBase** -Open the Syncfusion.DocumentSDK.AI.AgentTools library project - -Syncfusion.DocumentSDK.AI.AgentTools\Syncfusion.DocumentSDK.AI.AgentTools.csproj Then, +Open the Syncfusion.DocumentSDK.AI.AgentTools library project Then, Create a new class inside the Tools that inherits from `AgentToolBase` (in the `Syncfusion.AI.AgentTools.Core` namespace) and accepts a document manager through its constructor: diff --git a/Document-Processing/ai-agent-tools/use-cases.md b/Document-Processing/ai-agent-tools/use-cases.md new file mode 100644 index 000000000..4e46c37f0 --- /dev/null +++ b/Document-Processing/ai-agent-tools/use-cases.md @@ -0,0 +1,300 @@ +--- +title: Create Custom Blog Generator Agent | Syncfusion AI Agent Tools +description: Learn how to build a custom Blog Generator agent that combines Syncfusion Word Agent Tools with the Microsoft Agent Framework and OpenAI to produce richly formatted blog ebooks in HTML and Word. +platform: document-processing +control: AI Agent Tools +documentation: ug +--- + +# Create Custom Blog Generator Agent + +This use case walks through building a **console-based Blog Generator** that +combines the [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview?pivots=programming-language-csharp), +OpenAI (text + image), and Syncfusion Word Agent Tools to produce a +fully-formatted blog ebook in both **HTML** and **Word (.docx)** formats from a +single topic entered by the user. + +## Overview + +The Blog Generator agent runs a five‑phase workflow that turns a single topic into a polished, ebook‑quality document. It begins by creating a clear title and a well‑structured outline with six to ten sections. Each section is then planned and classified (such as `cover`, `chapter`, or `appendix`) and marked based on whether it requires visual support, including tags like `needsImage`. +Next, the agent generates rich HTML content for every section using a consistent CSS structure. For sections that require visuals, it prepares editorial‑style image prompts and generates the images. All content is then assembled into a single HTML document. +In the final step, the AI agent converts the HTML into a Word file using Syncfusion `WordDocumentAgentTools` and `WordImportExportAgentTools`, producing a clean, final `.docx` document. + +## Prerequisites + + + + + + + + + + + + + + + + + + +
    .NET SDK.NET 8.0 or .NET 9.0 or .NET 10.0
    OpenAI API KeyObtain from platform.openai.com
    OpenAI ModelsA text model (default gpt-4o) and an image model (default gpt-image-1.5)
    NuGet Packages +Syncfusion.DocumentSDK.AI.AgentTools
    +Microsoft.Agents.AI.OpenAI
    +OpenAI +
    + +## Integration + +Integrating the Blog Generator agent into a console application involves the +following steps. + +**Step 1: Install NuGet Packages** + +Add the required packages to your project: + +```xml + + + + + +``` + +**Step 2: Configure OpenAI Credentials** + +The application reads the OpenAI API key and model names from environment variables. +If the API key is not found, the user is prompted to enter it, while default models are used automatically. + +```csharp +var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") + ?? PromptRequired("OpenAI API key"); + +var textModel = Environment.GetEnvironmentVariable("OPENAI_TEXT_MODEL") ?? "gpt-4o"; +var imageModel = Environment.GetEnvironmentVariable("OPENAI_IMAGE_MODEL") ?? "gpt-image-1.5"; +``` + +**Step 3: Create the OpenAI Chat Client** + +The same `OpenAIClient` instance is reused for both the chat agent and the image +generator: + +```csharp +var openAiClient = new OpenAIClient(new System.ClientModel.ApiKeyCredential(apiKey)); +var chatClient = openAiClient.GetChatClient(textModel); +``` + +**Step 4: Create the Word Document Manager** + +The `WordDocumentManager` keeps live Word document instances in memory across +tool calls. A 10-minute idle timeout automatically cleans up unused documents: + +```csharp +using Syncfusion.AI.AgentTools.Core; +using Syncfusion.AI.AgentTools.Word; + +var wordManager = new WordDocumentManager(TimeSpan.FromMinutes(10)); +``` + +**Step 5: Instantiate the Word Agent Tool Classes and Collect Tools** + +The Blog Generator uses **two** Syncfusion Word tool classes: + +* `WordDocumentAgentTools` – Creates, loads, and exports Word documents. +* `WordImportExportAgentTools` – Imports HTML (or other formats) into an existing document. + +Both must share the **same** `WordDocumentManager` instance so the document +created by `CreateDocument` is visible to `ImportHtml` and `ExportDocument`: + +```csharp +using AITool = Syncfusion.AI.AgentTools.Core.AITool; + +var outputDir = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "BlogGenerator"); + +var allSyncfusionTools = new List(); +allSyncfusionTools.AddRange(new WordDocumentAgentTools(wordManager, outputDirectory: outputDir).GetTools()); +allSyncfusionTools.AddRange(new WordImportExportAgentTools(wordManager).GetTools()); +``` + +**Step 6: Convert Syncfusion Tools to `Microsoft.Extensions.AI` Functions** + +Syncfusion `AITool` objects expose a `MethodInfo` and target instance. Wrap +them with `AIFunctionFactory.Create` so they are recognised by the Microsoft +Agent Framework: + +```csharp +using Microsoft.Extensions.AI; + +var aiTools = allSyncfusionTools + .Select(t => AIFunctionFactory.Create( + t.Method, + t.Instance, + new AIFunctionFactoryOptions + { + Name = t.Name, + Description = t.Description + })) + .Cast() + .ToList(); +``` + +**Step 7: Build the `AIAgent`** + +Create the agent with a system prompt that defines **two responsibilities**: + +1. Always return **valid JSON** when asked (used by phases 1–4). +2. When asked to build a Word document, strictly follow the + `CreateDocument` → `ImportHtml` → `ExportDocument` tool sequence. + +```csharp +using Microsoft.Agents.AI; + +AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( + instructions: """ + You are an expert technical blogger and document designer. + You always return only valid JSON when asked, with no markdown fences, + no extra commentary, and no trailing text outside the JSON object. + + You also have access to Syncfusion Word document tools. + When asked to create a Word document: + 1. Call CreateDocument to create a new Word document (filePath=null). + 2. Call ImportHtml with the HTML content or file path and the documentId. + 3. Call ExportDocument with the documentId and the output file path (format "Docx"). + Always follow this sequence and wait for each result before proceeding. + """, + name: "BlogGenerationAgent", + tools: aiTools); +``` + +**Step 8: Wrap the Agent for the Four Content-Generation Phases** + +`BlogGenerationAgent` is a thin wrapper that exposes one method per phase and +centralises prompt templates, JSON schema contracts, and retry/parse logic: + +```csharp +var blogAgent = new BlogGenerationAgent(aiAgent); +var imageGenerator = new ImageGenerator(openAiClient, imageModel); +``` + +The four phase methods are: + +| Method | Phase | Returns | +|---|---|---| +| `GenerateOutlineAsync(topic)` | 1. Title & Outline | `BlogOutline` | +| `PlanSectionsAsync(outline)` | 2. Layout Planning | `SectionPlanList` | +| `GenerateSectionHtmlAsync(title, plan, idx, total)` | 3. HTML Content | `string` (HTML fragment) | +| `GenerateImagePromptAsync(title, plan)` | 4. Image Prompt | `string` | + +**Step 9: Generate Blog Sections and Assemble HTML** + +After generating the outline, the user reviews and approves it using an interactive [Y/n/r] prompt (Yes / No / Regenerate). +Once approved, the app generates content for each section, creates images when required, and combines everything into a single HTML blog file saved locally. + +```csharp +var blogSections = new List(); +for (int idx = 0; idx < sections.Count; idx++) +{ + var plan = sections[idx]; + + var htmlFragment = await blogAgent.GenerateSectionHtmlAsync( + outline.Title, plan, idx, sections.Count); + + string? imageBase64 = null; + if (plan.NeedsImage) + { + var imagePrompt = await blogAgent.GenerateImagePromptAsync(outline.Title, plan); + imageBase64 = await imageGenerator.GenerateBase64Async(imagePrompt); + } + + blogSections.Add(new BlogSection + { + Plan = plan, + HtmlFragment = htmlFragment, + ImageBase64 = imageBase64, + ImageCaption = plan.ImagePurpose + }); +} + +var html = HtmlAssembler.Assemble(outline.Title, blogSections); +var filename = HtmlAssembler.DeriveFilename(outline.Title) + ".html"; +var filePath = Path.Combine(outputDir, filename); +HtmlAssembler.SaveToFile(filePath, html); +``` + +**Step 10: Convert the HTML Blog to a Word Document via the AI Agent (Phase 5)** + +This is where the Syncfusion Word Agent Tools handle the document workflow. A single natural‑language prompt allows the agent to automatically invoke the required tools in the correct sequence. + +```csharp +using ChatMessage = Microsoft.Extensions.AI.ChatMessage; +using ChatRole = Microsoft.Extensions.AI.ChatRole; + +var wordFilePath = Path.Combine(outputDir, + HtmlAssembler.DeriveFilename(outline.Title) + ".docx"); + +var history = new List(); +var userPrompt = + $"Create a new Word document, import the HTML from the file '{filePath}' " + + $"into it, and then export/save it as '{wordFilePath}' in Docx format."; +history.Add(new ChatMessage(ChatRole.User, userPrompt)); + +var response = await aiAgent.RunAsync(history).ConfigureAwait(false); + +foreach (var message in response.Messages) +{ + foreach (var content in message.Contents) + { + if (content is TextContent text && !string.IsNullOrEmpty(text.Text)) + Console.WriteLine($" AI: {text.Text}"); + else if (content is FunctionCallContent call) + Console.WriteLine($" [Tool call : {call.Name}]"); + else if (content is FunctionResultContent result) + Console.WriteLine($" [Tool result: {result.Result}]"); + } +} +``` + +## How it works + +At runtime, the console application performs the following actions: + +1. **Ask blog topic.** Prompt the user to enter a blog topic from the console. +2. **Provide the blog title and outline for confirmation.** The agent drafts a title and 6–10 section outline which is displayed for the user to approve, regenerate, or cancel (`[Y/n/r]`). +3. **Draft blog content as HTML.** For each approved section, the agent produces a rich HTML fragment using a fixed CSS class vocabulary. +4. **Generate images for this blog using the `gpt-image-1.5` model.** For sections flagged `needsImage`, the agent writes an editorial-style image prompt and the OpenAI image model returns a PNG, embedded as Base64. +5. **Convert the HTML to Word by using the Syncfusion AI Agent Tools library.** The AI agent autonomously chains `CreateDocument` → `ImportHtml` → `ExportDocument` from `WordDocumentAgentTools` and `WordImportExportAgentTools`. +6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder (`%USERPROFILE%\Desktop\BlogGenerator` by default). + +**Why two layers of agent usage?** + +* Phases 1–4 treat the LLM as a pure text generator. `BlogGenerationAgent` + enforces structured JSON output via prompt + schema + retry so downstream + code can work with strongly-typed models (`BlogOutline`, `SectionPlan`, + `SectionHtml`). +* Phase 5 treats the LLM as a tool-calling orchestrator. The user prompt is + declarative ("create… import… export…") and the registered Syncfusion tool + descriptions guide the agent to call each function in the right order with + the right `documentId`. + +The shared `WordDocumentManager` guarantees that the in-memory document +created in step 1 of Phase 5 survives across the subsequent `ImportHtml` and +`ExportDocument` tool invocations, which is exactly the +[in-memory mode](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started-in-memory-mode) contract. + +## Complete Startup Code + +For a complete, runnable example combining all steps, refer to the console +application in this repository: + +Examples/Console/BlogGenerator/Program.cs + +## See Also + +* [Getting Started - In-Memory Mode](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started-in-memory-mode) +* [AI Agent Tools Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) +* [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) +* [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) +* [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +* [Microsoft Agent Framework – C# Providers](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) From adfb13ceaa22350972d000d4ab3b31ad7bc25940 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 16:06:28 +0530 Subject: [PATCH 02/11] Resolved the CI failures --- Document-Processing/ai-agent-tools/use-cases.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Document-Processing/ai-agent-tools/use-cases.md b/Document-Processing/ai-agent-tools/use-cases.md index 4e46c37f0..424fc5910 100644 --- a/Document-Processing/ai-agent-tools/use-cases.md +++ b/Document-Processing/ai-agent-tools/use-cases.md @@ -1,6 +1,6 @@ --- title: Create Custom Blog Generator Agent | Syncfusion AI Agent Tools -description: Learn how to build a custom Blog Generator agent that combines Syncfusion Word Agent Tools with the Microsoft Agent Framework and OpenAI to produce richly formatted blog ebooks in HTML and Word. +description: Learn how to build a custom Blog Generator agent using Syncfusion Word tools, Microsoft Agent Framework, and OpenAI to create rich blog ebooks. platform: document-processing control: AI Agent Tools documentation: ug @@ -121,7 +121,7 @@ allSyncfusionTools.AddRange(new WordImportExportAgentTools(wordManager).GetTools **Step 6: Convert Syncfusion Tools to `Microsoft.Extensions.AI` Functions** Syncfusion `AITool` objects expose a `MethodInfo` and target instance. Wrap -them with `AIFunctionFactory.Create` so they are recognised by the Microsoft +them with `AIFunctionFactory.Create` so they are recognized by the Microsoft Agent Framework: ```csharp @@ -171,7 +171,7 @@ AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( **Step 8: Wrap the Agent for the Four Content-Generation Phases** `BlogGenerationAgent` is a thin wrapper that exposes one method per phase and -centralises prompt templates, JSON schema contracts, and retry/parse logic: +centralizes prompt templates, JSON schema contracts, and retry/parse logic: ```csharp var blogAgent = new BlogGenerationAgent(aiAgent); From 3842372c27470b182e2bdf4f2693a562843f7e96 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 17:20:09 +0530 Subject: [PATCH 03/11] Addressed the feed backs --- Document-Processing-toc.html | 2 +- .../ai-agent-tools/customization.md | 4 +--- .../ai-agent-tools/{use-cases.md => use-case.md} | 15 +-------------- 3 files changed, 3 insertions(+), 18 deletions(-) rename Document-Processing/ai-agent-tools/{use-cases.md => use-case.md} (89%) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 9ef881d0d..2f3719f18 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -51,7 +51,7 @@ Example Prompts
  • - Use Cases + Example Use Case
  • diff --git a/Document-Processing/ai-agent-tools/customization.md b/Document-Processing/ai-agent-tools/customization.md index 5bc265572..d6c6279ae 100644 --- a/Document-Processing/ai-agent-tools/customization.md +++ b/Document-Processing/ai-agent-tools/customization.md @@ -25,9 +25,7 @@ cd Document-SDK-AI-Agent-Tools **Step 2: Create a Custom AI Agent Tool by Inheriting AgentToolBase** -Open the Syncfusion.DocumentSDK.AI.AgentTools library project Then, - -Create a new class inside the Tools that inherits from `AgentToolBase` (in the `Syncfusion.AI.AgentTools.Core` namespace) and accepts a document manager through its constructor: +Open the Syncfusion.DocumentSDK.AI.AgentTools library project. Then, create a new class inside the Tools that inherits from `AgentToolBase` (in the `Syncfusion.AI.AgentTools.Core` namespace) and accepts a document manager through its constructor: ```csharp using Syncfusion.AI.AgentTools.Core; diff --git a/Document-Processing/ai-agent-tools/use-cases.md b/Document-Processing/ai-agent-tools/use-case.md similarity index 89% rename from Document-Processing/ai-agent-tools/use-cases.md rename to Document-Processing/ai-agent-tools/use-case.md index 424fc5910..83dca2c51 100644 --- a/Document-Processing/ai-agent-tools/use-cases.md +++ b/Document-Processing/ai-agent-tools/use-case.md @@ -16,9 +16,7 @@ single topic entered by the user. ## Overview -The Blog Generator agent runs a five‑phase workflow that turns a single topic into a polished, ebook‑quality document. It begins by creating a clear title and a well‑structured outline with six to ten sections. Each section is then planned and classified (such as `cover`, `chapter`, or `appendix`) and marked based on whether it requires visual support, including tags like `needsImage`. -Next, the agent generates rich HTML content for every section using a consistent CSS structure. For sections that require visuals, it prepares editorial‑style image prompts and generates the images. All content is then assembled into a single HTML document. -In the final step, the AI agent converts the HTML into a Word file using Syncfusion `WordDocumentAgentTools` and `WordImportExportAgentTools`, producing a clean, final `.docx` document. +The Blog Generator turns a single topic into a complete, ebook‑quality document through five simple steps. It starts by creating a clear title and structured outline, then plans each section and decides where visuals are helpful. Next, it writes detailed, well‑formatted content and adds suitable images where needed. Finally, everything is combined and delivered as a clean Word document ready for use. ## Prerequisites @@ -267,17 +265,6 @@ At runtime, the console application performs the following actions: 5. **Convert the HTML to Word by using the Syncfusion AI Agent Tools library.** The AI agent autonomously chains `CreateDocument` → `ImportHtml` → `ExportDocument` from `WordDocumentAgentTools` and `WordImportExportAgentTools`. 6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder (`%USERPROFILE%\Desktop\BlogGenerator` by default). -**Why two layers of agent usage?** - -* Phases 1–4 treat the LLM as a pure text generator. `BlogGenerationAgent` - enforces structured JSON output via prompt + schema + retry so downstream - code can work with strongly-typed models (`BlogOutline`, `SectionPlan`, - `SectionHtml`). -* Phase 5 treats the LLM as a tool-calling orchestrator. The user prompt is - declarative ("create… import… export…") and the registered Syncfusion tool - descriptions guide the agent to call each function in the right order with - the right `documentId`. - The shared `WordDocumentManager` guarantees that the in-memory document created in step 1 of Phase 5 survives across the subsequent `ImportHtml` and `ExportDocument` tool invocations, which is exactly the From cab28d773fe0912cf9258185e99c2b9b287c9293 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 17:32:08 +0530 Subject: [PATCH 04/11] Renamed the md file --- .../ai-agent-tools/{use-case.md => example-use-case.md} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename Document-Processing/ai-agent-tools/{use-case.md => example-use-case.md} (100%) diff --git a/Document-Processing/ai-agent-tools/use-case.md b/Document-Processing/ai-agent-tools/example-use-case.md similarity index 100% rename from Document-Processing/ai-agent-tools/use-case.md rename to Document-Processing/ai-agent-tools/example-use-case.md From 6ce485d6ce25897ae6592316dfd25e80cab84457 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 17:55:45 +0530 Subject: [PATCH 05/11] addressed the feed backs --- .../ai-agent-tools/example-use-case.md | 45 ++++++++++++------- 1 file changed, 28 insertions(+), 17 deletions(-) diff --git a/Document-Processing/ai-agent-tools/example-use-case.md b/Document-Processing/ai-agent-tools/example-use-case.md index 83dca2c51..d6a03cc6c 100644 --- a/Document-Processing/ai-agent-tools/example-use-case.md +++ b/Document-Processing/ai-agent-tools/example-use-case.md @@ -60,7 +60,19 @@ Add the required packages to your project: ``` -**Step 2: Configure OpenAI Credentials** +**Step 2: Register the Syncfusion License** + +Register your Syncfusion license key at application startup before performing any document operations: + +```csharp +string? licenseKey = Environment.GetEnvironmentVariable("SYNCFUSION_LICENSE_KEY"); +if (!string.IsNullOrEmpty(licenseKey)) +{ + Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(licenseKey); +} +``` + +**Step 3: Configure OpenAI Credentials** The application reads the OpenAI API key and model names from environment variables. If the API key is not found, the user is prompted to enter it, while default models are used automatically. @@ -73,7 +85,7 @@ var textModel = Environment.GetEnvironmentVariable("OPENAI_TEXT_MODEL") ?? "gp var imageModel = Environment.GetEnvironmentVariable("OPENAI_IMAGE_MODEL") ?? "gpt-image-1.5"; ``` -**Step 3: Create the OpenAI Chat Client** +**Step 4: Create the OpenAI Chat Client** The same `OpenAIClient` instance is reused for both the chat agent and the image generator: @@ -83,7 +95,7 @@ var openAiClient = new OpenAIClient(new System.ClientModel.ApiKeyCredential(apiK var chatClient = openAiClient.GetChatClient(textModel); ``` -**Step 4: Create the Word Document Manager** +**Step 5: Create the Word Document Manager** The `WordDocumentManager` keeps live Word document instances in memory across tool calls. A 10-minute idle timeout automatically cleans up unused documents: @@ -95,7 +107,7 @@ using Syncfusion.AI.AgentTools.Word; var wordManager = new WordDocumentManager(TimeSpan.FromMinutes(10)); ``` -**Step 5: Instantiate the Word Agent Tool Classes and Collect Tools** +**Step 6: Instantiate the Word Agent Tool Classes and Collect Tools** The Blog Generator uses **two** Syncfusion Word tool classes: @@ -108,15 +120,14 @@ created by `CreateDocument` is visible to `ImportHtml` and `ExportDocument`: ```csharp using AITool = Syncfusion.AI.AgentTools.Core.AITool; -var outputDir = Path.Combine( - Environment.GetFolderPath(Environment.SpecialFolder.Desktop), "BlogGenerator"); +var outputDir = Path.GetFullPath(Environment.CurrentDirectory + @"..\..\..\..\Data\Output\"); var allSyncfusionTools = new List(); allSyncfusionTools.AddRange(new WordDocumentAgentTools(wordManager, outputDirectory: outputDir).GetTools()); allSyncfusionTools.AddRange(new WordImportExportAgentTools(wordManager).GetTools()); ``` -**Step 6: Convert Syncfusion Tools to `Microsoft.Extensions.AI` Functions** +**Step 7: Convert Syncfusion Tools to `Microsoft.Extensions.AI` Functions** Syncfusion `AITool` objects expose a `MethodInfo` and target instance. Wrap them with `AIFunctionFactory.Create` so they are recognized by the Microsoft @@ -138,7 +149,7 @@ var aiTools = allSyncfusionTools .ToList(); ``` -**Step 7: Build the `AIAgent`** +**Step 8: Build the `AIAgent`** Create the agent with a system prompt that defines **two responsibilities**: @@ -166,7 +177,7 @@ AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( tools: aiTools); ``` -**Step 8: Wrap the Agent for the Four Content-Generation Phases** +**Step 9: Wrap the Agent for the Four Content-Generation Phases** `BlogGenerationAgent` is a thin wrapper that exposes one method per phase and centralizes prompt templates, JSON schema contracts, and retry/parse logic: @@ -185,7 +196,7 @@ The four phase methods are: | `GenerateSectionHtmlAsync(title, plan, idx, total)` | 3. HTML Content | `string` (HTML fragment) | | `GenerateImagePromptAsync(title, plan)` | 4. Image Prompt | `string` | -**Step 9: Generate Blog Sections and Assemble HTML** +**Step 10: Generate Blog Sections and Assemble HTML** After generating the outline, the user reviews and approves it using an interactive [Y/n/r] prompt (Yes / No / Regenerate). Once approved, the app generates content for each section, creates images when required, and combines everything into a single HTML blog file saved locally. @@ -221,7 +232,7 @@ var filePath = Path.Combine(outputDir, filename); HtmlAssembler.SaveToFile(filePath, html); ``` -**Step 10: Convert the HTML Blog to a Word Document via the AI Agent (Phase 5)** +**Step 11: Convert the HTML Blog to a Word Document via the AI Agent (Phase 5)** This is where the Syncfusion Word Agent Tools handle the document workflow. A single natural‑language prompt allows the agent to automatically invoke the required tools in the correct sequence. @@ -268,7 +279,7 @@ At runtime, the console application performs the following actions: The shared `WordDocumentManager` guarantees that the in-memory document created in step 1 of Phase 5 survives across the subsequent `ImportHtml` and `ExportDocument` tool invocations, which is exactly the -[in-memory mode](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started-in-memory-mode) contract. +[in-memory mode](./getting-started-in-memory-mode) contract. ## Complete Startup Code @@ -279,9 +290,9 @@ Examples/Console/BlogGenerator/Program.cs ## See Also -* [Getting Started - In-Memory Mode](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started-in-memory-mode) -* [AI Agent Tools Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) -* [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -* [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) -* [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +* [Getting Started - In-Memory Mode](./getting-started-in-memory-mode) +* [AI Agent Tools Overview](./overview) +* [Tools](./tools) +* [Customization](./customization) +* [Example Prompts](./example-prompts) * [Microsoft Agent Framework – C# Providers](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) From ddc96cc37e198ac428c6db883e989b50f95614b5 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 18:05:35 +0530 Subject: [PATCH 06/11] updated the file name in TOC --- Document-Processing-toc.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 2f3719f18..4a8525952 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -51,7 +51,7 @@ Example Prompts
  • - Example Use Case + Example Use Case
  • From d26b3dd202a3ffca2a60fcac33b9d30f33f8426b Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 19:49:50 +0530 Subject: [PATCH 07/11] Addressed the new feed backs --- Document-Processing-toc.html | 2 +- .../ai-agent-tools/example-use-case.md | 45 +++++-------------- .../getting-started-in-memory-mode.md | 1 + .../getting-started-storage-mode.md | 2 + 4 files changed, 16 insertions(+), 34 deletions(-) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 4a8525952..54aff898f 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -51,7 +51,7 @@ Example Prompts
  • - Example Use Case + Example Use Cases
  • diff --git a/Document-Processing/ai-agent-tools/example-use-case.md b/Document-Processing/ai-agent-tools/example-use-case.md index d6a03cc6c..ba2594d6d 100644 --- a/Document-Processing/ai-agent-tools/example-use-case.md +++ b/Document-Processing/ai-agent-tools/example-use-case.md @@ -8,7 +8,7 @@ documentation: ug # Create Custom Blog Generator Agent -This use case walks through building a **console-based Blog Generator** that +This use case walks through building a **Blog Generator** that combines the [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview?pivots=programming-language-csharp), OpenAI (text + image), and Syncfusion Word Agent Tools to produce a fully-formatted blog ebook in both **HTML** and **Word (.docx)** formats from a @@ -16,7 +16,7 @@ single topic entered by the user. ## Overview -The Blog Generator turns a single topic into a complete, ebook‑quality document through five simple steps. It starts by creating a clear title and structured outline, then plans each section and decides where visuals are helpful. Next, it writes detailed, well‑formatted content and adds suitable images where needed. Finally, everything is combined and delivered as a clean Word document ready for use. +The Blog Generator turns a single topic into a complete, ebook‑quality document through five simple steps. It starts by creating a clear title and structured outline, then plans each section and decides where visuals are helpful. Next, it writes detailed, well‑formatted content and adds suitable images where needed. Finally, everything is combined and delivered as a clean Word document ready for use. This sample application uses an [in‑memory mode](./getting-started-in-memory-mode.md). ## Prerequisites @@ -43,22 +43,16 @@ The Blog Generator turns a single topic into a complete, ebook‑quality documen +>**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. + ## Integration Integrating the Blog Generator agent into a console application involves the following steps. -**Step 1: Install NuGet Packages** - -Add the required packages to your project: +**Step 1: Install the [Syncfusion.DocumentSDK.AI.AgentTools](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).** -```xml - - - - - -``` +![Install DocIO .NET Core NuGet package](Install_Nuget.png) **Step 2: Register the Syncfusion License** @@ -153,7 +147,7 @@ var aiTools = allSyncfusionTools Create the agent with a system prompt that defines **two responsibilities**: -1. Always return **valid JSON** when asked (used by phases 1–4). +1. Always return **valid JSON** when asked. 2. When asked to build a Word document, strictly follow the `CreateDocument` → `ImportHtml` → `ExportDocument` tool sequence. @@ -177,25 +171,15 @@ AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( tools: aiTools); ``` -**Step 9: Wrap the Agent for the Four Content-Generation Phases** +**Step 9: Content Generation Wrapper** -`BlogGenerationAgent` is a thin wrapper that exposes one method per phase and -centralizes prompt templates, JSON schema contracts, and retry/parse logic: +`BlogGenerationAgent` is a simple wrapper that handles all four content‑generation phases in one place. ```csharp var blogAgent = new BlogGenerationAgent(aiAgent); var imageGenerator = new ImageGenerator(openAiClient, imageModel); ``` -The four phase methods are: - -| Method | Phase | Returns | -|---|---|---| -| `GenerateOutlineAsync(topic)` | 1. Title & Outline | `BlogOutline` | -| `PlanSectionsAsync(outline)` | 2. Layout Planning | `SectionPlanList` | -| `GenerateSectionHtmlAsync(title, plan, idx, total)` | 3. HTML Content | `string` (HTML fragment) | -| `GenerateImagePromptAsync(title, plan)` | 4. Image Prompt | `string` | - **Step 10: Generate Blog Sections and Assemble HTML** After generating the outline, the user reviews and approves it using an interactive [Y/n/r] prompt (Yes / No / Regenerate). @@ -271,15 +255,10 @@ At runtime, the console application performs the following actions: 1. **Ask blog topic.** Prompt the user to enter a blog topic from the console. 2. **Provide the blog title and outline for confirmation.** The agent drafts a title and 6–10 section outline which is displayed for the user to approve, regenerate, or cancel (`[Y/n/r]`). -3. **Draft blog content as HTML.** For each approved section, the agent produces a rich HTML fragment using a fixed CSS class vocabulary. -4. **Generate images for this blog using the `gpt-image-1.5` model.** For sections flagged `needsImage`, the agent writes an editorial-style image prompt and the OpenAI image model returns a PNG, embedded as Base64. +3. **Draft blog content as HTML.** For each approved section, the agent generates structured HTML content with consistent styling. +4. **Generate images for this blog using the `gpt-image-1.5` model.** For sections marked `needsImage`, the AI returns PNG images and embedded as Base64. 5. **Convert the HTML to Word by using the Syncfusion AI Agent Tools library.** The AI agent autonomously chains `CreateDocument` → `ImportHtml` → `ExportDocument` from `WordDocumentAgentTools` and `WordImportExportAgentTools`. -6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder (`%USERPROFILE%\Desktop\BlogGenerator` by default). - -The shared `WordDocumentManager` guarantees that the in-memory document -created in step 1 of Phase 5 survives across the subsequent `ImportHtml` and -`ExportDocument` tool invocations, which is exactly the -[in-memory mode](./getting-started-in-memory-mode) contract. +6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder. ## Complete Startup Code diff --git a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md index d88df8212..6aa6b008b 100644 --- a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md @@ -23,6 +23,7 @@ Documents are held as live objects in an in-memory dictionary. Each tool accesse | **OpenAI API Key** | Obtain from platform.openai.com | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI) | +>**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. ## Integration diff --git a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md index 4a1af68da..645709291 100644 --- a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md @@ -26,6 +26,8 @@ Documents are read from and written to storage (Azure Blob, S3, local disk, etc. | **Azure Storage Account** | Create from [Azure Portal](https://portal.azure.com) with a blob container | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI), and [Azure.Storage.Blobs](https://www.nuget.org/packages/Azure.Storage.Blobs) | +>**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. + ## Integration Integrating the Agent Tool library into your application involves the following steps: From 7e781f9a1df2a1b592665469b34dbc6da40fba2d Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Wed, 29 Apr 2026 20:05:01 +0530 Subject: [PATCH 08/11] addressed the feed backs --- Document-Processing/ai-agent-tools/example-use-case.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Document-Processing/ai-agent-tools/example-use-case.md b/Document-Processing/ai-agent-tools/example-use-case.md index ba2594d6d..496153746 100644 --- a/Document-Processing/ai-agent-tools/example-use-case.md +++ b/Document-Processing/ai-agent-tools/example-use-case.md @@ -50,7 +50,7 @@ The Blog Generator turns a single topic into a complete, ebook‑quality documen Integrating the Blog Generator agent into a console application involves the following steps. -**Step 1: Install the [Syncfusion.DocumentSDK.AI.AgentTools](https://www.nuget.org/packages/Syncfusion.DocIO.Net.Core) NuGet package as a reference to your project from [NuGet.org](https://www.nuget.org/).** +**Step 1: Install all the required NuGet packages as a reference to your project from [NuGet.org](https://www.nuget.org/).** ![Install DocIO .NET Core NuGet package](Install_Nuget.png) @@ -173,7 +173,7 @@ AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( **Step 9: Content Generation Wrapper** -`BlogGenerationAgent` is a simple wrapper that handles all four content‑generation phases in one place. +`BlogGenerationAgent` is a simple wrapper that handles all four(Title & Outline, Layout Planning and HTML Content, Image Prompt) content‑generation phases in one place. ```csharp var blogAgent = new BlogGenerationAgent(aiAgent); @@ -256,7 +256,7 @@ At runtime, the console application performs the following actions: 1. **Ask blog topic.** Prompt the user to enter a blog topic from the console. 2. **Provide the blog title and outline for confirmation.** The agent drafts a title and 6–10 section outline which is displayed for the user to approve, regenerate, or cancel (`[Y/n/r]`). 3. **Draft blog content as HTML.** For each approved section, the agent generates structured HTML content with consistent styling. -4. **Generate images for this blog using the `gpt-image-1.5` model.** For sections marked `needsImage`, the AI returns PNG images and embedded as Base64. +4. **Generate images for this blog using the `gpt-image-1.5` model.** For required sections, the AI returns PNG images and embedded as Base64. 5. **Convert the HTML to Word by using the Syncfusion AI Agent Tools library.** The AI agent autonomously chains `CreateDocument` → `ImportHtml` → `ExportDocument` from `WordDocumentAgentTools` and `WordImportExportAgentTools`. 6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder. From 1fc26ede874ce35307ac44ccb1330fe99f3722d8 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Thu, 30 Apr 2026 11:20:16 +0530 Subject: [PATCH 09/11] Updated the PDF prompt in Example prompts section --- Document-Processing/ai-agent-tools/example-prompts.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Document-Processing/ai-agent-tools/example-prompts.md b/Document-Processing/ai-agent-tools/example-prompts.md index 3c04709fa..d90da0a70 100644 --- a/Document-Processing/ai-agent-tools/example-prompts.md +++ b/Document-Processing/ai-agent-tools/example-prompts.md @@ -23,7 +23,7 @@ Load the insurance policy document ‘policy_document.pdf’ from {InputDir}. Th Load the court filing document ‘case_filing.pdf’ from {InputDir} and Find the Text ‘John Michael’ and ‘Ellwood Drive, Austin, TX 78701’ and ‘472-90-1835’. Permanently redact all identifiable information. Use black highlight color for all redactions. Export the redacted document as ‘case_filing_redacted.pdf’ to {OutputDir}. {% endpromptcard %} {% promptcard SignPdf %} -Load the vendor contract 'vendor_agreement_draft.pdf' from {InputDir} and apply a digital signature using the company certificate 'certificate.pfx' (located at {InputDir}) with the password 'password123'. Place the signature in the bottom-right corner of the last page and use the company logo 'signature_logo.png' from {InputDir} as the signature appearance image. Export the signed contract as 'vendor_agreement_signed.pdf' to {OutputDir}. +Load the vendor contract ‘vendor_agreement_draft.pdf’ from {InputDir} and apply a digital signature using the company certificate ‘certificate.pfx’ (located at {InputDir}) with the password ‘password123’. Place the signature in the bounds(500,700,100,50) of the last page and use the company logo ‘signature_logo.png’ from {InputDir} as the signature appearance image. Export the signed contract as ‘vendor_agreement_signed.pdf’ to {OutputDir}. {% endpromptcard %} {% promptcard MergePdfs, ReorderPdfPages %} Merge the following monthly financial reports into a single consolidated annual report: ‘Jan_report.pdf’, ‘Feb_report.pdf’, ‘Mar_report.pdf’, ‘Apr_report.pdf’, ‘May_report.pdf’, ‘Jun_report.pdf’ - all located at {InputDir}. Each PDF has 3 pages, with the last page being the executive summary. After merging, reorder pages so each month’s summary page appears first, followed by the other two pages, while keeping January–June chronological order. Save the final file as annual_report_2025.pdf in {OutputDir}. From 77826f4a4ac0a5cd794fe289d819e2d88cab181d Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Thu, 30 Apr 2026 15:35:19 +0530 Subject: [PATCH 10/11] Addressed the new feed backs in the AI agent tool library section --- .../ai-agent-tools/customization.md | 11 +- .../ai-agent-tools/example-prompts.md | 9 +- ...ample-use-case.md => example-use-cases.md} | 125 ++++-------------- .../getting-started-in-memory-mode.md | 13 +- .../getting-started-storage-mode.md | 14 +- .../ai-agent-tools/getting-started.md | 1 + .../ai-agent-tools/overview.md | 93 +++++++++++-- Document-Processing/ai-agent-tools/tools.md | 23 ++-- 8 files changed, 147 insertions(+), 142 deletions(-) rename Document-Processing/ai-agent-tools/{example-use-case.md => example-use-cases.md} (61%) diff --git a/Document-Processing/ai-agent-tools/customization.md b/Document-Processing/ai-agent-tools/customization.md index d6c6279ae..01057797b 100644 --- a/Document-Processing/ai-agent-tools/customization.md +++ b/Document-Processing/ai-agent-tools/customization.md @@ -14,7 +14,7 @@ The [Syncfusion Document SDK AI Agent Tool library](https://www.nuget.org/packag ## Creating a Custom AI Agent Tool Class -Follow these steps to enable new document operations to the AI agent tool library. +Follow these steps to enable new document operations to the [AI agent tool library](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main). **Step 1: Clone the repository** @@ -271,7 +271,8 @@ The agent will call `Word_CreateDocument` to load the file, then `Word_AddTextWa ## See Also -- [Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) -- [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -- [Getting Started](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started) -- [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +- [Overview](./overview) +- [Tools](./tools) +- [Getting Started](./getting-started) +- [Example Prompts](./example-prompts) +- [Example Use Cases](./example-use-cases) diff --git a/Document-Processing/ai-agent-tools/example-prompts.md b/Document-Processing/ai-agent-tools/example-prompts.md index d90da0a70..0f4d0a62d 100644 --- a/Document-Processing/ai-agent-tools/example-prompts.md +++ b/Document-Processing/ai-agent-tools/example-prompts.md @@ -123,7 +123,8 @@ Extract only the table data from the quarterly financial report 'financial_repor ## See also -* [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -* [Getting Started](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started) -* [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) -* [Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) +* [Tools](./tools) +* [Getting Started](./getting-started) +* [Customization](./customization) +* [Overview](./overview) +* [Example Use Cases](./example-use-cases) \ No newline at end of file diff --git a/Document-Processing/ai-agent-tools/example-use-case.md b/Document-Processing/ai-agent-tools/example-use-cases.md similarity index 61% rename from Document-Processing/ai-agent-tools/example-use-case.md rename to Document-Processing/ai-agent-tools/example-use-cases.md index 496153746..584bc78c9 100644 --- a/Document-Processing/ai-agent-tools/example-use-case.md +++ b/Document-Processing/ai-agent-tools/example-use-cases.md @@ -1,6 +1,6 @@ --- -title: Create Custom Blog Generator Agent | Syncfusion AI Agent Tools -description: Learn how to build a custom Blog Generator agent using Syncfusion Word tools, Microsoft Agent Framework, and OpenAI to create rich blog ebooks. +title: Example Use Cases | Syncfusion AI Agent Tools +description: Explore example use cases for building a Blog Generator agent using Syncfusion Word tools, the Microsoft Agent Framework, and OpenAI. platform: document-processing control: AI Agent Tools documentation: ug @@ -8,15 +8,9 @@ documentation: ug # Create Custom Blog Generator Agent -This use case walks through building a **Blog Generator** that -combines the [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview?pivots=programming-language-csharp), -OpenAI (text + image), and Syncfusion Word Agent Tools to produce a -fully-formatted blog ebook in both **HTML** and **Word (.docx)** formats from a -single topic entered by the user. - ## Overview -The Blog Generator turns a single topic into a complete, ebook‑quality document through five simple steps. It starts by creating a clear title and structured outline, then plans each section and decides where visuals are helpful. Next, it writes detailed, well‑formatted content and adds suitable images where needed. Finally, everything is combined and delivered as a clean Word document ready for use. This sample application uses an [in‑memory mode](./getting-started-in-memory-mode.md). +This example use case demonstrates building a **Blog Generator** that uses the [Microsoft Agent Framework](https://learn.microsoft.com/en-us/agent-framework/overview/agent-framework-overview?pivots=programming-language-csharp), OpenAI (text and image generation), and Syncfusion Word Agent Tools to convert a single user‑provided topic into a fully formatted blog ebook. The agent generates a title and structured outline, creates detailed content with relevant images, and outputs the final result in **HTML** and **Word (.docx)** formats. This sample application runs using [in‑memory mode](./getting-started-in-memory-mode.md) for document processing. ## Prerequisites @@ -45,73 +39,37 @@ The Blog Generator turns a single topic into a complete, ebook‑quality documen >**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. -## Integration - -Integrating the Blog Generator agent into a console application involves the -following steps. - -**Step 1: Install all the required NuGet packages as a reference to your project from [NuGet.org](https://www.nuget.org/).** - -![Install DocIO .NET Core NuGet package](Install_Nuget.png) +## Configure OpenAI Credentials and Syncfusion Document SDK AI Agent Tools -**Step 2: Register the Syncfusion License** - -Register your Syncfusion license key at application startup before performing any document operations: +Integrating the Blog Generator agent into a console application involves the following step: configuring OpenAI credentials, registering the Syncfusion license, initializing the OpenAI client, setting up the Word Document Manager, and enabling Syncfusion Document SDK AI Agent tools for document creation and export. ```csharp +using Syncfusion.AI.AgentTools.Core; +using Syncfusion.AI.AgentTools.Word; +using Microsoft.Extensions.AI; + +// Register Syncfusion license string? licenseKey = Environment.GetEnvironmentVariable("SYNCFUSION_LICENSE_KEY"); if (!string.IsNullOrEmpty(licenseKey)) { Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense(licenseKey); } -``` -**Step 3: Configure OpenAI Credentials** - -The application reads the OpenAI API key and model names from environment variables. -If the API key is not found, the user is prompted to enter it, while default models are used automatically. - -```csharp +// Read OpenAI credentials and model configuration var apiKey = Environment.GetEnvironmentVariable("OPENAI_API_KEY") ?? PromptRequired("OpenAI API key"); var textModel = Environment.GetEnvironmentVariable("OPENAI_TEXT_MODEL") ?? "gpt-4o"; var imageModel = Environment.GetEnvironmentVariable("OPENAI_IMAGE_MODEL") ?? "gpt-image-1.5"; -``` - -**Step 4: Create the OpenAI Chat Client** - -The same `OpenAIClient` instance is reused for both the chat agent and the image -generator: -```csharp +// Create OpenAI client and chat client var openAiClient = new OpenAIClient(new System.ClientModel.ApiKeyCredential(apiKey)); var chatClient = openAiClient.GetChatClient(textModel); -``` - -**Step 5: Create the Word Document Manager** - -The `WordDocumentManager` keeps live Word document instances in memory across -tool calls. A 10-minute idle timeout automatically cleans up unused documents: - -```csharp -using Syncfusion.AI.AgentTools.Core; -using Syncfusion.AI.AgentTools.Word; +// Create Word Document Manager (in-memory with timeout) var wordManager = new WordDocumentManager(TimeSpan.FromMinutes(10)); -``` -**Step 6: Instantiate the Word Agent Tool Classes and Collect Tools** - -The Blog Generator uses **two** Syncfusion Word tool classes: - -* `WordDocumentAgentTools` – Creates, loads, and exports Word documents. -* `WordImportExportAgentTools` – Imports HTML (or other formats) into an existing document. - -Both must share the **same** `WordDocumentManager` instance so the document -created by `CreateDocument` is visible to `ImportHtml` and `ExportDocument`: - -```csharp +// Instantiate Syncfusion Word AI Agent tools using AITool = Syncfusion.AI.AgentTools.Core.AITool; var outputDir = Path.GetFullPath(Environment.CurrentDirectory + @"..\..\..\..\Data\Output\"); @@ -119,17 +77,8 @@ var outputDir = Path.GetFullPath(Environment.CurrentDirectory + @"..\..\..\..\Da var allSyncfusionTools = new List(); allSyncfusionTools.AddRange(new WordDocumentAgentTools(wordManager, outputDirectory: outputDir).GetTools()); allSyncfusionTools.AddRange(new WordImportExportAgentTools(wordManager).GetTools()); -``` - -**Step 7: Convert Syncfusion Tools to `Microsoft.Extensions.AI` Functions** - -Syncfusion `AITool` objects expose a `MethodInfo` and target instance. Wrap -them with `AIFunctionFactory.Create` so they are recognized by the Microsoft -Agent Framework: - -```csharp -using Microsoft.Extensions.AI; +// Convert Syncfusion tools to Microsoft.Extensions.AI compatible tools var aiTools = allSyncfusionTools .Select(t => AIFunctionFactory.Create( t.Method, @@ -143,17 +92,16 @@ var aiTools = allSyncfusionTools .ToList(); ``` -**Step 8: Build the `AIAgent`** - -Create the agent with a system prompt that defines **two responsibilities**: +## Build Blog Generator Custom AI Agent Workflow -1. Always return **valid JSON** when asked. -2. When asked to build a Word document, strictly follow the - `CreateDocument` → `ImportHtml` → `ExportDocument` tool sequence. +This step builds the custom Blog Generator AI agent, generates blog content and images from a single topic, assembles the content into HTML, and finally converts the HTML into a Word document using Syncfusion Word AI Agent tools-all through a single agent‑driven workflow. ```csharp +// Build the Blog Generator AI agent, generate blog content & images, +// assemble HTML, and convert the HTML blog into a Word document via AI tools. using Microsoft.Agents.AI; +// Build the AI agent with strict JSON output and Word tool execution rules AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( instructions: """ You are an expert technical blogger and document designer. @@ -169,23 +117,12 @@ AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( """, name: "BlogGenerationAgent", tools: aiTools); -``` - -**Step 9: Content Generation Wrapper** - -`BlogGenerationAgent` is a simple wrapper that handles all four(Title & Outline, Layout Planning and HTML Content, Image Prompt) content‑generation phases in one place. -```csharp +// Initialize content and image generation helpers var blogAgent = new BlogGenerationAgent(aiAgent); var imageGenerator = new ImageGenerator(openAiClient, imageModel); -``` - -**Step 10: Generate Blog Sections and Assemble HTML** -After generating the outline, the user reviews and approves it using an interactive [Y/n/r] prompt (Yes / No / Regenerate). -Once approved, the app generates content for each section, creates images when required, and combines everything into a single HTML blog file saved locally. - -```csharp +// Generate blog sections, images (if required), and assemble HTML var blogSections = new List(); for (int idx = 0; idx < sections.Count; idx++) { @@ -210,17 +147,13 @@ for (int idx = 0; idx < sections.Count; idx++) }); } +// Save assembled HTML blog var html = HtmlAssembler.Assemble(outline.Title, blogSections); var filename = HtmlAssembler.DeriveFilename(outline.Title) + ".html"; var filePath = Path.Combine(outputDir, filename); HtmlAssembler.SaveToFile(filePath, html); -``` -**Step 11: Convert the HTML Blog to a Word Document via the AI Agent (Phase 5)** - -This is where the Syncfusion Word Agent Tools handle the document workflow. A single natural‑language prompt allows the agent to automatically invoke the required tools in the correct sequence. - -```csharp +//Convert the HTML blog into a Word document using the AI agent using ChatMessage = Microsoft.Extensions.AI.ChatMessage; using ChatRole = Microsoft.Extensions.AI.ChatRole; @@ -253,19 +186,19 @@ foreach (var message in response.Messages) At runtime, the console application performs the following actions: -1. **Ask blog topic.** Prompt the user to enter a blog topic from the console. +1. **Ask blog topic.** Request the user to enter a blog topic from the console. 2. **Provide the blog title and outline for confirmation.** The agent drafts a title and 6–10 section outline which is displayed for the user to approve, regenerate, or cancel (`[Y/n/r]`). -3. **Draft blog content as HTML.** For each approved section, the agent generates structured HTML content with consistent styling. -4. **Generate images for this blog using the `gpt-image-1.5` model.** For required sections, the AI returns PNG images and embedded as Base64. +3. **Draft blog content as HTML.** For each section, the agent generates structured HTML content with consistent styling. +4. **Generate images for this blog using the `gpt-image-1.5` model.** For the required sections, the AI generates PNG images and embeds the generated images as Base64. 5. **Convert the HTML to Word by using the Syncfusion AI Agent Tools library.** The AI agent autonomously chains `CreateDocument` → `ImportHtml` → `ExportDocument` from `WordDocumentAgentTools` and `WordImportExportAgentTools`. -6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are written to the output folder. +6. **Save both HTML and DOCX files.** The assembled self-contained HTML and the converted Word document are saved to the output folder. ## Complete Startup Code For a complete, runnable example combining all steps, refer to the console application in this repository: -Examples/Console/BlogGenerator/Program.cs +[Examples/Console/BlogGenerator/Program.cs](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main) ## See Also diff --git a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md index 6aa6b008b..87e687337 100644 --- a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md @@ -20,7 +20,7 @@ Documents are held as live objects in an in-memory dictionary. Each tool accesse | Requirement | Details | |---|---| | **.NET SDK** | .NET 8.0 or NET 9.0 or .NET 10.0 | -| **OpenAI API Key** | Obtain from platform.openai.com | +| **OpenAI API Key** | Obtain from [platform.openai.com](https://platform.openai.com) | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI) | >**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. @@ -253,11 +253,12 @@ while (true) For a complete, runnable example combining all steps, refer to the example console application in the GitHub repository: -Examples/Console/AgentChatConsole/Program.cs +[Examples/Console/AgentChatConsole/Program.cs](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main) ## See Also -- [Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) -- [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -- [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) -- [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +- [Overview](./overview) +- [Tools](./tools) +- [Customization](./customization) +- [Example Prompts](./example-prompts) +- [Example Use Cases](./example-use-cases) diff --git a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md index 645709291..86864f52a 100644 --- a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md @@ -22,7 +22,7 @@ Documents are read from and written to storage (Azure Blob, S3, local disk, etc. | Requirement | Details | |---|---| | **.NET SDK** | .NET 8.0 or .NET 9.0 or .NET 10.0 | -| **OpenAI API Key** | Obtain from platform.openai.com | +| **OpenAI API Key** | Obtain from [platform.openai.com](https://platform.openai.com) | | **Azure Storage Account** | Create from [Azure Portal](https://portal.azure.com) with a blob container | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI), and [Azure.Storage.Blobs](https://www.nuget.org/packages/Azure.Storage.Blobs) | @@ -304,12 +304,12 @@ while (true) For a complete web application example with ASP.NET Core, refer to: -Examples/ASP.NET-Core/AgentChatWeb/ +[Examples/ASP.NET-Core/AgentChatWeb/](https://github.com/SyncfusionExamples/DocIO-Examples/tree/main) ## See Also -- Getting Started - In-Memory Mode -- [Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) -- [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -- [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) -- [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +- [Overview](./overview) +- [Tools](./tools) +- [Customization](./customization) +- [Example Prompts](./example-prompts) +- [Example Use Cases](./example-use-cases) diff --git a/Document-Processing/ai-agent-tools/getting-started.md b/Document-Processing/ai-agent-tools/getting-started.md index 1bb7216f9..f393d50b5 100644 --- a/Document-Processing/ai-agent-tools/getting-started.md +++ b/Document-Processing/ai-agent-tools/getting-started.md @@ -65,5 +65,6 @@ For more details, see the [Microsoft Agent Framework Providers documentation](ht - [Available Tools Reference](./tools) - [Customization Guide](./customization) - [Example Prompts](./example-prompts) +- [Example Use Cases](./example-use-cases) - [Syncfusion Document Processing](https://help.syncfusion.com/document-processing) - [Microsoft Agents Framework](https://github.com/microsoft/agents) diff --git a/Document-Processing/ai-agent-tools/overview.md b/Document-Processing/ai-agent-tools/overview.md index be5348c4c..3dd4c4670 100644 --- a/Document-Processing/ai-agent-tools/overview.md +++ b/Document-Processing/ai-agent-tools/overview.md @@ -16,15 +16,81 @@ It exposes a rich set of well-defined tools and functions that an [AI agent](htt ## Key Capabilities -| Product | Supported Functionalities | -|---|---| -| **PDF** | PDF processing with support for digital signing, find text, redactions, watermarking, OCR, and security features encryption, decryption and permission management. It also supports splitting, merging, compressing, reordering pages, converting documents, extracting text and images, and importing and exporting annotations. | -| **Word** | Word document operations with support for bookmarks, form fields, mail merge, find and replace, document merging and splitting, document comparison, import and export operations, security features encryption and protection, track changes, and document conversion to formats like PDF, image, RTF, and HTML. | -| **Excel** | Excel document operations with support for charts, conditional formatting, data validation, pivot tables, document deletion, security features encryption and protection, and conversions to image, HTML, and JSON formats. | -| **PowerPoint**| PowerPoint presentation operations with support for extracting text, retrieving slid find and replace operations, merging and splitting presentations, and applying security features encryption, decryption, and protection. | -| **Office To PDF** | Convert Office documents seamlessly by transforming Excel, Word, and PowerPoint files into PDF format. | -| **Smart Data Extraction** | Extract structured information efficiently by retrieving data, converting tables into JSON, and recognizing forms with JSON-based output. | - +### PDF + +The PDF tools cover the full document life cycle - from creating and loading PDFs to securing, extracting content, and converting formats. Whether you need to merge invoices, redact sensitive data, add digital signatures, or run OCR on scanned pages, these tools handle it autonomously. + +- **Digital Signing** - Digitally sign PDF documents using a PFX certificate with configurable signature bounds and an optional visible appearance image. +- **Redaction** - Permanently redact rectangular regions from PDF pages to remove sensitive content, with configurable fill color. +- **Watermarking** - Apply configurable text watermarks to all pages of a PDF with control over opacity, rotation, color, and positioning. +- **OCR** - Perform Optical Character Recognition on scanned or image-based PDFs to make text selectable and searchable. Supports multiple languages via Tesseract. +- **Encryption & Decryption** - Protect PDFs with password-based encryption using AES or other algorithms, or remove encryption from protected documents. +- **Permissions** - Set or remove document permissions such as print, copy, and edit content on PDF files. +- **Merge & Split** - Merge multiple PDF files into one document, or split a PDF into individual pages or by specified page ranges. +- **Compression** - Compress PDFs by optimizing images, fonts, and page contents, with options to remove metadata. +- **Page Reordering** - Rearrange PDF pages using a zero-based page index sequence. +- **Text & Image Extraction** - Extract text content from specific page ranges or the entire document. Extract and save embedded images from PDF pages. +- **Text Search** - Search a PDF for matching text and get all occurrences grouped by page with bounding rectangle positions. +- **Annotation Import/Export** - Export annotations from a PDF to XFDF, FDF, or JSON format, or import annotations back from those formats. +- **Form Field Import/Export** - Export form field data to FDF, XFDF, or XML format, or import form field data from those formats. +- **PDF/A Conversion** - Convert existing PDFs to PDF/A-compliant formats including PDF/A-1B, PDF/A-2B, PDF/A-3B, and PDF/A-4. +- **Image to PDF** - Create PDF documents from one or more image files with control over image placement and page size. + +### Word + +The Word tools enable end-to-end document automation - from loading and editing Word files to merging, comparing, and converting them. Your agent can populate templates via mail merge, manage bookmarks and form fields, track and resolve changes, and export to multiple formats without manual intervention. + +- **Mail Merge** - Populate Word templates with structured data using simple, group, or nested group mail merge operations driven by JSON input. +- **Bookmarks** - Get, replace, and remove bookmark content from Word documents. You can also list all bookmarks or remove a specific bookmark entirely. +- **Form Fields** - Read and write form field values in Word documents. Retrieve all form data as a dictionary or set multiple field values at once using JSON. +- **Find & Replace** - Find and replace text across a Word document in a single pass. Supports plain text arrays and regex patterns, with options for case sensitivity and whole-word matching. +- **Document Merging and Splitting** - Merge multiple Word documents into one or split a single document by section or placeholder-based rules. +- **Comparison** - Compare an original document with a revised version and mark all differences as tracked changes. +- **Track Changes** - Accept or reject tracked revisions in a Word document, either by a specific author or all at once. +- **Import/Export (HTML, Markdown)** - Import HTML or Markdown content into a Word document, or export document content as HTML, Markdown, or plain text. +- **Conversion to PDF, Image, RTF, and HTML** - Convert Word documents to PDF, export pages as PNG or JPEG images, or save in RTF, HTML, Doc, and TXT formats. +- **Field Management** - Update all document fields (DATE, TIME, IF, SEQ, etc.) or unlink them by replacing each field with its current static result. +- **Table of Contents** - Rebuild the Table of Contents based on current heading styles and page layout. +- **Document Security** - Protect, encrypt, unprotect, and decrypt Word documents with password-based security. +- **Clone** - Create a deep copy of a Word document for duplicating templates before making changes. + +### Excel + +The Excel tools let your agent create and manipulate workbooks programmatically - from setting cell values and formulas to building charts, pivot tables, and conditional formatting rules. They also support workbook security, data validation, and conversion to image, HTML, and JSON formats. + +- **Charts** - Create charts from data ranges, add named series with values and category labels, and configure chart elements like titles, legends, data labels, and axis titles. Supports many chart types, including Column, Line, Pie, and Bar. +- **Conditional Formatting** - Add conditional formatting to cells or ranges using cell value rules, formulas, data bars, color scales, or icon sets with customizable styles. +- **Data Validation** - Add dropdown lists, number, date, time, text length, or custom formula-based validation to cells or ranges with configurable error and prompt messages. +- **Pivot Tables** - Create pivot tables from data ranges with row, column, and data fields. Supports aggregation functions like Sum, Count, Average, Max, and Min, along with built-in styles. +- **Encryption & Protection** - Encrypt and decrypt workbooks with passwords. Protect or unprotect workbook structure and individual worksheets. +- **Worksheet Management** - Create, delete, and manage worksheets within Excel workbooks. +- **Conversion to Image, HTML, and JSON** - Convert worksheets or charts to PNG and JPEG images. Export workbooks or worksheets to HTML with preserved styles, or to JSON with optional schema. Convert specific cell ranges to JSON. +- **Workbook Format Conversion** - Convert workbooks between XLS, XLSX, XLSM, and CSV formats. + +### PowerPoint + +The PowerPoint tools provide essential presentation operations - loading, merging, splitting, and securing PPTX files. Your agent can extract text content, perform find-and-replace across all slides, and export slides as images for downstream processing. + +- **Text Extraction** - Extract all text content from a presentation or get the total slide count. +- **Find & Replace** - Find and replace text across all slides in a presentation. Supports plain text arrays and regex patterns, with options for case sensitivity and whole-word matching. +- **Merge & Split** - Merge multiple presentations into one or split a presentation by sections, layout type, or specific slide numbers. +- **Encryption & Decryption** - Encrypt presentations with a password or remove encryption from protected presentations. +- **Protection** - Write-protect presentations with a password or remove write protection. +- **Export as Image** - Export presentation slides as PNG or JPEG images to a specified output location. + +### Office to PDF + +The Office to PDF tool bridges Word, Excel, and PowerPoint with the PDF format. It produces a high-fidelity PDF output in a single tool call, making it ideal for report generation and document archival workflows. + +- **Office to PDF Conversion** - Convert Word, Excel, or PowerPoint documents to PDF in a single tool call by specifying the source document and its type. + +### Smart Data Extraction + +The data extraction tools used to pull structured information from PDFs and images. They can identify text, tables, form fields, checkboxes, signatures, and radio buttons, returning results as clean JSON for downstream processing. + +- **Structured Data Extraction** - Extract structured data including text, forms, tables, checkboxes, signatures, and radio buttons from PDF or image files and return the result as JSON. +- **Table Extraction** - Extract only table data from PDF documents as JSON, optimized for table-focused extraction with support for borderless tables. +- **Form Recognition** - Extract only form field data from PDF documents as JSON, optimized for form-focused recognition with support for signatures, textboxes, checkboxes, and radio buttons. ## Supported Document Formats @@ -68,12 +134,13 @@ The following functionality required additional NuGet packages in non-Windows pl ## Related Resources -- [Tools](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/tools) -- [Getting Started](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started) -- [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) +- [Tools](./tools) +- [Getting Started](./getting-started) +- [Customization](./customization) - [Syncfusion PDF Library](https://help.syncfusion.com/document-processing/pdf/pdf-library/overview) - [Syncfusion Word Library](https://help.syncfusion.com/document-processing/word/word-library/overview) - [Syncfusion Excel Library](https://help.syncfusion.com/document-processing/excel/excel-library/overview) - [Syncfusion PowerPoint Library](https://help.syncfusion.com/document-processing/powerpoint/powerpoint-library/overview) - [Data Extraction](https://help.syncfusion.com/document-processing/data-extraction/overview) -- [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +- [Example Prompts](./example-prompts) +- [Example Use Cases](./example-use-cases) diff --git a/Document-Processing/ai-agent-tools/tools.md b/Document-Processing/ai-agent-tools/tools.md index 7bb89e77a..16c82a204 100644 --- a/Document-Processing/ai-agent-tools/tools.md +++ b/Document-Processing/ai-agent-tools/tools.md @@ -20,14 +20,14 @@ The operational mode is determined by the manager used when initializing the too Tools are organized into the following categories: -| Category | Tool Classes | Description | -|---|---|---| -| **PDF** | PdfDocumentAgentTools,
    PdfOperationsAgentTools,
    PdfSecurityAgentTools,
    PdfContentExtractionAgentTools,
    PdfAnnotationAgentTools,
    PdfConverterAgentTools,
    PdfOcrAgentTools | Create, manipulate, secure, extract content from, annotate, convert, and perform OCR on PDF documents. | -| **Word** | WordDocumentAgentTools,
    WordOperationsAgentTools,
    WordSecurityAgentTools,
    WordMailMergeAgentTools,
    WordFindAndReplaceAgentTools,
    WordRevisionAgentTools,
    WordImportExportAgentTools,
    WordFormFieldAgentTools,
    WordBookmarkAgentTools | Create, edit, protect, mail-merge, find/replace, track changes, import/export, and manage form fields and bookmarks in Word documents. | -| **Excel** | ExcelWorkbookAgentTools,
    ExcelWorksheetAgentTools,
    ExcelSecurityAgentTools,
    ExcelFormulaAgentTools,
    ExcelChartAgentTools,
    ExcelConditionalFormattingAgentTools,
    ExcelConversionAgentTools,
    ExcelDataValidationAgentTools,
    ExcelPivotTableAgentTools | Create and manage workbooks and worksheets, set cell values, formulas, and number formats, apply security, create and configure charts and sparklines, add conditional formatting, convert to image/HTML/ODS/JSON, manage data validation, and create and manipulate pivot tables. | -| **PowerPoint** | PresentationDocumentAgentTools,
    PresentationOperationsAgentTools,
    PresentationSecurityAgentTools,
    PresentationContentAgentTools,
    PresentationFindAndReplaceAgentTools | Load, merge, split, secure, and extract content from PowerPoint presentations. | +| Category | Tool Classes | +|---|---| +| **PDF** | PdfDocumentAgentTools,
    PdfOperationsAgentTools,
    PdfSecurityAgentTools,
    PdfContentExtractionAgentTools,
    PdfAnnotationAgentTools,
    PdfConverterAgentTools,
    PdfOcrAgentTools | +| **Word** | WordDocumentAgentTools,
    WordOperationsAgentTools,
    WordSecurityAgentTools,
    WordMailMergeAgentTools,
    WordFindAndReplaceAgentTools,
    WordRevisionAgentTools,
    WordImportExportAgentTools,
    WordFormFieldAgentTools,
    WordBookmarkAgentTools | +| **Excel** | ExcelWorkbookAgentTools,
    ExcelWorksheetAgentTools,
    ExcelSecurityAgentTools,
    ExcelFormulaAgentTools,
    ExcelChartAgentTools,
    ExcelConditionalFormattingAgentTools,
    ExcelConversionAgentTools,
    ExcelDataValidationAgentTools,
    ExcelPivotTableAgentTools | +| **PowerPoint** | PresentationDocumentAgentTools,
    PresentationOperationsAgentTools,
    PresentationSecurityAgentTools,
    PresentationContentAgentTools,
    PresentationFindAndReplaceAgentTools | | **Conversion** | OfficeToPdfAgentTools | Convert Word, Excel, and PowerPoint documents to PDF. | -| **Data Extraction** | DataExtractionAgentTools | Extract structured data (text, tables, forms) from PDF and image files as JSON. | +| **Data Extraction** | DataExtractionAgentTools | ## Document Managers @@ -443,7 +443,8 @@ Provides AI-powered structured data extraction from PDF documents and images, re ## See Also -- [Overview](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/overview) -- [Getting Started](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/getting-started) -- [Customization](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/customization) -- [Example Prompts](https://helpstaging.syncfusion.com/document-processing/ai-agent-tools/example-prompts) +- [Overview](./overview) +- [Getting Started](./getting-started) +- [Customization](./customization) +- [Example Prompts](./example-prompts) +- [Example Use Cases](example-use-cases) From 5e4d1a9a7e416199c843611e3d8c380bb0d55563 Mon Sep 17 00:00:00 2001 From: AtchayaSekar28 Date: Thu, 30 Apr 2026 16:48:55 +0530 Subject: [PATCH 11/11] Resolved the CI Failures --- Document-Processing-toc.html | 2 +- .../ai-agent-tools/example-use-cases.md | 16 ++++------------ .../getting-started-in-memory-mode.md | 2 +- .../getting-started-storage-mode.md | 2 +- Document-Processing/ai-agent-tools/overview.md | 2 +- 5 files changed, 8 insertions(+), 16 deletions(-) diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 40ba6127a..cf5d58b29 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -51,7 +51,7 @@ Example Prompts
  • - Example Use Cases + Example Use Cases
  • diff --git a/Document-Processing/ai-agent-tools/example-use-cases.md b/Document-Processing/ai-agent-tools/example-use-cases.md index 584bc78c9..1354fcab9 100644 --- a/Document-Processing/ai-agent-tools/example-use-cases.md +++ b/Document-Processing/ai-agent-tools/example-use-cases.md @@ -47,6 +47,10 @@ Integrating the Blog Generator agent into a console application involves the fol using Syncfusion.AI.AgentTools.Core; using Syncfusion.AI.AgentTools.Word; using Microsoft.Extensions.AI; +using Microsoft.Agents.AI; +using AITool = Syncfusion.AI.AgentTools.Core.AITool; +using ChatMessage = Microsoft.Extensions.AI.ChatMessage; +using ChatRole = Microsoft.Extensions.AI.ChatRole; // Register Syncfusion license string? licenseKey = Environment.GetEnvironmentVariable("SYNCFUSION_LICENSE_KEY"); @@ -68,10 +72,6 @@ var chatClient = openAiClient.GetChatClient(textModel); // Create Word Document Manager (in-memory with timeout) var wordManager = new WordDocumentManager(TimeSpan.FromMinutes(10)); - -// Instantiate Syncfusion Word AI Agent tools -using AITool = Syncfusion.AI.AgentTools.Core.AITool; - var outputDir = Path.GetFullPath(Environment.CurrentDirectory + @"..\..\..\..\Data\Output\"); var allSyncfusionTools = new List(); @@ -97,10 +97,6 @@ var aiTools = allSyncfusionTools This step builds the custom Blog Generator AI agent, generates blog content and images from a single topic, assembles the content into HTML, and finally converts the HTML into a Word document using Syncfusion Word AI Agent tools-all through a single agent‑driven workflow. ```csharp -// Build the Blog Generator AI agent, generate blog content & images, -// assemble HTML, and convert the HTML blog into a Word document via AI tools. -using Microsoft.Agents.AI; - // Build the AI agent with strict JSON output and Word tool execution rules AIAgent aiAgent = chatClient.AsIChatClient().AsAIAgent( instructions: """ @@ -153,10 +149,6 @@ var filename = HtmlAssembler.DeriveFilename(outline.Title) + ".html"; var filePath = Path.Combine(outputDir, filename); HtmlAssembler.SaveToFile(filePath, html); -//Convert the HTML blog into a Word document using the AI agent -using ChatMessage = Microsoft.Extensions.AI.ChatMessage; -using ChatRole = Microsoft.Extensions.AI.ChatRole; - var wordFilePath = Path.Combine(outputDir, HtmlAssembler.DeriveFilename(outline.Title) + ".docx"); diff --git a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md index 87e687337..2afd320f8 100644 --- a/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-in-memory-mode.md @@ -20,7 +20,7 @@ Documents are held as live objects in an in-memory dictionary. Each tool accesse | Requirement | Details | |---|---| | **.NET SDK** | .NET 8.0 or NET 9.0 or .NET 10.0 | -| **OpenAI API Key** | Obtain from [platform.openai.com](https://platform.openai.com) | +| **OpenAI API Key** | Obtain from platform.openai.com | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI) | >**Note:** The OpenAI API key is mandatory for this sample because the guide demonstrates the integration using the **Microsoft Agents Framework with OpenAI**. The same integration steps work with any other [provider](https://learn.microsoft.com/en-us/agent-framework/agents/providers/?pivots=programming-language-csharp) (Azure OpenAI, Anthropic, Google Gemini, Ollama, etc.) — just swap in that provider’s API key or endpoint credentials. diff --git a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md index 86864f52a..22326c2d0 100644 --- a/Document-Processing/ai-agent-tools/getting-started-storage-mode.md +++ b/Document-Processing/ai-agent-tools/getting-started-storage-mode.md @@ -22,7 +22,7 @@ Documents are read from and written to storage (Azure Blob, S3, local disk, etc. | Requirement | Details | |---|---| | **.NET SDK** | .NET 8.0 or .NET 9.0 or .NET 10.0 | -| **OpenAI API Key** | Obtain from [platform.openai.com](https://platform.openai.com) | +| **OpenAI API Key** | Obtain from platform.openai.com | | **Azure Storage Account** | Create from [Azure Portal](https://portal.azure.com) with a blob container | | **NuGet Packages** | [Microsoft.Agents.AI.OpenAI](https://www.nuget.org/packages/Microsoft.Agents.AI.OpenAI), and [Azure.Storage.Blobs](https://www.nuget.org/packages/Azure.Storage.Blobs) | diff --git a/Document-Processing/ai-agent-tools/overview.md b/Document-Processing/ai-agent-tools/overview.md index 3dd4c4670..c9bd2ad50 100644 --- a/Document-Processing/ai-agent-tools/overview.md +++ b/Document-Processing/ai-agent-tools/overview.md @@ -89,7 +89,7 @@ The Office to PDF tool bridges Word, Excel, and PowerPoint with the PDF format. The data extraction tools used to pull structured information from PDFs and images. They can identify text, tables, form fields, checkboxes, signatures, and radio buttons, returning results as clean JSON for downstream processing. - **Structured Data Extraction** - Extract structured data including text, forms, tables, checkboxes, signatures, and radio buttons from PDF or image files and return the result as JSON. -- **Table Extraction** - Extract only table data from PDF documents as JSON, optimized for table-focused extraction with support for borderless tables. +- **Table Extraction** - Extract only table data from PDF documents as JSON, optimized for table-focused extraction with support for border less tables. - **Form Recognition** - Extract only form field data from PDF documents as JSON, optimized for form-focused recognition with support for signatures, textboxes, checkboxes, and radio buttons. ## Supported Document Formats