Creat a2a-sample using A2A SDK for server, and agent framework for client#395
Open
MehakBindra wants to merge 9 commits intomainfrom
Open
Creat a2a-sample using A2A SDK for server, and agent framework for client#395MehakBindra wants to merge 9 commits intomainfrom
MehakBindra wants to merge 9 commits intomainfrom
Conversation
lilyydu
reviewed
Apr 21, 2026
| import uuid | ||
| from typing import Annotated, Any | ||
|
|
||
| from a2a.server.agent_execution import AgentExecutor, RequestContext |
Collaborator
There was a problem hiding this comment.
nit: are we able to combine these exports?
| ) | ||
| ) | ||
|
|
||
| async def cancel(self, context: RequestContext, event_queue: EventQueue) -> None: |
Collaborator
There was a problem hiding this comment.
should we add a comment here on why we're not implementing?
| sources: list[KBDoc], | ||
| ) -> AdaptiveCard: | ||
| """Render a chart or table with an optional cited-sources footer.""" | ||
| if chart_type == "verticalBar": |
Collaborator
There was a problem hiding this comment.
nit: could we separate these conditions into diff functions?
| r = await self._client.get_document(key=doc_id) | ||
| return _to_doc(cast(dict[str, Any], r)) | ||
| except ResourceNotFoundError: | ||
| return None |
| from azure.core.exceptions import ResourceNotFoundError | ||
| from azure.identity import ClientSecretCredential | ||
| from azure.search.documents import SearchClient | ||
| from azure.search.documents.indexes import SearchIndexClient |
Collaborator
There was a problem hiding this comment.
nit: can we combine these exports
| chunks = _load_chunks(_KB_ROOT) | ||
| result = client.upload_documents(chunks) | ||
| succeeded = sum(1 for r in result if r.succeeded) | ||
| print(f"Uploaded {succeeded}/{len(chunks)} chunks to '{index_name}'.") |
| print(f"Index '{index_name}' already exists — reusing.") | ||
| return | ||
| except ResourceNotFoundError: | ||
| pass |
| "Do not pass a custom adapter to App()." | ||
| ) | ||
|
|
||
| assert isinstance(adapter, FastAPIAdapter) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a complete, production-grade A2A (Agent-to-Agent) sample for a Teams bot that answers questions using a knowledge base (KB) agent backed by Azure AI Search.
The most important changes are:
Architecture and Core Features
README.md.Knowledge Base Agent Implementation
kb_agent/, including:agent.py: Defines the A2A executor, tools for searching the KB, rendering answers and charts as Adaptive Cards, and FastAPI app construction.index.py: Wraps Azure AI Search for document retrieval.cards.py: Renders answers and charts as Teams Adaptive Cards with citations.__main__.pyand__init__.py: Entrypoints for running the agent server.Host Agent and Integration
host_agent.pyto implement the Teams-side agent, which exposes theask_kbtool, calls the KB agent via A2A, and extracts Adaptive Card responses for Teams rendering.Dependencies and Environment
pyproject.tomlto use the new agent frameworks (a2a-sdk,agent-framework-a2a,agent-framework-foundry), Azure SDKs, andpython-dotenvfor environment management.