跳到正文
Skillpedia
智能体48k · #5256

multi-agent-architect

它能做什么

这个 AI 智能体可以帮你搭建和改进由多个智能体组成的复杂 AI 系统。它使用 LangGraph 和 LangChain 等工具来组织不同 AI“智能体”之间的分工,确保它们有效沟通、协同合作,共同完成目标。

适用场景

  • ✓从零开始创建一个新的多智能体 AI 系统时。
  • ✓组织不同 AI 智能体之间的通信与工作流程时。
  • ✓使用 LangGraph 或 LangChain 调试或优化现有 AI 系统时。

技能链接

https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/multi-agent-architect/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/sickn33/agentic-awesome-skills/blob/main/plugins/agentic-awesome-skills-claude/skills/multi-agent-architect/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“帮我创建一个 AI 系统,包含一个研究智能体和一个编程智能体,协助我撰写一篇关于太阳能的论文。”

每周 5 个新技能,1 分钟读完。

工作原理

它的工作方式是:先定义每个智能体的角色(比如主管、研究员、程序员),再确定它们如何共享信息(状态)以及如何沟通。然后把这些部分组装成一张“图”,由它来规定工作流程。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Multi-Agent Architect & Updater Skill

Overview

This skill turns Claude into a Senior AI Multi-Agent Architect specialized in LangGraph, LangChain, and DeepAgents. It provides structured workflows for creating and updating production-grade multi-agent systems — including supervisor agents, planners, researchers, coders, and memory-backed autonomous pipelines. Use it whenever you need to design, build, debug, or scale any multi-agent AI system.

If this skill adapts material from an external GitHub repository, declare both:

  • source_repo: owner/repo
  • source_type: official or source_type: community

When to Use This Skill

  • Use when you need to create a new agent or multi-agent workflow from scratch
  • Use when working with LangGraph state graphs, nodes, edges, or conditional routing
  • Use when the user asks about agent communication, memory systems, or tool-calling pipelines
  • Use when debugging or optimizing an existing LangChain/LangGraph agent system
  • Use when architecting supervisor, planner, research, coding, or validation agent roles
  • Use when integrating DeepAgents with hierarchical planning and delegation

How It Works

Step 1: Understand the Goal

Before writing any code, clarify:

  • What is the business objective this agent system must achieve?
  • What agent roles are needed (supervisor, planner, researcher, coder, validator)?
  • What tools does each agent require?
  • What memory strategy is needed (Redis, Vector DB, LangChain Memory)?
  • What communication protocol connects agents (shared state, message passing)?

Step 2: Define the State Schema

All agents share a typed state object passed through the graph:

from typing import TypedDict

class AgentState(TypedDict):
    user_goal: str
    tasks: list[str]
    completed_tasks: list[str]
    next_agent: str
    context: dict
    step_count: int          # guards against infinite loops
    error: str | None

Step 3: Define Agent Nodes

Each agent is an async function that reads from state and returns an updated state:

import logging
from langchain_openai import ChatOpenAI

logger = logging.getLogger(__name__)

async def research_node(state: AgentState) -> AgentState:
    logger.info("research_node: starting")
    llm = ChatOpenAI(model="gpt-4o")
    result = await llm.bind_tools(research_tools).ainvoke(state["user_goal"])
    state["context"]["research"] = result.content
    state["next_agent"] = "coder"
    return state

Step 4: Build the LangGraph

Wire nodes together with edges and conditional routing:

from langgraph.graph import StateGraph, END
from langgraph.prebuilt import ToolNode

def build_graph() -> StateGraph:
    graph = StateGraph(AgentState)

    graph.add_node("supervisor", supervisor_node)
    graph.add_node("research",   research_node)
    graph.add_node("coder",      coding_node)
    graph.add_node("validator",  validation_node)
    graph.add_node("tools",      ToolNode(all_tools))

    graph.set_entry_point("supervisor")

    graph.add_conditional_edges(
        "supervisor",
        route_next,
        {"research": "research", "coder": "coder", "end": END}
    )

    graph.add_edge("research",  "supervisor")
    graph.add_edge("coder",     "validator")
    graph.add_edge("validator", "supervisor")

    return graph.compile()

def route_next(state: AgentState) -> str:
    if state["step_count"] > 20:
        return "end"
    return state["next_agent"]

Step 5: Add Memory

from langchain_community.chat_message_histories import RedisChatMessageHistory

def get_memory(session_id: str):
    return RedisChatMessageHistory(
        session_id=session_id,
        url=os.getenv("REDIS_URL"),
        ttl=3600
    )

Step 6: Run the Graph

async def run(user_goal: str, session_id: str):
    graph = build_graph()
    initial_state = AgentState(
        user_goal=user_goal,
        tasks=[],
        completed_tasks=[],
        next_agent="supervisor",
        context={},
        step_count=0,
        error=None,
    )
    return await graph.ainvoke(initial_state)

Step 7: Expose via FastAPI (optional)

from fastapi import FastAPI
from pydantic import BaseModel

app = FastAPI()

class RunRequest(BaseModel):
    goal: str
    session_id: str

@app.post("/run")
async def run_agent(req: RunRequest):
    result = await run(req.goal, req.session_id)
    return {"result": result}

…

常见问题

这里的“智能体”是什么意思?

智能体就像是专门分工的 AI 工作者。每个智能体都有特定任务,比如搜集资料、编写代码或验证结果。

LangGraph 和 LangChain 是什么?

它们是用来搭建和管理多智能体系统的工具。LangGraph 负责组织工作流程和通信,LangChain 则帮助连接不同的 AI 组件。

智能体之间如何沟通?

它们共享一个“状态”,其中保存着相关信息,比如用户的目标、已完成的任务和上下文。这样每个智能体都掌握了完成工作所需的信息。

详情

作者的原始描述

Design and optimize production-grade multi-agent systems with LangGraph, LangChain, and DeepAgents for complex AI workflows.

repo: sickn33/agentic-awesome-skills

热度

GitHub 星标
48k
排名
#5256
许可证
MIT
更新时间
2026/10/15

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能