Skip to content

Sample : a2a-in-teams#401

Merged
MehakBindra merged 19 commits into
mainfrom
mehak/a2a-new
Apr 25, 2026
Merged

Sample : a2a-in-teams#401
MehakBindra merged 19 commits into
mainfrom
mehak/a2a-new

Conversation

@MehakBindra

Copy link
Copy Markdown
Member

This pull request introduces a new example in examples/a2a-test demonstrating two symmetric Microsoft Teams bots (Alice and Bob) that relay questions and answers using the official a2a-sdk and Adaptive Cards. The implementation is modularized into clear components for A2A communication, card construction, bot logic, and state management. The README and dependencies are updated to reflect the new architecture and usage.

The most important changes are:

New A2A Example Architecture and Implementation

  • Added a comprehensive example with two Teams bots (bot_a.py and bot_b.py) that can relay questions to each other over A2A, using Adaptive Cards for human-in-the-loop answers. Each bot can both send and receive questions, and route replies back to the original asker. [1] [2]

A2A Communication Layer

  • Introduced a2a_client.py for outbound A2A message sending, which resolves the peer’s agent card and sends a single message using the a2a-sdk.
  • Added a2a_executor.py implementing an AgentExecutor that routes incoming A2A ask and reply messages to the appropriate Teams conversation, updating bot state as needed.
  • Added a2a_server.py to wrap the executor in an A2AStarletteApplication for serving A2A requests.

Adaptive Card Construction

  • Added cards.py with builder functions for the "ask" and "reply" Adaptive Cards, embedding routing metadata so no per-question state is needed on the receiving bot.

Documentation and Dependency Updates

  • Overhauled README.md to document the new flow, file structure, operator requirements, and setup instructions.
  • Updated pyproject.toml to reflect new dependencies (a2a-sdk, uvicorn, httpx, etc.) and renamed the package for clarity.

Copilot AI review requested due to automatic review settings April 23, 2026 00:52
@MehakBindra MehakBindra changed the title a2a-in-teams Sample : a2a-in-teams Apr 23, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new examples/a2a-test sample that demonstrates two symmetric Microsoft Teams bots (Alice/Bob) exchanging “ask” and “reply” messages over A2A, using Adaptive Cards for human-in-the-loop responses.

Changes:

  • Introduces modular A2A components (a2a_client, a2a_executor, a2a_server) plus shared Adaptive Card builders and a small in-memory bot state object.
  • Adds two runnable bot entrypoints (bot_a.py, bot_b.py) that can both send “ask” requests and handle “reply” callbacks.
  • Updates the example README and pyproject.toml dependencies to match the new architecture.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 14 comments.

Show a summary per file
File Description
examples/a2a-test/src/state.py Adds BotState for operator conversation tracking and outbound qid→conversation mapping.
examples/a2a-test/src/cards.py Adds Adaptive Card builders for ask/reply with embedded routing metadata.
examples/a2a-test/src/a2a_client.py Adds a simple one-shot outbound A2A sender using a2a-sdk + httpx.
examples/a2a-test/src/a2a_executor.py Adds server-side A2A dispatch logic for ask/reply and pushes cards into Teams.
examples/a2a-test/src/a2a_server.py Wraps the executor in an A2AStarletteApplication and exposes an agent card/handler.
examples/a2a-test/src/bot_a.py Adds Alice bot: Teams handler + A2A server + card-action reply routing.
examples/a2a-test/src/bot_b.py Adds Bob bot: symmetric to Alice with separate ports and peer config.
examples/a2a-test/src/main.py Removes the prior single-file weather-oriented sample implementation.
examples/a2a-test/pyproject.toml Renames the example project and updates dependencies for the new approach.
examples/a2a-test/README.md Documents the new two-bot flow, file structure, and run instructions.

Comment thread examples/a2a-test/src/bot_b.py Outdated
Comment thread examples/a2a-test/src/bot_b.py Outdated
Comment thread examples/a2a-test/src/bot_b.py
Comment thread examples/a2a-test/src/state.py Outdated
Comment thread examples/a2a-test/src/cards.py Outdated
Comment thread examples/a2a-test/src/bot_b.py Outdated
Comment thread examples/a2a-test/src/state.py Outdated
Comment thread examples/a2a-test/src/a2a_client.py Outdated
Comment thread examples/a2a-test/src/bot_a.py Outdated
Comment thread examples/a2a-test/src/bot_a.py Outdated
Comment thread examples/a2a-test/src/a2a_client.py
Comment thread examples/a2a-test/README.md Outdated
Comment thread examples/a2a-test/src/bot_b.py
Comment thread examples/a2a-test/src/a2a_executor.py Outdated
Comment thread examples/a2a-test/src/a2a_executor.py Outdated
Comment thread examples/a2a-test/src/a2a_executor.py Outdated
Comment thread examples/a2a-test/src/bot_a.py Outdated
Comment thread examples/a2a-test/src/agent.py
Comment thread examples/a2a-test/src/agent.py
Comment thread examples/a2a-test/src/bot_a.py Outdated
@MehakBindra
MehakBindra merged commit 433699a into main Apr 25, 2026
7 checks passed
@MehakBindra
MehakBindra deleted the mehak/a2a-new branch April 25, 2026 00:03
corinagum added a commit that referenced this pull request May 27, 2026
## Summary

Brings `origin/main` into `release` for the **2.0.12** release. **No
carve-outs this time** — Quoted Replies (PR #321) is included.

`version.json`: `2.0.11` → `2.0.12`.

Aligns with teams.ts/teams.net cadence.

## What's in this release (delta from 2.0.11)

**Features**
- Quoted Replies & new quotes features (#321) — previously held back
- SuggestedActionSubmitActivity for `suggestedAction/submit` invoke
(#434)
- Default targeted replies for targeted inbound messages (#439)
- Reactions API marked GA (#427) — already shipped in 2.0.11 actually,
ignore if duplicate
- Prompt Preview support (#397)
- Sample: opt targeted-messages into slash commands (#430)
- Sample: a2a-in-teams (#401)
- Sample: proactive message update (#405)
- Allow custom HTTP client via `AppOptions` (#416)

**Security & fixes**
- Lock JsonWebToken trust-boundary contract (#432)
- Bump starlette 1.0.0 -> 1.1.0 for PYSEC-2026-161 / BadHost (#441)
- warn when bot starts without credentials (#435)
- fix(apps): support AAD v1 issuers in Entra token validation (#422)
- fix(apps): log inbound activities at info, warn on missing
Authorization (#425)
- fix(http-stream): wait for in-flight flush before sending final close
(#419)
- Mark reactions API as GA and fix sample remove flow (#427)
- Revert serviceUrl allowlist (ADO 5310460) (#415)
- Route `app.get_app_graph` + `ctx.*_graph` to sovereign endpoints via
`cloud.graph_scope` (#402)

**Deprecations / package changes**
- Remove ai, openai, mcpplugin, a2a, and devtools packages (#413)
- Restore and deprecate devtools package (#410)
- Deprecate ai, openai, mcpplugin, a2a packages (#406)
- Add agent framework example, remove chatprompt/mcp client samples
(#386)

**Dependency bumps**
- urllib3 2.6.3 → 2.7.0 (#426)
- python-multipart 0.0.26 → 0.0.27 (#424)
- microsoft-kiota-http 1.9.7 → 1.9.9 (#423)
- idna 3.11 → 3.15 (#431)
- starlette 1.0.0 → 1.1.0 (#441, security)
- /examples/tab/Web: qs, postcss, uuid, follow-redirects bumps

## Quoted Replies inclusion notes

- Teams client rendering is in-sync with the wire format as of
2026-05-06.
- APX QR rollout completed: Public 2026-04-10, GCCH/DoD/Gallatin
2026-04-14.
- Builder methods (`prepend_quote()`, `add_quote()`), `ctx.quote()`, and
the quote-aware `ctx.reply()` behavior are all present in this release.
- `examples/quoting` is included.

## Conflict resolution

The 2.0.11 release branch had the QR-removed shape for four files; took
`main`'s (QR-included) version for all of them:
- `examples/targeted-messages/src/main.py`
- `packages/api/src/microsoft_teams/api/activities/message/message.py`
- `packages/apps/src/microsoft_teams/apps/routing/activity_context.py`
- `packages/apps/tests/test_activity_context.py`

`version.json` conflict resolved to `2.0.12`.

## Test plan

- [x] `uv sync` clean
- [x] `poe check` (ruff format + lint) — clean
- [x] `poe test` — 609 passed
- [x] `pyright` — 0 errors, 0 warnings
- [ ] Pipeline build + test stages green on `release` after merge
- [ ] Publish pipeline run with **Public** → ESRP approval → PyPI
- [ ] `pip install microsoft-teams-apps==2.0.12` smoke install

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Aamir Jawaid <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 (1M context) <[email protected]>
Co-authored-by: Shanmathi Mayuram Krithivasan <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants