NOTE

AI Agents

Understand AI agents through tool use, planning, the ReAct pattern, and the challenges of reliable multi-step execution.

AIUpdated 2 min read

AI Agents

What It Is

  • A system that observes its environment, makes decisions, uses tools, and acts toward a goal.

Why It Is Needed

  • Limitations of a standalone LLM call
    • It generally generates answers using the context already provided
    • Text generation alone cannot perform actions in external systems
  • Limitations of predefined workflows
    • Developers must define the execution path in advance
    • Hard to handle unexpected situations
  • What agents add
    • Dynamic decision-making
    • Use tools to retrieve information and perform actions
    • Adapt subsequent actions based on observed results
    • Autonomously complete multi-step tasks

How to Implement It

  • Agentic Design Patterns
    • ReAct
      • How to Implement It
      • What It Is
        • A pattern that alternates reasoning and acting
        • An agentic pattern that alternates model reasoning with external actions, rather than relying solely on a single internal plan or answer.
      • How it works
        • Reasoning
          • Decide the next step based on the task and current state
        • Action
          • Take an action or invoke a tool
        • Observation
          • Observe the tool result
        • Reasoning
          • Revise the next steps using newly observed information
        • Repeat until the goal is reached or a stopping condition is met
    • Other
      • Andrew NG
        • Four Agentic Design Patterns
          • Reflection
            • Evaluation findings
            • Revision of results or plans based on feedback
          • Planning
            • Disaggregation of tasks into steps
            • Adjustment of plans to results of implementation
          • Tool Use (tool use)
            • Let the model call external tools for information or perform operations
          • Multi-Agent Corporation (Multi-Intelligence Collaboration)
            • Get multiple intelligents to do their job.
        • Different from React.
          • Multi-Agent
      • Other
        • Original XMind illustration
      • Prompt Chaining
        • Core Mechanisms
          • Multiple LLM calls executed in a fixed order
          • Analogies in Traditional Engineering
            • Pipeline
          • Use Cases
            • Translation
            • Content treatment of water currents
      • Routing
        • Core Mechanisms
          • Selecting different processing branches according to mandate
        • Analogies in Traditional Engineering
          • Router
          • Policy Mode
        • Use Cases
          • Select a model or Agent by task type
      • Parallelization
        • Core Mechanisms
          • Separate sub-missions handled in parallel and aggregated
        • Analogies in Traditional Engineering
          • Fan-out/Fan-in
          • MapReduce
        • Use Cases
          • Parallel analysis
          • Code Review
      • Planner–Executor
        • Core Mechanisms
          • Mr. Plan, implement and adjust.
        • Analogies in Traditional Engineering
          • Workstream engine
          • Task Scheduler
        • Use Cases
          • Complex multi-step tasks
      • Evaluator–Optimizer
        • Core Mechanisms
          • Generate → Rating → Modify → Rescoring
        • Analogies in Traditional Engineering
          • Test feedback loop
        • Use Cases
          • Code Generation
          • Content Optimization
      • Orchestrator–Workers
        • Core Mechanisms
          • Main Agent dynamic decomposition task assigned to Agent
        • Analogies in Traditional Engineering
          • Master–Worker
        • Use Cases
          • Complex multidisciplinary tasks
      • Multi-Agent Collaboration
        • Core Mechanisms
          • Multi-Agent consultations, interaction, joint decision-making
        • Analogies in Traditional Engineering
          • Actor
          • Distributive collaboration
        • Use Cases
          • Multi-role discussion
          • Joint research
      • Human-in-the-Loop
        • Core Mechanisms
          • Introduce manual confirmation in key decisions or actions
        • Analogies in Traditional Engineering
          • Manual approval of workflows
        • Use Cases
          • High-risk operations
          • Production Publication
  • Core Components
    • Environment
      • What It Is
        • Intelligence is in the environment.
      • Environmental feedback
        • Observation
          • Observations returned by environment or tool
    • Tools
      • Classification
        • Knowledge enhancement
          • What It Is
            • Retrieve External Information
            • Search, SQL Query, Document Search
        • Capacity development
          • What It Is
            • Bridging the lack of modelling capacity
            • Calculator, Code Executor
        • Writing Action
          • What It Is
            • Modify the external environment
            • Modify files, send mail, update data Library
      • What It Is
        • External capability interface for Agent
      • How to Call
        • Function Calling
          • Process
            • Modelled Tool Call
            • Run-on-dol
            • Return Tool Result
            • Add the result to Context
    • Planning
      • What It Is
        • Selection of actions based on objective, constraints and state of the environment
      • Planning strategy
        • Separation of planning and implementation
        • Planned particle size
        • Layer planning
      • Rethinking and miscorrection
        • Inspection plan
        • Check implementation results
        • Reprogramming as necessary
  • Harness

How to Optimize It

  • Common Failure Modes
    • Planning Failures
      • Error selection tool, parameter error, target not completed
    • Tool-Use Failures
      • Error in tool execution, return error results, lack of necessary tools
    • Efficiency and Cost Problems
      • Too many steps, too long implementation time, too much cost High

Discussion

Sign in with GitHub to comment. Discussions are stored as GitHub Issues.View on GitHub