microsoft / microsoft/Agents

Activity Protocol Schema v5 Complete Example Set

Open
#482 0 comments 0 reactions 1 assignee View on GitHub

@gurubhg is already working on this.

Since Mar 17, 2026.

Discussion Specs
Dominant language
TypeSpec
Stars
1.1k
Forks
340
Avg merge
3d 13h
Merged PRs (30d)
12

Description

Activity Protocol v5 — Complete Example Set (§19)

Parent issue: #472 — Activity Protocol Schema v5 Proposal
Section: §19 Complete Example Set

This sub-issue contains all 28 examples demonstrating v5 activity types, streaming, session lifecycle, cross-protocol interop, and entity usage.


19.1 Text message
{
  "v": "5",
  "type": "message",
  "id": "msg-001",
  "timestamp": "2026-04-01T10:00:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "payload": { "contentType": "text/markdown", "content": "Hello, world!" }
}
19.2 Reply (text)
{
  "v": "5",
  "type": "message",
  "id": "msg-002",
  "timestamp": "2026-04-01T10:00:02Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "relatesTo": { "inReplyTo": { "activityId": "msg-001" } },
  "payload": { "contentType": "text/plain", "content": "Hi Alice — how can I help?" }
}
19.3 Tool command
{
  "v": "5",
  "type": "command",
  "id": "cmd-001",
  "timestamp": "2026-04-01T10:20:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "tool.weather", "name": "WeatherTool", "role": "tool" }],
  "name": "weather.getForecast",
  "payload": { "contentType": "application/json", "content": { "location": "London" } }
}
19.4 Tool result — success
{
  "v": "5",
  "type": "commandResult",
  "id": "cmdres-001",
  "timestamp": "2026-04-01T10:20:01Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "tool.weather", "name": "WeatherTool", "role": "tool" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "name": "weather.getForecast",
  "relatesTo": { "inReplyTo": { "activityId": "cmd-001" } },
  "payload": {
    "contentType": "application/json",
    "content": { "ok": true, "result": { "temperatureC": 15, "condition": "Cloudy" } }
  }
}
19.5 Tool result — error
{
  "v": "5",
  "type": "commandResult",
  "id": "cmdres-002",
  "timestamp": "2026-04-01T10:20:01Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "tool.weather", "name": "WeatherTool", "role": "tool" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "name": "weather.getForecast",
  "relatesTo": { "inReplyTo": { "activityId": "cmd-001" } },
  "payload": {
    "contentType": "application/json",
    "content": {
      "ok": false,
      "error": { "code": "InvalidArgument", "httpStatus": 400, "message": "location is required" }
    }
  }
}
19.6 Streaming: Media.Start
{
  "v": "5",
  "type": "event",
  "id": "evt-001",
  "timestamp": "2026-04-01T10:10:00Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "name": "Media.Start",
  "relatesTo": { "stream": { "streamId": "stream-1", "seq": 1, "isFinal": false } },
  "payload": {
    "contentType": "application/vnd.microsoft.activity.media.start+json",
    "content": { "mediaType": "audio", "contentType": "audio/webm", "codec": "opus" }
  },
  "entities": [
    {
      "type": "streamInfo",
      "streamId": "stream-1",
      "streamType": "audio",
      "streamState": "Streaming",
      "streamSequence": 1
    }
  ]
}
19.7 Streaming: Media.Chunk
{
  "v": "5",
  "type": "event",
  "id": "evt-002",
  "timestamp": "2026-04-01T10:10:01Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "name": "Media.Chunk",
  "relatesTo": { "stream": { "streamId": "stream-1", "seq": 2, "isFinal": false } },
  "payload": { "contentType": "audio/webm", "contentUrl": "data:audio/webm;base64,..." },
  "entities": [
    {
      "type": "streamInfo",
      "streamId": "stream-1",
      "streamType": "audio",
      "streamState": "Streaming",
      "streamSequence": 2
    }
  ]
}
19.8 Streaming: Media.End
{
  "v": "5",
  "type": "event",
  "id": "evt-003",
  "timestamp": "2026-04-01T10:10:05Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "name": "Media.End",
  "relatesTo": { "stream": { "streamId": "stream-1", "seq": 3, "isFinal": true } },
  "payload": { "contentType": "application/vnd.microsoft.activity.media.end+json", "content": {} },
  "entities": [
    {
      "type": "streamInfo",
      "streamId": "stream-1",
      "streamType": "audio",
      "streamState": "Final",
      "streamSequence": 3
    }
  ]
}
19.9 Multi-part message (text + image)
{
  "v": "5",
  "type": "message",
  "id": "msg-multi-001",
  "timestamp": "2026-04-01T11:00:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "payload": {
    "contentType": "multipart/mixed",
    "content": "Here's the weather forecast with a chart:",
    "items": [
      {
        "kind": "text",
        "contentType": "text/markdown",
        "content": "**London forecast:** 15°C, Cloudy with a chance of rain in the afternoon."
      },
      {
        "kind": "image",
        "contentType": "image/png",
        "contentUrl": "https://example.com/charts/london-forecast.png",
        "name": "london-forecast.png",
        "thumbnailUrl": "https://example.com/charts/london-forecast-thumb.png"
      }
    ]
  }
}
19.10 Image message
{
  "v": "5",
  "type": "message",
  "id": "img-001",
  "timestamp": "2026-04-01T10:02:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "payload": {
    "contentType": "image/png",
    "contentUrl": "https://example.com/images/photo.png",
    "name": "photo.png"
  }
}
19.11 Voice message (non-streaming)
{
  "v": "5",
  "type": "message",
  "id": "voice-001",
  "timestamp": "2026-04-01T10:03:00Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "payload": {
    "contentType": "application/vnd.microsoft.activity.voice+json",
    "content": {
      "contentType": "audio/webm",
      "contentUrl": "https://example.com/audio/utterance.webm",
      "transcription": "Book a flight to Paris",
      "locale": "en-US"
    }
  }
}
19.12 Adaptive Card message
{
  "v": "5",
  "type": "message",
  "id": "card-001",
  "timestamp": "2026-04-01T10:06:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "payload": {
    "contentType": "application/vnd.microsoft.card.adaptive",
    "content": {
      "type": "AdaptiveCard",
      "version": "1.5",
      "body": [
        { "type": "TextBlock", "text": "Hello from v5", "wrap": true }
      ]
    }
  }
}
19.13 Message update
{
  "v": "5",
  "type": "message",
  "id": "msg-003",
  "timestamp": "2026-04-01T10:45:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "relatesTo": { "replaces": { "activityId": "msg-001" } },
  "payload": { "contentType": "text/markdown", "content": "Hello, world! (edited)" }
}
19.14 Message delete
{
  "v": "5",
  "type": "event",
  "id": "del-001",
  "timestamp": "2026-04-01T10:46:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "name": "message.delete",
  "relatesTo": { "tombstones": { "activityId": "msg-001" } }
}
19.15 Conversation update
{
  "v": "5",
  "type": "event",
  "id": "evt-conv-002",
  "timestamp": "2026-04-01T10:50:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "channel", "role": "channel" },
  "name": "conversation.update",
  "payload": {
    "contentType": "application/vnd.microsoft.activity.conversation.update+json",
    "content": {
      "membersAdded": [{ "id": "agent-789", "name": "HelperAgent", "role": "agent" }],
      "membersRemoved": []
    }
  }
}
19.16 Typing event
{
  "v": "5",
  "type": "event",
  "id": "evt-typing-001",
  "timestamp": "2026-04-01T10:01:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "name": "typing"
}
19.17 Message reaction
{
  "v": "5",
  "type": "event",
  "id": "evt-react-002",
  "timestamp": "2026-04-01T10:55:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "name": "message.reaction",
  "relatesTo": { "reactsTo": { "activityId": "msg-002" } },
  "payload": {
    "contentType": "application/vnd.microsoft.activity.reaction+json",
    "content": {
      "reactionsAdded": [{ "type": "+1" }],
      "reactionsRemoved": []
    }
  }
}
19.18 Context sharing (entities)
{
  "v": "5",
  "type": "message",
  "id": "ctx-001",
  "timestamp": "2026-04-01T10:30:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "payload": { "contentType": "text/plain", "content": "Can you explain what I'm seeing on screen?" },
  "entities": [
    {
      "type": "context",
      "screenContext": {
        "surroundingText": "def hello(): print('Hello')",
        "images": ["iVBORw0KGgoAAAANSUhEUgAAAAUA...", "https://example.com/screenshot.png"]
      }
    }
  ]
}
19.19 Delegation + delivery hints (entities)
{
  "v": "5",
  "type": "command",
  "id": "cmd-002",
  "timestamp": "2026-04-01T10:40:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "child-agent", "name": "ChildAgent", "role": "agent" },
  "to": [{ "id": "tool.calendar", "name": "CalendarTool", "role": "tool" }],
  "name": "calendar.createEvent",
  "payload": { "contentType": "application/json", "content": { "title": "Sync", "startUtc": "2026-04-02T16:00:00Z" } },
  "entities": [
    {
      "type": "security",
      "actor": { "id": "user-123", "role": "user" },
      "caller": { "id": "parent-agent", "role": "agent", "appId": "..." },
      "delegationChain": [
        { "id": "parent-agent", "proof": { "type": "jwt", "token": "..." } },
        { "id": "child-agent", "proof": { "type": "jwt", "token": "..." } }
      ],
      "scopes": ["tool.calendar.write.limited"],
      "attenuations": [{ "by": "child-agent", "removedScopes": ["tool.calendar.write.full"] }]
    },
    {
      "type": "delivery",
      "durable": true,
      "ttlMs": 600000,
      "idempotencyKey": "user-123:conv-abc:calendar.createEvent:42"
    }
  ]
}
19.20 Capability negotiation (first activity in conversation)
{
  "v": "5",
  "type": "message",
  "id": "msg-hello-001",
  "timestamp": "2026-04-01T09:59:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "payload": { "contentType": "text/plain", "content": "Welcome! How can I help you today?" },
  "entities": [
    {
      "type": "capabilities",
      "supportedContentTypes": ["text/plain", "text/markdown", "application/vnd.microsoft.card.adaptive", "image/png", "audio/webm"],
      "supportedStreamTypes": ["audio", "text"],
      "supportedCommands": ["weather.getForecast", "calendar.createEvent"],
      "supportedEventNames": ["Media.*", "typing", "conversation.update"],
      "protocolVersions": ["5", "3.4"],
      "extensions": {}
    }
  ]
}
19.21 Session lifecycle (voice call)
Session Init
{
  "v": "5",
  "type": "command",
  "id": "cmd-sess-001",
  "timestamp": "2026-04-01T12:00:00Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-voice-001" },
  "from": { "id": "user-123", "role": "user" },
  "to": [{ "id": "agent-456", "role": "agent" }],
  "name": "session.init",
  "payload": {
    "contentType": "application/vnd.microsoft.activity.session.init+json",
    "content": { "sessionId": "sess_456" }
  }
}
Session Init Result
{
  "v": "5",
  "type": "commandResult",
  "id": "cmdres-sess-001",
  "timestamp": "2026-04-01T12:00:01Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-voice-001" },
  "from": { "id": "agent-456", "role": "agent" },
  "to": [{ "id": "user-123", "role": "user" }],
  "name": "session.init",
  "relatesTo": { "inReplyTo": { "activityId": "cmd-sess-001" } },
  "payload": {
    "contentType": "application/json",
    "content": { "ok": true, "result": { "sessionId": "sess_456", "capabilities": ["audio", "text"] } }
  }
}
Session Update (Barge-In)
{
  "v": "5",
  "type": "command",
  "id": "cmd-sess-002",
  "timestamp": "2026-04-01T12:01:00Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-voice-001" },
  "from": { "id": "user-123", "role": "user" },
  "to": [{ "id": "agent-456", "role": "agent" }],
  "name": "session.update",
  "payload": {
    "contentType": "application/vnd.microsoft.activity.session.update+json",
    "content": { "signal": "bargeIn", "origin": "user" }
  }
}
Session End
{
  "v": "5",
  "type": "command",
  "id": "cmd-sess-003",
  "timestamp": "2026-04-01T12:05:00Z",
  "channelId": "voicechannel",
  "conversation": { "id": "conv-voice-001" },
  "from": { "id": "agent-456", "role": "agent" },
  "to": [{ "id": "user-123", "role": "user" }],
  "name": "session.end",
  "payload": {
    "contentType": "application/vnd.microsoft.activity.session.end+json",
    "content": { "reason": "completed" }
  }
}
19.22 Trace activity
{
  "v": "5",
  "type": "trace",
  "id": "trace-001",
  "timestamp": "2026-04-01T12:05:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "name": "agent.debug.reasoning",
  "relatesTo": {
    "inReplyTo": { "activityId": "msg-001" },
    "trace": { "traceId": "abc123def456", "spanId": "span-001" }
  },
  "payload": {
    "contentType": "application/json",
    "content": {
      "step": "intent_classification",
      "result": "greeting",
      "confidence": 0.97,
      "durationMs": 42
    }
  }
}
19.23 End of conversation
{
  "v": "5",
  "type": "event",
  "id": "evt-end-001",
  "timestamp": "2026-04-01T13:00:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "name": "conversation.end",
  "payload": {
    "contentType": "application/json",
    "content": { "code": "completedSuccessfully" }
  }
}
19.24 MCP-compatible tool call (cross-protocol example)

This example shows how an MCP tool call maps to a v5 command, demonstrating the complementary relationship described in §5.2:

{
  "v": "5",
  "type": "command",
  "id": "cmd-mcp-001",
  "timestamp": "2026-04-01T14:00:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "mcp-server.filesystem", "name": "FileSystemServer", "role": "tool" }],
  "name": "readFile",
  "payload": {
    "contentType": "application/json",
    "content": { "path": "/home/user/document.txt" }
  }
}
19.25 A2A-compatible task delegation (cross-protocol example)

This example shows how an A2A task message maps to a v5 command with delegation, demonstrating the complementary relationship described in §5.3:

{
  "v": "5",
  "type": "command",
  "id": "cmd-a2a-001",
  "timestamp": "2026-04-01T15:00:00Z",
  "channelId": "a2a-gateway",
  "conversation": { "id": "task-onboarding-001" },
  "from": { "id": "hr-agent", "name": "HRAgent", "role": "agent" },
  "to": [{ "id": "payroll-agent", "name": "PayrollAgent", "role": "agent" }],
  "name": "payroll.createOnboarding",
  "payload": {
    "contentType": "application/json",
    "content": {
      "employeeId": "emp-789",
      "startDate": "2026-05-01",
      "department": "Engineering"
    }
  },
  "entities": [
    {
      "type": "security",
      "actor": { "id": "hr-manager-001", "role": "user" },
      "caller": { "id": "hr-agent", "role": "agent", "appId": "hr-app-id" },
      "delegationChain": [
        { "id": "hr-agent", "proof": { "type": "jwt", "token": "..." } }
      ],
      "scopes": ["payroll.onboarding.create"]
    }
  ]
}
19.26 Suggested actions
{
  "v": "5",
  "type": "message",
  "id": "msg-suggest-001",
  "timestamp": "2026-04-01T11:10:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "payload": {
    "contentType": "multipart/mixed",
    "content": "Would you like to continue?",
    "items": [
      {
        "kind": "text",
        "contentType": "text/plain",
        "content": "Would you like to continue?"
      },
      {
        "kind": "json",
        "contentType": "application/vnd.microsoft.activity.suggestedActions+json",
        "content": {
          "actions": [
            { "type": "imBack", "title": "Yes", "value": "yes" },
            { "type": "imBack", "title": "No", "value": "no" }
          ]
        }
      }
    ]
  }
}
19.27 Locale entity usage
{
  "v": "5",
  "type": "message",
  "id": "msg-locale-001",
  "timestamp": "2026-04-01T16:00:00Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "user-123", "name": "Alice", "role": "user" },
  "to": [{ "id": "agent-456", "name": "Agent", "role": "agent" }],
  "payload": { "contentType": "text/plain", "content": "Quel temps fait-il à Paris?" },
  "entities": [
    { "type": "locale", "language": "fr-FR", "timezone": "Europe/Paris" }
  ]
}
19.28 Causation chain (tool call triggering follow-up to user)

This example demonstrates relatesTo.causedBy (V50149). The agent receives a tool result and sends a follow-up message to the user. The message is caused by the tool result but is not a reply to it:

{
  "v": "5",
  "type": "message",
  "id": "msg-followup-001",
  "timestamp": "2026-04-01T10:20:05Z",
  "channelId": "webchat",
  "conversation": { "id": "conv-abc" },
  "from": { "id": "agent-456", "name": "Agent", "role": "agent" },
  "to": [{ "id": "user-123", "name": "Alice", "role": "user" }],
  "relatesTo": {
    "inReplyTo": { "activityId": "msg-001" },
    "causedBy": { "activityId": "cmdres-001" }
  },
  "payload": {
    "contentType": "text/markdown",
    "content": "The weather in London is **15°C and Cloudy**. Would you like more details?"
  }
}

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.