Challenge 01 - Connect Foundry Agent to Elastic

< Previous Challenge - Home - Next Challenge >

Pre-requisites

Introduction

In this challenge, you will create a support agent in Microsoft Foundry to connect to the Elasticsearch instance you created in Challenge 00. We’ll call it “Agent Mole”. The Model Context Protocol (MCP) lets Microsoft Foundry agents call Elastic tools without embedding a database client in the model.

When you create an Elasticsearch project, it comes with a set of built-in MCP tools, so nothing has to be generated or deployed. The core tools (named platform.core.*) cover the basic ways an AI agent works with your data. They can list the indices, read an index’s mapping (its structure), fetch a document by ID, run a search in plain English, and write and run ES|QL queries. Elastic maintains these tools, so you can’t edit them. You can add your own custom tools, such as a saved ES|QL query with parameters, and they appear right next to the built-in ones.

Kibana makes all of these tools available from one MCP server endpoint: {KIBANA_URL}/api/agent_builder/mcp. If you’re working in a Kibana Space other than the default one, use {KIBANA_URL}/s/{space-id}/api/agent_builder/mcp. Any MCP-compatible agent, including a Microsoft Foundry agent, can connect to that URL with an Elasticsearch API key. The agent then discovers the available tools and calls them as needed to answer questions about your data.

NOTE: The API key controls what the agent can do: tools run with that key’s permissions, so a read-only key limited to your workshop index keeps the agent from changing or seeing anything else.

Agent Mole is going to have to dig around blindly in your data to find the answers. It is our baseline, not a deliberately bad agent. It will be connected to the Elastic MCP endpoint that exposes the individual workshop indices, so it has to discover which data to query before it can answer. Index names and mappings describe structure, but they do not always explain business meaning. In this challenge you will build it in the Microsoft Foundry portal, test it, and measure what it costs to answer questions.

NOTE: Both the Microsoft Foundry Portal and Elastic Kibana menu labels change frequently. If a label below does not match what you see, look for the closest equivalent or ask your coach.

Description

Create Agent “Mole”

Connect Agent “Mole” to Elastic

Browse and observe the tools available in Kibana.

Screenshot showing where to copy the MCP server URL in Kibana

Back in your agent in Foundry, open Tools.

Foundry connects the Web search tool by default when creating a new agent. This tool connects your agent to Bing for Internet search results. We want to restrict the agent to only data from Elasticsearch, therefore, you should remove it.

NOTE: If you do not see an Elasticsearch entry in the Catalog, choose Model Context Protocol (MCP) from Custom tab in the Select a tool dialog and enter the same MCP endpoint URL and API key. The configuration flow is the same.

Test Agent “Mole”

Prioritize At-Risk Customers

Which Enterprise accounts have the highest churn risk, and what are they mostly calling us about?

Support Tickets: Unresolved Integration Issues

Which Enterprise accounts renewing in the next 60 days have open critical tickets, and which knowledge base articles cover their issues?

Financial Impact of at risk customers

What is the total ARR of the five accounts you just listed?

Observe Agent “Mole”

Observe how many calls and tokens the agent needed. You will compare these numbers with Agent Optimus in Challenge 03.

Success Criteria

Learning Resources

Tips

Advanced Challenges