Token导航 LogoToken导航TokenDH.com
AI 工具权限需确认github未标认证来源可访问clear审计异常

agent-loopsAgent 循环

Agent Skill

agent-loops 用于处理 GitHub 仓库、Issue、Pull Request 和代码协作信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要围绕仓库状态、代码变更或协作事项进行整理时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

356

周安装

15

GitHub Stars

160

下载量

125
CodexClaudeCursorGemini CLI

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

3

许可证

MIT

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:agent-loops(Agent 循环)
来源仓库:https://github.com/yonatangross/orchestkit
仓库路径:skills/agent-loops
安装命令:
npx skills add https://github.com/yonatangross/orchestkit --skill agent-loops
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。不同来源提供的安装方式可能略有差异;本站展示可直接复制的安装命令,安装前请核对来源页面。

skills.shnpx skills
npx skills add https://github.com/yonatangross/orchestkit --skill agent-loops

简介

Agent Loops 使大语言模型具备自主推理、规划和行动的能力,支持 ReAct 模式(推理+行动)。

  • 适用于需要分步推理、工具调用或自动化决策的场景。
  • 提供历史记录追踪、工具调用和执行循环控制等核心功能。
  • 安装前建议确认环境依赖和维护状态,可能涉及本地命令执行。
  • agent-loops 属于AI 工具类 Skill,可作为该场景下的辅助能力补充。

SKILL.md

Agent Loops

Enable LLMs to reason, plan, and take autonomous actions.

ReAct Pattern (Reasoning + Acting)

REACT_PROMPT = """You are an agent that reasons step by step.

For each step, respond with:
Thought: [your reasoning about what to do next]
Action: [tool_name(arg1, arg2)]
Observation: [you'll see the result here]

When you have the final answer:
Thought: I now have enough information
Final Answer: [your response]

Available tools: {tools}

Question: {question}
"""

async def react_loop(question: str, tools: dict, max_steps: int = 10) -> str:
    """Execute ReAct reasoning loop."""
    history = REACT_PROMPT.format(tools=list(tools.keys()), question=question)

    for step in range(max_steps):
        response = await llm.chat([{"role": "user", "content": history}])
        history += response.content

        # Check for final answer
        if "Final Answer:" in response.content:
            return response.content.split("Final Answer:")[-1].strip()

        # Extract and execute action
        if "Action:" in response.content:
            action = parse_action(response.content)
            result = await tools[action.name](*action.args)
            history += f"\nObservation: {result}\n"

    return "Max steps reached without answer"

Plan-and-Execute Pattern

async def plan_and_execute(goal: str) -> str:
    """Create plan first, then execute steps."""
    # 1. Generate plan
    plan = await llm.chat([{
        "role": "user",
        "content": f"Create a step-by-step plan to: {goal}\n\nFormat as numbered list."
    }])

    steps = parse_plan(plan.content)
    results = []

    # 2. Execute each step
    for i, step in enumerate(steps):
        result = await execute_step(step, context=results)
        results.append({"step": step, "result": result})

        # 3. Check if replanning needed
        if should_replan(results):
            return await plan_and_execute(
                f"{goal}\n\nProgress so far: {results}"
            )

    # 4. Synthesize final answer
    return await synthesize(goal, results)

Self-Correction Loop

async def self_correcting_agent(task: str, max_retries: int = 3) -> str:
    """Agent that validates and corrects its own output."""
    for attempt in range(max_retries):
        # Generate response
        response = await llm.chat([{
            "role": "user",
            "content": task
        }])

        # Self-validate
        validation = await llm.chat([{
            "role": "user",
            "content": f"""Validate this response for the task: {task}

Response: {response.content}

Check for:
1. Correctness - Is it factually accurate?
2. Completeness - Does it fully answer the task?
3. Format - Is it properly formatted?

If valid, respond: VALID
If invalid, respond: INVALID: [what's wrong and how to fix]"""
        }])

        if "VALID" in validation.content:
            return response.content

        # Correct based on feedback
        task = f"{task}\n\nPrevious attempt had issues: {validation.content}"

    return response.content  # Return best attempt

Memory Management

class AgentMemory:
    """Sliding window memory for agents."""

    def __init__(self, max_messages: int = 20):
        self.messages = []
        self.max_messages = max_messages
        self.summary = ""

    def add(self, role: str, content: str):
        self.messages.append({"role": role, "content": content})

        # Summarize old messages when window full
        if len(self.messages) > self.max_messages:
            self._compress()

    def _compress(self):
        """Summarize oldest messages."""
        old = self.messages[:10]
        self.messages = self.messages[10:]

        # Async summarize would be better
        summary = summarize(old)
        self.summary = f"{self.summary}\n{summary}"

    def get_context(self) -> list:
        """Get messages with summary prefix."""
        context = []
        if self.summary:
            context.append({
                "role": "system",
                "content": f"Previous context summary: {self.summary}"
            })
        return context + self.messages

Key Decisions

DecisionRecommendation
Max steps5-15 (prevent infinite loops)
Temperature0.3-0.7 (balance creativity/focus)
Memory window10-20 messages
ValidationEvery 3-5 steps

Common Mistakes

  • No step limit (infinite loops)
  • No memory management (context overflow)
  • No error recovery (crashes on tool failure)
  • Over-complex prompts (agent gets confused)

Related Skills

  • function-calling - Tool definitions and execution
  • multi-agent-orchestration - Coordinating multiple agents
  • langgraph-workflows - Stateful agent graphs

Capability Details

react-loop

Keywords: react, reason, act, observe, loop Solves:

  • Implement ReAct pattern
  • Create reasoning loops
  • Build iterative agents

tool-use

Keywords: tool, function, call, execution Solves:

  • Implement tool calling
  • Execute functions from LLM
  • Parse tool responses

workflow-template

Keywords: template, workflow, agent, typescript Solves:

  • Agent workflow template
  • TypeScript implementation
  • Copy-paste starter

适合场景

01

用户想查找某类 Agent Skill 时

02

需要根据任务场景推荐可安装能力包时

03

需要对比不同来源的安装命令和来源信息时

04

需要参考平台分布和安装热度时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

Claude Code

26.37%
按下载量换算33

windsurf

22.48%
按下载量换算28

Gemini CLI

17.13%
按下载量换算21

Antigravity

11.24%
按下载量换算14

trae

8.19%
按下载量换算10

OpenCode

3.65%
按下载量换算5

安全审计

Gen Agent Trust Hub

未通过

Socket

通过

Snyk

可疑

权限和风险

权限需确认

当前来源未能明确判断权限范围,默认进入异常复核队列。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。

来源信息

继续浏览同类 Skills