A2a messages parts

From OrcaQubits/agentic-commerce-skills-plugins · View interactive version

A2a messages parts is an AI agent skill from the GitHub repository OrcaQubits/agentic-commerce-skills-plugins. Implement A2A messages and parts — TextPart, FilePart, DataPart, message roles, metadata, and content negotiation. Use when building message construction, parsing, or content type handling in A2A agents.

How to use this skill

Skill file

A2A Messages and Parts

Before writing code

Fetch live docs:

  1. Fetch https://a2a-protocol.org/latest/specification/ for the Message and Part schemas
  2. Web-search site:github.com a2aproject A2A message parts TextPart FilePart DataPart for schema details
  3. Web-search site:github.com a2aproject a2a-samples message for message construction examples
  4. Fetch SDK docs for message builder classes and part types

Conceptual Architecture

What Messages Are

Messages are the communication units between agents in A2A. Each message belongs to a task and contains one or more Parts that carry the actual content. Messages have roles indicating direction.

Message Structure

Three Part Types

TextPart

Plain text or markdown content.

Use for: Natural language instructions, responses, explanations, formatted output.

FilePart

File content, either inline or by reference.

Use for: Images, documents, code files, generated files, binary data.

DataPart

Structured JSON data.

Use for: Structured results, API responses, configuration, machine-readable output.

Content Negotiation

Agents declare supported MIME types in their Agent Card:

Clients can specify preferred output modes in the request:

If there's a mismatch, the server returns error -32005 (incompatible content types).

Message Flow in a Task

Client message (role: user)    → Server creates/continues task
Server response (role: agent)  → Client processes result
Client follow-up (role: user)  → Server continues task (multi-turn)
Server final (role: agent)     → Task reaches terminal state

Composing Rich Messages

Messages can contain multiple parts of mixed types:

{
  "role": "user",
  "parts": [
    { "kind": "text", "text": "Analyze this image and provide structured results" },
    { "kind": "file", "file": { "uri": "https://example.com/chart.png", "mimeType": "image/png" } }
  ]
}

Best Practices

Fetch the specification for exact Part schemas, all fields, metadata conventions, and content type handling rules before implementing.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.