Elasticsearch:如何在 workflow 里调用一个 agent

发布时间:2026/6/25 7:56:31

Elasticsearch:如何在 workflow 里调用一个 agent 在 AI Agent Builder 里我们可以创建一个 workflow 的工具从而达到调用 workflow 的目的。我们是不是也可以在 workflow 里调用 AI Agent Builder 里所创建的 Agent 呢答案是肯定的。下面我们来用一个简单的例子来进行展示。创建一个 agent我们创建的一个 agent 的名字叫做 generate_audio_product_json。它是用来解析我们的输入并提区我们所需要的信息。它的创建非常融 我们甚至不需要使用任何的工具。Custom InstructionsExtract audio product information from this description. Return raw JSON only. Do NOT use markdown, backticks, or code blocks. Extract audio product information from this description. Return raw JSON only. Do NOT use markdown, backticks, or code blocks. Fields: - category (string, one of: Headphones/Earbuds/Speakers/Microphones/Accessories) - features (array of strings from: wireless, noise_cancellation, long_battery, waterproof, voice_assistant, fast_charging, portable, surround_sound) - use_case (string, one of: Travel/Office/Home/Fitness/Gaming/Studio)我使用一个简单的例子来进行展示Premium wireless Bluetooth headphones with active noise cancellation, 30-hour battery life, and premium leather ear cushions. Perfect for travel and office use.创建一个 workflow 并调用 agent我们在 workflow 里创建一个如下的 workflowversion: 1 name: invoke_audio_product_agent description: Extract structured product data using an AI agent enabled: true triggers: - type: manual inputs: - name: product_info type: string required: true description: product descriptions steps: # Step 1: Log input (optional but recommended) - name: log_input type: console with: message: Incoming product info: {{ inputs.product_info }} # Step 2: Invoke your agent - name: generate_product_json type: ai.agent with: agent_id: generate_audio_product_json message: | Extract structured product data from the following input. Input: {{ inputs.product_info }} Return ONLY valid JSON. # Step 3: Print the result - name: print_result type: console with: message: {{ steps.generate_product_json.output }}Premium wireless Bluetooth headphones with active noise cancellation, 30-hour battery life, and premium leather ear cushions. Perfect for travel and office use.祝大家学习愉快

相关新闻