{"id":25193837,"url":"https://github.com/qtencent7/agent-thinking-process","last_synced_at":"2025-06-26T17:32:27.658Z","repository":{"id":276628519,"uuid":"929807114","full_name":"qtencent7/agent-thinking-process","owner":"qtencent7","description":"公开类似langchain，crewai，phidata这类agent framework的搭建思路，还原从0到1，从1到100的agentic framework构建过程","archived":false,"fork":false,"pushed_at":"2025-03-13T07:40:24.000Z","size":5726,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-04T13:45:11.533Z","etag":null,"topics":["agent","agentframework","chatglm","crewai","langchain","llm","openai","phidata"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/qtencent7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-09T13:02:33.000Z","updated_at":"2025-03-13T07:40:29.000Z","dependencies_parsed_at":"2025-04-04T13:41:34.429Z","dependency_job_id":null,"html_url":"https://github.com/qtencent7/agent-thinking-process","commit_stats":null,"previous_names":["qtencent7/agent-thinking-process"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/qtencent7/agent-thinking-process","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtencent7%2Fagent-thinking-process","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtencent7%2Fagent-thinking-process/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtencent7%2Fagent-thinking-process/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtencent7%2Fagent-thinking-process/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/qtencent7","download_url":"https://codeload.github.com/qtencent7/agent-thinking-process/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/qtencent7%2Fagent-thinking-process/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262113446,"owners_count":23261030,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agent","agentframework","chatglm","crewai","langchain","llm","openai","phidata"],"created_at":"2025-02-09T23:22:45.736Z","updated_at":"2025-06-26T17:32:27.632Z","avatar_url":"https://github.com/qtencent7.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# agent仓库简要说明\n\n1，本仓库总目标是构建一个类似[langchain](https://www.langchain.com/)，[crewai](https://docs.crewai.com/introduction)，[phidata](https://docs.phidata.com/introduction)这样的agent framework。\n2，本仓库的目标是一步步从最基本的类智能体跑通，到建立智能体的基本概念，到组成成一个基本的智能体，到构建更加健壮，更加灵活，更加可扩展的智能体框架。初始版本就是v1.py，每一个版本都基于上一个版本进行迭代，力图让观众能更加简单，易懂的看懂思路。\n注：我曾经尝试过去读懂类似crewai这样的仓库，但是其实概念甚多，之间交互关系错综复杂，因此放弃了。于是决定试着写一个智能体框架，**公开思考的过程**\n\n## v1.py版本的思路介绍\n智能体就是一个能够调用工具的系统，工具可以理解为函数，要把llm和函数联系起来，就是说，llm具备调用函数的能力，这里我们用到了openai python库的function call功能。\n\nfunction call功能简介：\nfunction call实际上就是给大模型传一个参数对象，这个对象包含函数名，函数功能表述，函数参数表述。大模型能根据prompt信息，结合function call的参数对象，在prompt中抽取函数参数，给函数去执行。\n\n举个例子，比如，prompt是“从伦敦到巴黎的航班最近一班是几点的”，这个时候，函数是查询航班信息的，查询航班信息需要知道起点，终点。因此，大模型可以从prompt中抽取起点和终点，“伦敦”，“巴黎”，然后以一个参数对象的形式给到你，你就可以去调用接口执行查询航班的API请求了。\n\n这样就是构建了一个智能体\n\n## v2.py版本的思路介绍\nv2版本在v1版本之上，增加了agent的概念，让所有的变量，函数都集中在agent这个类里面，传入参数，实现agent的初始化。后面，调用agent的run方法，就可以实现agent的运行。\n\nv2版本的agent类有四个参数：\n\n1，model：大模型的模型名\n\n2，prompt：总的提示词\n\n3，llm：openai发起请求的客户端\n\n4，tool：智能体需要调用的工具\n\n## v3.py版本的思路介绍\nv3版本在v2版本之上，整合了tool相关的概念，增加了一个tool类，将函数参数模板生成，注册工具执行函数，获取工具执行函数，都整合到一个类里面，使得管理更加精细。\n\n## v4版本的思路介绍\n将agent，tool都抽离成单独的文件，方便后续管理\n\n## v5版本的思路介绍\n该版本调整agent的调用逻辑，使得agent可以灵活顺序调用多个tool，例子中实现了调用两个tool。新增tool类，可以管理多个tool实例。\n\n## v6版本的思路介绍\n1，增加自定义工具的功能，新增BaseTool类\n\n2，通用化工具的创建过程，参数传递，function call模板创建这些东西，使之更加通用。\n\n3，新增网页搜索，摘要总结的两个tool，跑通agent\n\n## v7版本的思路介绍\n1，先在test1.py中试验，跑通llm中用rag的整个流程\n\n2，然后，在v7文件夹下，新增chroma_db_rag.py这个文件，在里面对rag进行封装，调试agent，使之跑通。\n\n3，优化这部分代码，使之和之前的tool功能更加和谐\n\n## v8版本的思路介绍\n1，整个依照langchain，重构。\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtencent7%2Fagent-thinking-process","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fqtencent7%2Fagent-thinking-process","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fqtencent7%2Fagent-thinking-process/lists"}