Agent Executors
info
为了让智能代理更加强大,我们需要使其迭代,即调用模型多次,直到达到最终答案。这就是 AgentExecutor 的工作。
class AgentExecutor {
  // a simplified implementation
  run(inputs: object) {
    const steps = [];
    while (true) {
      const step = await this.agent.plan(steps, inputs);
      if (step instanceof AgentFinish) {
        return step.returnValues;
      }
      steps.push(step);
    }
  }
}
📄️ 开始(Getting Started)
代理使用LLM来确定采取哪些操作以及采取的顺序。操作可以是使用工具并观察其输出,或返回给用户。