Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

subagents

БесплатноБез исполняемых скриптовНе проверен

Imported skill subagents from langchain

majiayu000от majiayu000★ 31 звезда на GitHub

Об этом скилле

"""Middleware for providing subagents to an agent via a task tool."""

from collections.abc import Awaitable, Callable, Sequence from typing import Any, NotRequired, TypedDict, cast

from langchain.agents import create_agent from langchain.agents.middleware import HumanInTheLoopMiddleware, InterruptOnConfig from langchain.agents.middleware.types import AgentMiddleware, ModelRequest, ModelResponse from langchain.tools import BaseTool, ToolRuntime from langchain_core.language_models import BaseChatModel from langchain_core.messages import HumanMessage, ToolMessage from langchain_core.runnables import Runnable from langchain_core.tools import StructuredTool from langgraph.types import Command

from deepagents.middleware._utils import append_to_system_message

class SubAgent(TypedDict): """Specification for an agent.

When specifying custom agents, the `default_middleware` from `SubAgentMiddleware`
will be applied first, followed by any `middleware` specified in this spec.
To use only custom middleware without the defaults, pass `default_middleware=[]`
to `SubAgentMiddleware`.

Required fields:
    name: Unique identifier for the subagent.

        The main agent uses this name when calling the `task()` tool.
    description: What this subagent does.

        Be specific and action-oriented. The main agent uses this to decide when to delegate.
    system_prompt: Instructions for the subagent.

        Include tool usage guidance and output format requirements.
    tools: Tools the subagent can use.

        Keep this minimal and include only what's needed.

Optional fields:
    model: Override the main agent's model.

        Use the format `'provider:model-name'` (e.g., `'openai:gpt-4o'`).
    middleware: Additional middleware for custom behavior, logging, or rate limiting.
    interrupt_on: Configure human-in-the-loop for specific tools.

        Requires a checkpointer.
"""

name: str
"""Unique identifier for the subagent."""

description: str
"""What this subagent does. The main agent uses this to decide when to delegate."""

system_prompt: str
"""Instructions for the subagent."""

tools: Sequence[BaseTool | Callable | dict[str, Any]]
"""Tools the subagent can use."""

model: NotRequired[str | BaseChatModel]
"""Override the main agent's model. Use `'provider:model-name'` format."""

middleware: NotRequired[list[AgentMiddleware]]
"""Additional middleware for custom behavior."""

interrupt_on: NotRequired[dict[str, bool | InterruptOnConfig]]
"""Configure human-in-the-loop for specific tools."""

class CompiledSubAgent(TypedDict): """A pre-compiled agent spec.

!!! note

    The runnable's state schema must include a 'messages' key.

    This is required for the subagent to communicate results back to the main agent.

When the subagent completes, the final message in the 'messages' list will be
extracted and returned as a `ToolMessage` to the parent agent.
"""

name: str
"""Unique identifier for the subagent."""

description: str
"""What this subagent does."""

runnable: Runnable
"""A custom agent implementation.

Create a custom agent using either:

1. LangChain's [`create_agent()`](https://docs.langchain.com/oss/python/langchain/quickstart)
2. A custom graph using [`langgraph`](https://docs.langchain.com/oss/python/langgraph/quickstart)

If you're creating a custom graph, make sure the state schema includes a 'messages' key.
This is required for the subagent to communicate results back to the main agent.
"""

DEFAULT_SUBAGENT_PROMPT = "In order to complete the objective that the user asks of you, you have access to a number of standard tools."

State keys that are excluded when passing state to subagents and when returning

updates from subagents.

When returning updates:

1. The messages key is handled explicitly to ensure only the final message is included

2. The todos and structured_response keys are excluded as they do not have a defined reducer

and no clear meaning for returning them from a subagent to the main agent.

_EXCLUDED_STATE_KEYS = {"messages", "todos", "structured_response"}

TASK_TOOL_DESCRIPTION = """Launch an ephemeral subagent to handle complex, multi-step independent tasks with isolated context windows.

Available agent types and the tools they have access to: {available_agents}

When using the Task tool, you must specify a subagent_type parameter to select which agent type to use.

Usage notes:

  1. Launch multiple agents concurrently whenever possible, to maximize performance; to do that, use a single message with multiple tool uses
  2. When the agent is done, it will return a single message back to you. The result returned by the agent is not visible to the user. To show the user the result, you should send a text message back to the user with a concise sum
Полный SKILL.md на GitHub

Установить subagents в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

metadata.json

FAQ

Что делает скилл subagents?

Imported skill subagents from langchain

Как установить скилл subagents?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл subagents запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить subagents с