<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title><![CDATA[Fram Souza - Elasticsearch Labs]]></title>
    <description><![CDATA[Articles and tutorials from the Search team at Elastic]]></description>
    <copyright><![CDATA[© 2026. Elasticsearch B.V. All Rights Reserved]]></copyright>
    <image>
      <title><![CDATA[Fram Souza - Elasticsearch Labs]]></title>
      <url>https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt1121c0bf0e8a6e65/6a88da6340a1841030ef456f/search-labs-thumbnail.png</url>
      <link>https://www.elastic.co/cn/search-labs/author/fram-souza</link>
    </image>
    <link>https://www.elastic.co/cn/search-labs/author/fram-souza</link>
    <atom:link href="https://www.elastic.co/cn/search-labs/rss/author/fram-souza.xml" rel="self" type="application/rss+xml"/>
    <language><![CDATA[cn]]></language>
    <lastBuildDate>Tue, 22 Sep 2026 14:54:43 GMT</lastBuildDate>
  <item>
    <title><![CDATA[管理 Elasticsearch Serverless 项目的人工智能代理]]></title>
    <description><![CDATA[一个由自然语言驱动的人工智能代理，可轻松管理 Elasticsearch Serverless 项目--实现项目创建、删除和状态检查。]]></description>
    <content:encoded><![CDATA[<h2>如何使用人工智能代理管理无服务器 Elasticsearch 项目</h2><ol><li><p><strong>克隆版本库：</strong>使用<code>git clone https://github.com/elastic/elasticsearch-labs/supporting-blog-content/serverless-ai-agent</code> <code>a</code> 从 GitHub 下载该工具的代码，然后使用<code>cd serverless-ai-agent</code> 导航到该目录。</p></li><li><p><strong>设置环境： </strong>使用<code>python -m venv venv</code> 创建虚拟环境（可选）并激活（Windows 上为<code>source venv/bin/activate</code> 或<code>venv\Scripts\activate</code> ）。然后，使用<code>pip install -r requirements.txt</code> 安装必要的 Python 软件包。</p></li><li><p><strong>配置凭证： </strong>在项目根目录下创建<code>.env</code> 文件，并在其中填入 Elasticsearch API URL (<code>ES_URL</code>)、API 密钥 (<code>API_KEY</code>)、地区 (<code>REGION</code>) 和 OpenAI API 密钥 (<code>OPENAI_API_KEY</code>)。</p></li><li><p><strong>运行工具： </strong>在终端运行<code>python main.py</code> ，执行该工具。这将启动人工智能代理，并提示您执行命令。</p></li><li><p><strong>用自然语言管理项目：</strong>使用纯英文命令与工具交互，如"Create a serverless project named my\_project","Get status of the serverless project named my\_project", 或"Delete the serverless project named my\_project" 。人工智能将解读您的命令并执行相应的功能。</p></li></ol><h2>背景</h2><p>这个小命令行工具能让你用简单的英语管理你的<a href="https://www.elastic.co/guide/en/serverless/current/intro.html">无服务器 Elasticsearch 项目</a>。它会与人工智能（本例中为 OpenAI）对话，以了解您的意思，并使用 LlamaIndex 调用正确的函数！</p><h3>Elasticsearch Serverless AI 代理能做什么</h3><ul><li><p><strong>创建项目</strong>：启动一个新的无服务器 Elasticsearch 项目。</p></li><li><p><strong>删除项目</strong>删除现有项目（是的，它会在你删除后进行清理）。</p></li><li><p><strong>获取项目状态</strong>：查看项目进展情况</p></li><li><p><strong>获取项目详情</strong>：获取项目的所有细节。</p></li></ul><p>在<a href="https://github.com/elastic/elasticsearch-labs/tree/a65f7bc1e4a041765d1c0a45ac44b9cd9fc1589f/supporting-blog-content/serverless-ai-agent">GitHub</a>上查看代码。</p><h3>Elasticsearch Serverless AI 代理如何工作</h3><p>当您输入以下内容时</p><p><em>"创建一个名为 my_project 的无服务器项目"</em></p><p>......下面是幕后花絮：</p><ul><li><p><strong>用户输入&amp; 上下文：</strong>您的自然语言命令将发送给人工智能代理。</p></li><li><p><strong>功能描述：</strong>人工智能代理已经知道一些函数，如创建项目、删除项目、获取项目状态和获取项目细节，因为我们给了它详细的说明。这些说明会告诉人工智能每个函数的作用以及需要的参数。</p></li><li><p><strong>LLM 处理：</strong>将您的查询和功能信息发送给 LLM。这意味着人工智能可以看到</p><ul><li><p><strong>用户查询</strong>：您的简明指令</p></li><li><p><strong>可用功能&amp; 说明</strong>：详细说明每个工具的功能，以便选择正确的工具。</p></li><li><p><strong>上下文/历史聊天信息</strong>：既然是对话，就会记住之前说过的话。</p></li></ul></li><li><p><strong>函数调用&amp; 响应：</strong>人工智能会找出要调用的函数，传递正确的参数（如项目名称），然后执行函数。回复会以友好的格式发回给您。</p></li></ul><p>简而言之，我们将您的自然语言查询和详细的工具描述列表同时发送给 LLM，这样它就能 "理解 "并为您的请求选择正确的操作。</p><h3>设置人工智能代理</h3><h4>先决条件</h4><p>运行人工智能代理之前，请确保已设置好以下内容：</p><ol><li><p>已安装<strong>Python（v3.7 或更高版本）</strong>。</p></li><li><p>在 Elastic Cloud 上设置<strong>Elasticsearch 无服务器账户</strong>。</p></li><li><p><strong>OpenAI 账户</strong>与语言模型进行交互。</p></li></ol><h4>步骤：</h4><p><strong>1.克隆版本库：</strong></p>git clone https://github.com/elastic/elasticsearch-labs/supporting-blog-content/serverless-ai-agent
cd serverless-ai-agent<p><strong>2.创建虚拟环境（可选但推荐）：</strong>如果遇到与环境相关的问题，可以建立虚拟环境进行隔离：</p>python -m venv venv
source venv/bin/activate  # On Windows, use venv\Scripts\activate<p><strong>3.安装依赖项：</strong>运行以下命令，确保已安装所有必需的依赖项：</p>pip install -r requirements.txt<p><strong>4.配置环境：</strong>创建 .env文件，其中包含以下变量下面是一个<code>.env.example</code> 文件示例，希望对您有所帮助：</p>ES_URL=your_elasticsearch_api_url  # The base URL for your Elasticsearch service (e.g., https://your-cluster-id.es.region.aws.elastic-cloud.com)
API_KEY=your_elasticsearch_api_key  # Your API key for Elasticsearch
REGION=your_region  # Example: aws-eu-west-1
OPENAI_API_KEY=your_openai_api_key  # Your OpenAI API key<p>确保<code>ES_URL</code> 、<code>API_KEY</code> 和<code>OPENAI_API_KEY</code> 的值正确无误。您可以在相应的服务仪表板中找到您的 API 密钥。</p><p><strong>5.项目文件：</strong>该工具使用<code>projects.json</code> 文件来存储项目映射（项目名称与其详细信息）。如果该文件不存在，将自动创建。</p><h3>运行人工智能代理</h3>python main.py<p>您会看到这样的提示</p>Welcome to the Serverless Project AI Agent Tool!
You can ask things like:
 - 'Create a serverless project named my_project'
 - 'Delete the serverless project named my_project'
 - 'Get the status of the serverless project named my_project'
 - 'Get the details of the serverless project named my_project'<p>输入指令，人工智能代理就会施展魔法！完成后，请输入<code>exit</code> 或<code>quit</code> 离开。</p><h3>更多细节</h3><ul><li><p><strong>LLM 集成</strong>：LLM 可同时收到您的查询和每个可用功能的详细说明。这有助于它理解上下文，并决定是调用<code>create_ess_project</code> 还是<code>delete_ess_project</code> 等。</p></li><li><p><strong>工具说明</strong>：每个函数工具（使用 FunctionTool.from_defaults 创建）有一个友好的描述。该说明包含在发送给 LLM 的提示中，以便 LLM "知道 "有哪些可用的操作，以及每个操作的期望值。</p></li><li><p><strong>持久性</strong>：项目及其详细信息保存在 projects.json 中、这样您就不必每次都重新输入信息了。</p></li><li><p><strong>详细记录</strong>：代理被设置为 "详细 "模式，非常适合调试和查看指令如何被转换为函数调用。</p></li></ul><h3>Elasticsearch 人工智能代理利用示例</h3>python main.py 

Welcome to the Serverless Project AI Agent Tool!

You can ask things like:
 - 'Create a serverless project named my_project'
 - 'Delete the serverless project named my_project'
 - 'Get the status of the serverless project named my_project'
 - 'Get the details of the serverless project named my_project'

User: Create a serverless project named my-february-test
Added user message to memory: Create a serverless project named my-february-test

=== Calling Function ===
Calling function: create_ess_project with args: {"project_name":"my-february-test"}
========================


Agent: The serverless Elasticsearch project named "my-february-test" has been created successfully. Here are the details:

- **Project ID:** &lt;&gt;&gt;
- **Elasticsearch Endpoint:** [https://my-february-test-ccc399.es.eu-west-1.aws.qa.elastic.cloud](https://my-february-test-ccc399.es.eu-west-1.aws.qa.elastic.cloud)
- **Kibana Endpoint:** [https://my-february-test-ccc399.kb.eu-west-1.aws.qa.elastic.cloud](https://my-february-test-ccc399.kb.eu-west-1.aws.qa.elastic.cloud)

User: get my-february-test status
Added user message to memory: get my-february-test status

=== Calling Function ===
Calling function: get_ess_project_status with args: {"project_name":"my-february-test"}
========================

Agent: The status of the "my-february-test" project is currently **initializing**.

User: get my-february-test info
Added user message to memory: get my-february-test info

=== Calling Function ===
Calling function: get_ess_project_details with args: {"project_name":"my-february-test"}
========================

Agent: Here are the details for the "my-february-test" project:

- **Project Name:** my-february-test
- **Alias:** my-february-test-ccc399
- **Cloud ID:** ""
- **Project ID:** ""
- **Region ID:** aws-eu-west-1
- **Created At:** 2025-02-12T15:42:00.530177619Z
- **Created By:** 571213384
- **Organization ID:** ""
- **Type:** Elasticsearch
- **Optimized For:** General Purpose
- **Search Lake:**
  - **Boost Window:** 7
  - **Search Power:** 100
- **Endpoints:**
  - **Elasticsearch:** https://my-february-test-ccc399.es.eu-west-1.aws.qa.elastic.cloud
  - **Kibana:** https://my-february-test-ccc399.kb.eu-west-1.aws.qa.elastic.cloud
- **Credentials:**
  - **Username:** ""
  - **Password:** ""

Please ensure to keep the credentials secure.

User: please delete the my-february-test project
Added user message to memory: please delete the my-february-test project

=== Calling Function ===
Calling function: delete_ess_project with args: {"project_name":"my-february-test"}
========================

Agent: The "my-february-test" project has been deleted successfully.<p></p>]]></content:encoded>
    <link>https://www.elastic.co/search-labs/blog/serverless-elasticsearch-ai-agent</link>
    <guid isPermaLink="true">https://www.elastic.co/search-labs/blog/serverless-elasticsearch-ai-agent</guid>
    <category><![CDATA[Elastic Cloud Serverless]]></category>
    <category><![CDATA[智能体 AI]]></category>
    <dc:creator><![CDATA[Fram Souza]]></dc:creator>
    <enclosure url="https://static-www.elastic.co/v3/assets/bltefdd0b53724fa2ce/blt88526af16bafdb7c/6a17d7807f6f15825dc0998d/d11e1ba058784ec92b8953fb8db62e1bad21c210-720x420.jpg" length="0" type="image/jpeg"/>
    <pubDate>Tue, 04 Mar 2025 00:00:00 GMT</pubDate>
  </item>
  </channel>
</rss>