{"id":16600,"date":"2026-03-26T00:00:00","date_gmt":"2026-03-26T07:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/ise\/?p=16600"},"modified":"2026-03-26T05:21:57","modified_gmt":"2026-03-26T12:21:57","slug":"building-bing-search-enabled-agent-with-microsoft-foundry-and-semantic-kernel","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/ise\/building-bing-search-enabled-agent-with-microsoft-foundry-and-semantic-kernel\/","title":{"rendered":"Building Search-Enabled Agents with Azure AI Foundry and Semantic Kernel and A2A"},"content":{"rendered":"<p>The landscape of AI development has evolved dramatically. Modern intelligent agents require real-time web access to provide accurate, grounded responses. With the <a href=\"https:\/\/learn.microsoft.com\/en-us\/lifecycle\/announcements\/bing-search-api-retirement\">retirement of direct Bing Search API access<\/a>, developers must transition from direct API integration to agent-based architectures.<\/p>\n<p>This article explores how to implement a robust search solution by orchestrating a communication channel between a Semantic Kernel agent and an Azure AI Foundry agent using the Agent-to-Agent (A2A) protocol.<\/p>\n<h2>The Challenge<\/h2>\n<p>The deprecation of raw Bing Search API endpoints necessitates a new integration pattern. Currently, <a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/ai-foundry\/agents\/how-to\/tools\/bing-grounding?view=azure-python-preview&amp;tabs=python&amp;pivots=overview\">Bing Grounding<\/a> capabilities are encapsulated within Azure AI Foundry agents. This creates a service boundary where external agents\u2014such as those built with Semantic Kernel or LangChain\u2014cannot directly invoke Bing search capabilities as a standalone tool.<\/p>\n<p>Instead of a direct API call, search functionality must be consumed through an intermediary agent hosted within the Azure AI Foundry ecosystem. This requires a reliable protocol for inter-agent communication.<\/p>\n<h2>Solution Architecture: Multi-Agent Orchestration<\/h2>\n<p>To address this constraint, we implemented a multi-agent pattern that separates concerns between orchestration and information retrieval:<\/p>\n<ol>\n<li><strong>Search Specialist (Azure AI Foundry):<\/strong> A hosted agent configured with the Bing Grounding tool. This agent handles query formulation, execution, and result parsing.<\/li>\n<li><strong>Orchestrator (Semantic Kernel):<\/strong> A primary agent that manages user interaction, maintains conversation context, and delegates search tasks to the specialist agent when external information is required.<\/li>\n<\/ol>\n<p><img decoding=\"async\" src=\"https:\/\/devblogs.microsoft.com\/ise\/wp-content\/uploads\/sites\/55\/2026\/03\/search-agent.png\" alt=\"Architecture Diagram of the Multi-Agent System\" \/><\/p>\n<p>By using the <strong>A2A (Agent-to-Agent) communication protocol<\/strong>, we establish a standardized interface for the Orchestrator to dispatch requests to the Search Specialist, effectively treating the remote agent as a native tool.<\/p>\n<h2>Setting Up Bing Grounding in Azure<\/h2>\n<p>Establishing the connection between your AI Foundry environment and Bing Search requires careful configuration through the Azure portal.<\/p>\n<p><a href=\"https:\/\/learn.microsoft.com\/en-us\/azure\/ai-foundry\/agents\/how-to\/tools\/bing-grounding\">Step-by-Step Configuration<\/a> Process:<\/p>\n<ol>\n<li>Access Azure AI Studio: Navigate to the Azure AI Studio through your Azure portal account<\/li>\n<li>Project Selection: Either create a new AI project or select an existing project from your workspace<\/li>\n<li>Connection Management: Locate the &#8220;Connections&#8221; section in the project&#8217;s navigation panel<\/li>\n<li>Service Integration: Select &#8220;New connection&#8221; and choose &#8220;Bing Search&#8221; from the available service catalog<\/li>\n<li>Authentication Setup: Input your Bing Search API key (obtained from your Azure Bing Search resource)<\/li>\n<li>Retrieve Connection Identifier: After successful creation, the system assigns a unique Connection ID\u2014this identifier becomes the critical link between your code and the Bing Search service. Store this value securely in your environment configuration (typically as <code>BING_CONNECTION_ID<\/code>)<\/li>\n<\/ol>\n<h2>Deep-Dive: A2A Protocol for Foundry Agent Communication with Bing Grounding<\/h2>\n<p>Once Bing Grounding is available inside Azure AI Foundry, the remaining challenge is enabling an external agent to use it. This is solved using the Agent-to-Agent (A2A) protocol. Google&#8217;s Agent-to-Agent (A2A) protocol represents a foundational advancement in inter-agent communication standards. This protocol establishes a universal language that enables AI agents built on different platforms and technologies to collaborate seamlessly.<\/p>\n<h3>A2A Protocol Components<\/h3>\n<p>The A2A protocol implementation in our system involves several key components:<\/p>\n<p><strong>Agent Discovery and Capability Advertisement<\/strong><\/p>\n<p>The A2A protocol begins with agent discovery, where agents advertise their capabilities through standardized &#8220;agent cards&#8221;:<\/p>\n<pre><code class=\"language-python\">#Client-side discovery process\r\nresolver = A2ACardResolver(httpx_client=httpx_client, base_url=base_url)\r\nagent_card = await resolver.get_agent_card()<\/code><\/pre>\n<p>The agent card contains metadata about the agent&#8217;s capabilities, supported message formats, and communication endpoints. This allows agents to understand what services are available before attempting communication.<\/p>\n<h3>Message Structure and Communication Patterns<\/h3>\n<p>A2A messages follow a standardized structure that ensures compatibility across different agent implementations:<\/p>\n<pre><code class=\"language-python\">#A2A message construction\r\nrequest = SendMessageRequest(\r\n    id=str(uuid4()),                    # Unique request identifier\r\n    params=MessageSendParams(\r\n        message={\r\n            \"messageId\": uuid4().hex,    # Message tracking ID\r\n            \"role\": \"user\",              # Message sender role\r\n            \"parts\": [{\"text\": user_input}],  # Message content parts\r\n            \"contextId\": str(uuid4()),   # Conversation context\r\n        }\r\n    )\r\n)<\/code><\/pre>\n<p>This structure provides:<\/p>\n<ul>\n<li><strong>Unique identification<\/strong> for request tracking and debugging<\/li>\n<li><strong>Role-based messaging<\/strong> to distinguish between user and agent communications<\/li>\n<li><strong>Multi-part content support<\/strong> for complex message types<\/li>\n<li><strong>Context management<\/strong> for maintaining conversation continuity<\/li>\n<\/ul>\n<p><strong>Communication Flow Analysis<\/strong><\/p>\n<p>The complete A2A communication flow demonstrates sophisticated inter-agent coordination:<\/p>\n<pre><code class=\"language-python\">class SearchTool:\r\n    @kernel_function(\r\n        description=\"web search using search agent\",\r\n        name=\"web_Search\"\r\n    )\r\n    async def web_search(self, user_input: str) -&gt; str:\r\n        timeout = httpx.Timeout(120.0, connect=60.0)\r\n\r\n        async with httpx.AsyncClient(timeout=timeout) as httpx_client:\r\n            # Step 1: Agent Discovery\r\n            resolver = A2ACardResolver(httpx_client=httpx_client, base_url=base_url)\r\n            agent_card = await resolver.get_agent_card()\r\n\r\n            # Step 2: Client Initialization\r\n            client = A2AClient(httpx_client=httpx_client, agent_card=agent_card)\r\n\r\n            # Step 3: Message Construction\r\n            request = SendMessageRequest(\r\n                id=str(uuid4()),\r\n                params=MessageSendParams(\r\n                    message={\r\n                        \"messageId\": uuid4().hex,\r\n                        \"role\": \"user\",\r\n                        \"parts\": [{\"text\": user_input}],\r\n                        \"contextId\": str(uuid4()),\r\n                    }\r\n                )\r\n            )\r\n\r\n            # Step 4: Message Transmission\r\n            response = await client.send_message(request)\r\n\r\n            # Step 5: Response Processing\r\n            result = response.model_dump(mode='json', exclude_none=True)\r\n            return result[\"result\"][\"parts\"][0][\"text\"]\r\n\r\nsupervisor_agent = ChatCompletionAgent(\r\n    service=AzureChatCompletion(\r\n        api_key=os.getenv(\"AZURE_OPENAI_API_KEY\"),\r\n        endpoint=os.getenv(\"AZURE_OPENAI_ENDPOINT\"),\r\n        deployment_name=os.getenv(\"AZURE_OPENAI_DEPLOYMENT_NAME\"),\r\n        api_version=os.getenv(\"AZURE_OPENAI_API_VERSION\"),\r\n    ),\r\n    name=\"SupervisorAgent\",\r\n    instructions=\"You are a helpful general assistant. Use the provided tools to assist users with their ask on latest news and search.\",\r\n    plugins=[SearchTool()]\r\n<\/code><\/pre>\n<p>The searchTool has been integrated into the Semantic Kernel ChatCompletionAgent, enabling the LLM to automatically invoke it whenever a user issues a search-related query.<\/p>\n<h3>Server-Side A2A Implementation<\/h3>\n<p>The server-side A2A implementation demonstrates how agents can expose their capabilities through the protocol:<\/p>\n<pre><code class=\"language-python\">\r\nclass AIFoundrySearchAgent:\r\n    def __init__(self):\r\n        logger.info(\"Initializing AIFoundry search agent.\")\r\n        try:\r\n            # Load configuration from environment variables\r\n            self.endpoint = os.getenv(\"AZURE_AI_ENDPOINT\")\r\n            self.model = os.getenv(\"AZURE_OPENAI_DEPLOYMENT_NAME\") \r\n            self.conn_id = os.getenv(\"BING_CONNECTION_ID\")\r\n\r\n            self.credential = DefaultAzureCredential()\r\n            self.threads: dict[str, str] = {}\r\n\r\n            # Create Azure AI Agents client\r\n            agents_client = AgentsClient(\r\n                endpoint=self.endpoint,\r\n                credential=self.credential,\r\n            )\r\n\r\n            # Initialize Bing grounding tool with connection ID\r\n            bing = BingGroundingTool(connection_id=self.conn_id)\r\n\r\n            # Create the specialized search agent\r\n            self.agent = agents_client.create_agent(\r\n                model=self.model,\r\n                name='foundry-search-agent',\r\n                instructions=\"An intelligent bing search agent powered by Azure AI Foundry. Your capabilities include Latest news and Web search. Return in 1 line only\",\r\n                tools=bing.definitions,\r\n            )\r\n\r\n        except Exception as e:\r\n            logger.error(f\"Failed to initialize AIFoundrySearchAgent: {str(e)}\")\r\n            raise\r\n\r\nclass FoundryAgentExecutor(AgentExecutor):\r\n    async def execute(self, context: RequestContext, event_queue: EventQueue) -&gt; None:\r\n        user_input = context.get_user_input()\r\n        context_id = context.context_id\r\n\r\n        # Process A2A request context\r\n        task = context.current_task\r\n        if not task:\r\n            task = new_task(context.message)\r\n            await event_queue.enqueue_event(task)\r\n\r\n        # Execute agent capability\r\n        result = await self.agent.search(user_input, context_id)\r\n\r\n        # Return response via A2A event system\r\n        await event_queue.enqueue_event(new_agent_text_message(result))<\/code><\/pre>\n<h3>Testing the Agents using the A2A Inspector<\/h3>\n<p>The A2A Inspector is a web-based tool designed to help developers inspect, debug, and validate servers that implement the Google A2A (Agent2Agent) protocol. It provides a user-friendly interface to interact with an A2A agent, view communication, and ensure specification compliance.<\/p>\n<p>For more information go <a href=\"https:\/\/github.com\/a2aproject\/a2a-inspector\">here<\/a>.<\/p>\n<p>You can use the tool to interact with the A2A servers.<\/p>\n<h3>Protocol Benefits and Architecture Impact<\/h3>\n<p>The A2A protocol provides several critical architectural benefits:<\/p>\n<ol>\n<li>Platform Independence: Agents built on different frameworks can communicate seamlessly<\/li>\n<li>Loose Coupling: Changes to one agent don&#8217;t affect others as long as A2A compatibility is maintained<\/li>\n<li>Scalability: New agents can be added to the ecosystem without modifying existing components<\/li>\n<li>Standardization: Common communication patterns reduce development complexity<\/li>\n<li>Debuggability: Standardized message formats improve monitoring and troubleshooting<\/li>\n<\/ol>\n<p>In our architecture, A2A serves as the critical communication backbone that enables our Python-based Semantic Kernel agent to interact naturally with the Azure AI Foundry search agent. This protocol abstraction means that either agent could be replaced or upgraded without affecting the other, as long as they maintain A2A compatibility. This loose coupling is essential for building maintainable, scalable multi-agent systems.<\/p>\n<h2>Conclusion<\/h2>\n<p>The deprecation of direct Bing Search API access has catalyzed a fundamental shift toward more sophisticated multi-agent architectures. What initially appeared as a technical challenge has evolved into an opportunity to build more robust, scalable, and maintainable AI systems.<\/p>\n<p>Key Technical Achievements<\/p>\n<p>Our implementation demonstrates several critical patterns:<\/p>\n<ul>\n<li><strong>Specialized Agent Design<\/strong>: The Azure AI Foundry search agent serves a single, well-defined purpose, incorporating robust error handling, observability, and conversation management<\/li>\n<li><strong>Seamless Orchestration<\/strong>: Semantic Kernel&#8217;s plugin architecture enables natural integration of specialized agents into broader workflows<\/li>\n<li><strong>Standardized Communication<\/strong>: The A2A protocol provides a platform-independent way for agents to discover and interact with each other<\/li>\n<li><strong>Production-Ready Patterns<\/strong>: Thread management, timeout handling, and state persistence ensure enterprise-grade reliability<\/li>\n<\/ul>\n<h3>The Evolution of A2A<\/h3>\n<p>The A2A protocol is rapidly evolving to support more sophisticated interaction patterns:<\/p>\n<p>Future versions will likely support:<\/p>\n<ul>\n<li>Multi-party agent negotiations and consensus mechanisms<\/li>\n<li>Streaming data exchanges for real-time collaboration<\/li>\n<li>Advanced security and authentication frameworks for enterprise environments<\/li>\n<li>Semantic capability matching for automatic agent discovery and composition<\/li>\n<\/ul>\n<p>Ecosystem Growth: As adoption increases, we can expect agent marketplaces and cross-platform orchestration tools that will enhance the ecosystem&#8217;s maturity and interoperability.<\/p>\n<h3>Moving Forward<\/h3>\n<p>This multi-agent approach represents more than a workaround for API deprecation\u2014it establishes a foundation for building the next generation of intelligent applications. By treating external capabilities as specialized agents rather than simple API endpoints, we enable systems that are more modular, fault-tolerant, and adaptable to changing requirements.<\/p>\n<p>The architecture patterns demonstrated here\u2014from Azure AI Foundry&#8217;s grounding capabilities to Semantic Kernel&#8217;s orchestration framework\u2014provide a practical blueprint for developers facing similar integration challenges. As the AI ecosystem continues to evolve, the ability to compose specialized agents through standardized protocols like A2A will become an essential architectural skill.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A step-by-step guide to enable search in the semantic kernel agents using bing grounding in Azure Foundry AI Agent using A2A.<\/p>\n","protected":false},"author":151121,"featured_media":16604,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1,3451],"tags":[3400],"class_list":["post-16600","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-cse","category-ise","tag-ise"],"acf":[],"blog_post_summary":"<p>A step-by-step guide to enable search in the semantic kernel agents using bing grounding in Azure Foundry AI Agent using A2A.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/posts\/16600","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/users\/151121"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/comments?post=16600"}],"version-history":[{"count":1,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/posts\/16600\/revisions"}],"predecessor-version":[{"id":16605,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/posts\/16600\/revisions\/16605"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/media\/16604"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/media?parent=16600"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/categories?post=16600"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/ise\/wp-json\/wp\/v2\/tags?post=16600"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}