偷偷摘套内射激情视频,久久精品99国产国产精,中文字幕无线乱码人妻,中文在线中文a,性爽19p

臨交工兩周,智能體演示全盤血崩!大牛頓悟:我只是做了個(gè)花式提示詞鏈!血淚重構(gòu)血淚總結(jié):AI智能體的五個(gè)進(jìn)階等級(jí)(附完整代碼實(shí)現(xiàn))

原創(chuàng) 精選
人工智能
不僅僅是串聯(lián) API 調(diào)用,而是要管理狀態(tài)、決策、以及長(zhǎng)流程控制。當(dāng)這個(gè)邏輯打通后,一切都變得簡(jiǎn)單了:代碼更清晰,邏輯更合理,結(jié)果更靠譜。這篇文章的目標(biāo),就是將智能體的設(shè)計(jì)拆解成五個(gè)難度等級(jí),每一層都有對(duì)應(yīng)的工作代碼。

編譯 | 云昭

作者 | Paolo Perrone

出品 | 51CTO技術(shù)棧(微信號(hào):blog51cto)

在距離產(chǎn)品大限還有兩周時(shí),我的智能體原型徹底崩了。

表面上看,它沒什么問題:能抓取數(shù)據(jù)、調(diào)用工具、還能解釋它的執(zhí)行步驟。但其實(shí)全是裝的。它沒有狀態(tài)、沒有記憶、也沒有推理能力,只是用循環(huán)提示詞假裝自己很聰明。

直到一個(gè)邊界情況讓它徹底懵掉時(shí),我才發(fā)現(xiàn):我沒造出“智能體”,只是搞了一個(gè)花哨的提示詞鏈。

要修復(fù)它,我必須徹底重構(gòu)——

不僅僅是串聯(lián) API 調(diào)用,而是要管理狀態(tài)、決策、以及長(zhǎng)流程控制。

當(dāng)這個(gè)邏輯打通后,一切都變得簡(jiǎn)單了:代碼更清晰,邏輯更合理,結(jié)果更靠譜。

這篇文章的目標(biāo),就是將智能體的設(shè)計(jì)拆解成五個(gè)難度等級(jí),每一層都有對(duì)應(yīng)的工作代碼。

不管你是剛起步,還是正在擴(kuò)展真實(shí)業(yè)務(wù),這篇文章都能幫你避開本人曾經(jīng)踩過的坑,造出真正靠譜的 Agent。

一、構(gòu)建智能體的 5 個(gè)等級(jí)

大家都知道,奧特曼對(duì)于 AGI 做了 5 級(jí)規(guī)劃,其中 Agent 屬于第三級(jí)別,現(xiàn)在,我們也把 Agent 的等級(jí)水平分為 5 級(jí),看看你能實(shí)現(xiàn)哪一個(gè)層級(jí)。我把智能體分成以下五級(jí):

Level 1:具備工具調(diào)用能力的智能體

Level 2:擁有知識(shí)檢索和記憶功能的智能體

Level 3:具備長(zhǎng)期記憶和推理能力的智能體

Level 4:多智能體團(tuán)隊(duì)協(xié)作

Level 5:智能體系統(tǒng)化部署

1.Level 1:工具 + 指令驅(qū)動(dòng)的智能體

這是最基礎(chǔ)的版本——一個(gè)能執(zhí)行指令并循環(huán)調(diào)用工具的 LLM。人們說的“Agent 就是 LLM + 工具調(diào)用”,指的就是這個(gè)層級(jí)(也側(cè)面說明他們探索得不深)。

指令告訴 Agent 要干嘛,工具讓它能動(dòng)手做事:抓數(shù)據(jù)、調(diào)用 API、觸發(fā)流程等。雖然簡(jiǎn)單,但已經(jīng)可以實(shí)現(xiàn)不少自動(dòng)化任務(wù)了。

from agno.agent import Agent 
from agno.models.openai import OpenAIChat 
from agno.tools.duckduckgo import DuckDuckGoTools

agno_assist = Agent(
  name="Agno AGI",
  model=0penAIChat(id="gpt-4.1"),
  descriptinotallow=dedent("""\
  You are "Agno AGI, an autonomous AI Agent that can build agents using the Agno)
  framework. Your goal is to help developers understand and use Agno by providing 
  explanations, working code examples, and optional visual and audio explanations
  of key concepts."""),
  instructinotallow="Search the web for information about Agno.",
  tools=[DuckDuckGoTools()],
  add_datetime_to_instructinotallow=True, 
  markdown=True,
)
  agno_assist.print_response("What is Agno?", stream=True)

2.Level 2:有知識(shí) + 記憶能力的智能體

現(xiàn)實(shí)中大多數(shù)任務(wù),LLM 本身的知識(shí)都不夠用。不能把所有內(nèi)容都塞進(jìn) prompt,所以 Agent 需要能在運(yùn)行時(shí)調(diào)用外部知識(shí)庫(kù)——這就涉及agentic RAG 或 動(dòng)態(tài) few-shot 提示。

最理想的方式是混合檢索(全文 + 語(yǔ)義)+ rerank 重排,這是目前 agent 檢索的最佳方案。

此外,持久化存儲(chǔ)讓 Agent 擁有記憶。LLM 本身是無狀態(tài)的,但通過記錄歷史對(duì)話和行為,它就能變成“有記憶”的狀態(tài)智能體。

... imports
# You can also use https://docs.agno.com/llms-full.txt for the full documentation
knowledge_base = UrlKnowledge(
  urls=["https://docs.agno.com/introduction.md"],
  vector_db=LanceDb(
    uri="tmp/lancedb",
    table_name="agno_docs",
    search_type=SearchType.hybrid,
    embedder=0penAIEmbedder(id="text-embedding-3-small"),
    reranker=CohereReranker(model="rerank-multilingual-v3.0"),
  ),
)
storage = SqliteStorage(table_name="agent_sessions", db_file="tmp/agent.db")

agno_assist = Agent(
  name="Agno AGI",
  model=OpenAIChat(id="gpt-4.1"),
  descriptinotallow=..., 
  instructinotallow=...,
  tools=[PythonTools(), DuckDuckGoTools()],
  add_datetime_to_instructinotallow=True,
# Agentic RAG is enabled by default when 'knowledge' is provided to the Agent.
  knowledge=knowledge_base,
# Store Agent sessions in a sqlite database
  storage=storage,
# Add the chat history to the messages
  add_history_to_messages=True,
# Number of history runs
  num_history_runs=3, 
  markdown=True,
)

if __name_ == "__main__":
# Load the knowledge base, comment after first run
# agno_assist.knovledge.load(recreate=True)
  agno _assist.print_response("What is Agno?", stream=True)

3.Level 3:長(zhǎng)期記憶 + 推理能力的智能體

長(zhǎng)期記憶意味著 Agent 能記住跨會(huì)話的信息,比如用戶偏好、過去執(zhí)行失敗的任務(wù),從而逐漸適應(yīng)用戶和上下文。這就開啟了個(gè)性化和持續(xù)改進(jìn)的可能性。

推理能力則是進(jìn)一步升級(jí)——讓 Agent 更擅長(zhǎng)拆解任務(wù)、做決策、處理多步驟任務(wù)。不僅能“理解”,還能提升任務(wù)完成率。

... imports

knowledge_base = ...

memory = Memory(
# Use any model for creating nemories
  model=0penAIChat(id="gpt-4.1"),
  db=SqliteMemoryDb(table_name="user_menories", db_file="tmp/agent.db"),
  delete_memories=True, 
  clear_memories=True,
)

  storage =

agno_assist = Agent(
  name="Agno AGI",
  model=Claude (id="claude-3-7-sonnet-latest"),
# User for the memories
  user_id="ava", 
  descriptinotallow=..., 
  instructinotallow=...,
# Give the Agent the ability to reason
  tools=[PythonTools(), DuckDuckGoTools(), 
  ReasoningTools(add_instructinotallow=True)],
  ...
# Store memories in a sqlite database
  memory=memory,
# Let the Agent manage its menories
  enable_agentic_memory=True,
)

if __name__ == "__main__":
# You can comment this out after the first run and the agent will remember
  agno_assist.print_response("Always start your messages with 'hi ava'", stream=True)
  agno_assist.print_response("What is Agno?", stream=True)

4.Level 4:多智能體團(tuán)隊(duì)

最有效的 Agent 往往是專注的:在某一垂類擅長(zhǎng)任務(wù),配有有限(<10 個(gè))的專用工具。

如果任務(wù)更復(fù)雜,就需要多個(gè) Agent 協(xié)作。每個(gè)智能體負(fù)責(zé)一塊子任務(wù),團(tuán)隊(duì)一起解決更大的問題。

但問題是:缺乏推理能力的“團(tuán)隊(duì)領(lǐng)導(dǎo)”會(huì)在復(fù)雜問題上一團(tuán)亂。目前大多數(shù)自主多智能體系統(tǒng)仍然不穩(wěn)定,成功率不到一半。

框架層面的支持可以緩解這點(diǎn),例如 Agno 提供的三種執(zhí)行模式:協(xié)調(diào)(coordinate)、路由(route)、協(xié)作(collaborate),搭配內(nèi)建記憶和上下文管理,能大大提高可行性。

... imports

web agent = Agent(
  name="Web Search Agent",  
  role="Handle web search requests", 
  model= OpenAIChat(id="gpt-4o-mini"),
  tools=[DuckDuckGoTools()],
  instructinotallow="Always include sources",
)

finance_agent= Agent(
  name="Finance Agent",
  role="Handle financial data requests",
  model=OpenAIChat(id="gpt-4o-mini"),
  tools=[YFinanceTools()],
  instructinotallow=[
    "You are a financial data specialist. Provide concise and accurate data.",
    "Use tables to display stock prices, fundamentals (P/E, Market Cap)",
  ],
)


team_leader = Team (
  name="Reasoning Finance Team Leader", 
  mode="coordinate",
  model=Claude(id="claude-3-7-sonnet-latest"),
  members=[web_agent, finance_agent],
  tools=[ReasoningTools(add_instructinotallow=True)],
  instructinotallow=[
    "Use tables to display data",
    "Only output the final answer, no other text.",
  ],
  show_members_respnotallow=True, 
  enable_agentic_cnotallow=True, 
  add_datetime_to_instructinotallow=True,
  success_criteria="The team has successfully completed the task.",
)


if __name__ == "__main__":
  team_leader.print_response(
    """\
    Analyze the impact of recent US tariffs on market performance across
these key sectors:
- Steel & Aluminum: (X, NUE, AA)
- Technology Hardware: (AAPL, DELL, HPQ)

For each sector:
1. Compare stock performance before and after tariff implementation
2. Identify supply chain disruptions and cost impact percentages
3. Analyze companies' strategic responses (reshoring, price adjustments, supplier
diversification)""",
  stream=True, 
  stream_intermediate_steps=True, 
  show_full_reasnotallow=True,
)

5.Level 5:智能體系統(tǒng)化(Agentic Systems)

到了這個(gè)級(jí)別,Agent 不再是“功能”或“助手”,而是整個(gè)系統(tǒng)的核心基礎(chǔ)設(shè)施。

Agentic Systems 就是全棧 API 系統(tǒng)——用戶發(fā)起請(qǐng)求,系統(tǒng)異步啟動(dòng)任務(wù),并在中途持續(xù)返回結(jié)果。

聽起來很酷,做起來很難。

你得做這些事:

  • 請(qǐng)求一來就持久化狀態(tài)
  • 啟動(dòng)后臺(tái)任務(wù)并跟蹤進(jìn)度
  • 實(shí)時(shí)推送輸出結(jié)果
  • 建立 websocket 或等效機(jī)制來流式更新

很多團(tuán)隊(duì)都低估了后端系統(tǒng)的復(fù)雜性。

要真正讓 Agent 落地為產(chǎn)品,你得從架構(gòu)層做起,不只是“做個(gè)功能”。

二、從失敗演示到真實(shí)落地:Agent 構(gòu)建的關(guān)鍵教訓(xùn)

構(gòu)建 AI Agent,不是疊 buzzword,不是玩“框架競(jìng)賽”,而是搞清楚基本功。

從最簡(jiǎn)單的工具使用,到異步系統(tǒng)集成,每一步都必須建立在扎實(shí)的設(shè)計(jì)之上。

絕大多數(shù)失敗都不是因?yàn)槿绷丝蚣?,而是沒打好基礎(chǔ):邊界不清晰、推理不可靠、記憶設(shè)計(jì)混亂、或是不知道何時(shí)應(yīng)該讓“人”來接手。

建議:從簡(jiǎn)單開始,按需加復(fù)雜性,不預(yù)先堆太多結(jié)構(gòu)。你就不會(huì)只造出個(gè)“酷玩意”,而是造出真正可用的智能體系統(tǒng)。

參考鏈接:https://medium.com/data-science-collective/ai-agents-in-5-levels-of-difficulty-with-full-code-implementation-15d794becfb8

責(zé)任編輯:武曉燕 來源: 51CTO技術(shù)棧
相關(guān)推薦

2025-07-03 06:39:16

2023-12-29 16:33:12

大規(guī)模語(yǔ)言模型人工智能

2025-05-14 07:00:00

智能體自主式AI

2025-05-20 08:00:45

2025-06-19 03:30:00

智能體DifyMCP

2024-11-26 00:14:08

2025-05-06 08:23:56

Llama 4AutoGenAI智能體

2024-11-18 19:06:21

2025-04-28 08:29:04

AIMCP智能體

2025-04-25 01:10:00

智能體AI人工智能

2023-07-05 15:18:42

AI自動(dòng)駕駛

2025-05-28 02:00:00

AI智能體文本

2024-01-29 01:26:22

AI進(jìn)程GAAM

2025-04-07 02:00:00

2013-01-10 09:53:40

智能手表PebbleCES 2013

2022-08-18 15:08:16

智能AI

2024-11-29 20:41:21

點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)