LLM

llm/agent agent-zero初步搭建与使用

Agent-Zero AI Agent 框架入门教程,介绍 Docker 部署方式、模型配置、工具调用以及初步使用体验,包括搜索功能测试与问题排查。

官网

使用docker启动

  • 拉取docker镜像
docker pull agent0ai/agent-zero:latest

国内镜像加速(下面的镜像加速可能会过期,建议找一个镜像网站加速)

docker pull swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/agent0ai/agent-zero:latest
  • 拉取完成之后可以启用(注意不要使用80端口,否则会报错)
docker run -p 8080:80 swr.cn-north-4.myhuaweicloud.com/ddn-k8s/docker.io/agent0ai/agent-zero:latest

配置模型

  • 配置api key
  • 配置模型
  • 对话
  • 调用工具
    可以让它搜下新闻
    帮我搜索下今天deepseek有什么新闻
    
    Thoughts    
    The user is asking me to check for news about Deepseek today (2026-04-19).
    This requires searching the web for current information about Deepseek.
    I should use the search_engine tool to find recent news articles or updates about Deepseek.
    After getting search results, I can analyze them and present the most relevant information to the user.
    I'll need to search in Chinese since the user asked in Chinese, but I should also check English sources for comprehensive coverage.
    Headline    Searching for today's Deepseek news
    Tool Name   search_engine
    Query   Deepseek 新闻 2026年4月19日
    

    然后直接报错了(版本Version M v0.9.7-10 25-11-19 11:38)
    Traceback (most recent call last):
    Traceback (most recent call last):
      File "/a0/agent.py", line 450, in monologue
        tools_result = await self.process_tools(agent_response)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/a0/agent.py", line 835, in process_tools
        response = await tool.execute(**tool_args)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/a0/python/tools/search_engine.py", line 16, in execute
        searxng_result = await self.searxng_search(query)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/a0/python/tools/search_engine.py", line 27, in searxng_search
        return self.format_result_searxng(results, "Search Engine")
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/a0/python/tools/search_engine.py", line 35, in format_result_searxng
        for item in result["results"]:
                    ~~~~~~^^^^^^^^^^^
    KeyError: 'results'
    
    
    KeyError: 'results'
    

    直接把印象拉到最低,唉,感觉也是个玩具

初步印象

  • 语言:python
  • 运行环境:docker
    对于agent的命令执行相对安全点,但是好像看到权限管理,可能在docker里就不太在意? 我让他把目录删除,真就全删了
    帮我把openfang-go目录删除
    
    Thoughts    
    The user wants me to delete the openfang-go directory.
    This is a large Go project with many files and subdirectories.
    I should use the code_execution_tool with terminal runtime to remove the directory.
    I need to be careful to only delete the openfang-go directory and not other project files.
    I'll use the rm -rf command to recursively remove the directory and all its contents.
    First, I should check the current directory to ensure I'm in the right location.
    Headline    
    Deleting openfang-go directory
    Tool Name   
    code_execution_tool
    Runtime 
    terminal
    Session 
    0
    Code    
    
    content_copy
    
    volume_up
    pwd && ls -la /a0/usr/projects/project_1/ && echo '\nRemoving openfang-go directory...' && rm -rf /a0/usr/projects/project_1/openfang-go && echo 'Directory removed successfully' && ls -la /a0/usr/projects/project_1/
    
     操作完成
    
    openfang-go目录已成功删除
    
    📊 执行结果
    目录位置: /a0/usr/projects/project_1/openfang-go/
    删除状态: 成功
    当前项目内容:
    .a0proj/ - 项目配置文件夹(保留)
    其他文件:无
    🔍 验证信息
    删除前:包含openfang-go目录
    删除后:仅剩.a0proj配置文件夹
    操作时间:2026-04-20 00:22:40
    💡 后续建议
    
    项目目录现已清空,您可以:
    
    添加新项目文件 - 开始新的开发工作
    导入其他项目 - 将现有项目复制到此目录
    配置项目设置 - 修改.a0proj中的项目配置
    
    是否需要我协助您进行下一步操作?
    
  • UI界面
    正常水平吧
  • 多模型支持
    支持配置不同性能的模型,这对于不同场景下的需求比较有帮助,可以一定程度降低成本
  • 知识库支持
    支持配置知识库,这对于需要引用外部信息的任务比较有帮助