Index of every page on this site: llms.txt
All skills
ag-ui-protocol avatar

/agui-dotnet-multimodal

@c31e1e8
by ag-ui-protocolag-ui-protocol/ag-ui21k stars
2,167
Run it yourself

Send images and other binary/file content to an AG-UI agent with the AG-UI .NET SDK — attach pictures (or audio, PDFs, etc.) to a user message so a multimodal model can see them. USE FOR: building a user ChatMessage with mixed content parts (TextContent plus DataContent for inline bytes, or UriContent for a hosted URL); choosing inline bytes vs a URL reference; setting the correct media type; sending the message through AGUIChatClient so the content parts cross the AG-UI wire to a vision/multimodal model. DO NOT USE FOR: plain text chat (use agui-dotnet-streaming-chat); tool calls (use agui-dotnet-server-tools / agui-dotnet-client-tools); structured shared state (use agui-dotnet-shared-state); reasoning traces, interrupts, generative UI, or protobuf.

Use this Skill: https://skilld.dev/gh/ag-ui-protocol/ag-ui/agui-dotnet-multimodal

Nothing lands on disk. Nothing to clean up.

Fork this Skill

Edit a local copy. It keeps the author and licence.

SKILL.md

≈197 tokens for metadata: the name and description. ≈615 when used: this file.

Description uses 9.8% of example budget

Before choosing a Skill, your Agent reads its name and description. All available Skills share that space.

  • A shorter description leaves more room for other Skills. This entry exceeds our 1% size suggestion.

In our Claude Code example, all Skill names and descriptions share 8,000 characters. This Skill uses ≈785 characters, or 9.8%.

The 1% threshold is a size suggestion. Longer descriptions can still fit.

Your model, settings, and other Skills decide how much text your Agent can read.

Example settings and source

The example uses a 200k-token context and default Claude Code settings. The count includes the name, description, separators, and when_to_use when present. Codex also counts local file paths.

Skit's source and limits: Codex 0.160.1, Claude Code 2.1.292.

AG-UI .NET — multimodal messages

Goal: include an image (or other binary content) in a turn so a multimodal model can describe or reason about it.

A multimodal message is an ordinary Microsoft.Extensions.AI ChatMessage whose Contents mixes a TextContent with one or more binary parts. AGUIChatClient carries those parts across the AG-UI wire; the server streams the model's reply as usual.

Install

dotnet add package AGUI.Client

Microsoft.Extensions.AI supplies ChatMessage, TextContent, DataContent, and UriContent.

Attach inline bytes

Use DataContent(bytes, mediaType) to embed the data directly in the message:

using AGUI.Client;
using Microsoft.Extensions.AI;

byte[] imageBytes = await File.ReadAllBytesAsync("photo.png");

var messages = new List<ChatMessage>
{
    new(ChatRole.User,
    [
        new TextContent("Describe this image"),
        new DataContent(imageBytes, "image/png"),
    ]),
};

await foreach (var update in client.GetStreamingResponseAsync(messages))
{
    Console.Write(update.Text);
}

The media type must match the bytes (image/png, image/jpeg, audio/wav, application/pdf, …) so the model decodes them correctly.

Reference a hosted URL

When the asset already lives at a URL, use UriContent(uri, mediaType) instead — the bytes never pass through your process:

new ChatMessage(ChatRole.User,
[
    new TextContent("What's in this picture?"),
    new UriContent("https://example.com/cat.jpg", "image/jpeg"),
]);

Prefer UriContent to reference an asset already hosted at a URL; use DataContent for local bytes the model host can't reach by URL.

Anti-patterns

  • Sending a large asset as inline DataContent. Inline binary is base64-encoded into the request, inflating it ~33% and forcing the whole payload through memory on both ends. For anything sizable that is reachable by URL, send UriContent and let the model host fetch it.
  • Targeting a model that isn't multimodal. The content parts cross the wire fine, but a text-only deployment ignores or rejects the image. Point the server's IChatClient at a vision-capable model/deployment.

Verify

  1. The assistant's streamed reply describes the actual image content (not a generic "I can't see images" message).
  2. The request carries the binary part: the user message on the wire has both a text part and an image/data part with the media type you set.

Source: SKILL.md on GitHub

skilld matched fixed text patterns in SKILL.md and file names. Patterns miss obfuscated code.

skilld run checks every file with the same patterns. It asks for approval before it loads a Skill with a behavior marked Needs approval.

1 warning4mo3 checks · Risk SAFE
  • Gen Agent Trust Hub4mo

    This skill provides technical documentation and code examples for using the AG-UI .NET SDK to handle multimodal messages, such as images and PDFs. It contains standard installation instructions and API usage patterns for managing local and remote binary content.

  • Socket4mo

    1 alert: gptAnomaly

  • Snyk4mo

    Risk: LOW · No issues

Signed by skilld at c31e1e8. This ties the file your Agent reads to that commit on GitHub. It does not review the instructions.

Last checked against GitHub 2 days ago.

Activeupdated 5 months ago

README badge

README badge for ag-ui-protocol/ag-ui/agui-dotnet-multimodal