Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ANCHOR: Reality-Grounded Long-Horizon Planning for AI Agents

What is ANCHOR?

ANCHOR is a Python library designed to empower AI agents with the critical ability to plan, execute, and adapt in dynamic, unpredictable real-world environments. Traditional AI planning often operates in a vacuum, generating static plans that quickly become irrelevant when reality diverges from expectations. ANCHOR addresses this fundamental challenge by integrating mechanisms for drift detection and adaptive replanning directly into the agent's planning loop.

Part of the larger GENESIS project by Veya Noir (veyanoir.ai), ANCHOR represents a significant step towards more robust, autonomous, and truly intelligent agents capable of navigating complex, long-horizon tasks.


Why ANCHOR Matters for AGI

The pursuit of Artificial General Intelligence (AGI) hinges on an agent's ability to operate effectively in the real world. A key limitation of current AI systems is their fragility when faced with unexpected outcomes. ANCHOR provides a framework for:

  • Robustness: Plans are not brittle; they can withstand unforeseen circumstances.
  • Autonomy: Agents can self-correct and continue striving towards their goals without constant human intervention.
  • Efficiency: By detecting drift early, agents can replan strategically, avoiding wasted effort on irrelevant paths.
  • Learning from Experience: The drift detection mechanism can inherently provide signals for learning what works and what doesn't in a given environment.

Architecture Diagram

+--------------------+        +---------------------+
|    AI Agent Goal   |<-------|  Planner (LLM)      |
+--------------------+        |  (Generates Plan)   |
          |                     +----------+----------+
          | A. New Plan Request            | (Plan, List[Step])
          v                                V
+-----------+--------------------------------+------------+
|           |                                             |
|        ANCHOR Session Manager                           |
|           | (Manages Plan Lifecycle, Orchestrates)      |
+-----------+--------------------------------+------------+
          |                                  ^
          | B. Execute Step                  | D. Replanned Steps
          v                                  |
+-----------+----------+                     |
|  Executor            |                     |
|  (Tracks Step Status)|                     |
+----------+-----------+                     |
          | (Actual Outcome)                   | (Updated Plan)
          v                                  ^
+-----------+----------+                     |
|  Drift Detector      |<--------------------+
|  (Compares Expected  | (Drift Score > Threshold)
|   vs. Actual Outcome)|
+----------+-----------+
          | (Drift Analysis)
          v
+-----------+----------+
|  Replanner (LLM)     |
|  (Generates Updated  |
|   Plan with Context) |
+----------------------+

Quick Start

Installation

ANCHOR requires Python 3.11+ and an Anthropic API key.

  1. Set your Anthropic API Key:

    export ANTHROPIC_API_KEY="YOUR_ANTHROPIC_API_KEY"

    (Replace with your actual key. This is required for the Planner and Replanner.)

  2. Clone the repository:

    git clone https://github.com/veyanoir-ai/anchor.git
    cd anchor
  3. Install the package:

    pip install .

Usage

The anchor CLI provides a simple interface to interact with the ANCHOR system.

  1. Create a new plan:

    anchor new --goal "Develop a simple task management web application"

    This will output a new plan with multiple steps, each having an id, description, and expected_outcome.

    --- Plan ID: [PLAN-ID] ---
    Goal: Develop a simple task management web application
    Created At: 2023-10-27 10:00:00
    Status: ACTIVE
    Steps:
      Step 1 (ID: XXXXXXXX...)
        Description: Define core features and user stories
        Expected: A clear list of features and user stories for the application.
        Actual: N/A
        Status: PENDING
        Drift Score: N/A
      ...
    
  2. Check the status of a plan:

    anchor status --plan-id [PLAN-ID]
  3. Mark a step as complete (and potentially trigger replanning): Let's say step 1 was: "Define core features and user stories", with expected outcome: "A clear list of features and user stories for the application."

    # Scenario 1: Step completed successfully, outcome matches expectations
    anchor complete --plan-id [PLAN-ID] --step 1 --outcome "Defined core features including user login, task creation, and task editing based on 3 user stories."
    
    # Scenario 2: Drift detected! Outcome significantly different, triggering a replan
    anchor complete --plan-id [PLAN-ID] --step 1 --outcome "User stories were too broad, decided to pivot to only task creation and viewing for MVP."

    If drift is detected (i.e., the actual_outcome is semantically different enough from expected_outcome beyond the configured threshold), ANCHOR will automatically call the Replanner to update the subsequent steps of the plan, printing the revised plan.

  4. Manually trigger a replan: You can force a replan from a specific step if you realize the current plan is no longer suitable.

    anchor replan --plan-id [PLAN-ID] --step 2 --motivation "Market changed, need to prioritize different features from this point."

The Problem: AI Plans in a Vacuum

Current AI agents, while powerful, often struggle with long-horizon tasks because they inherently plan in a vacuum. They generate a sequence of actions based on an initial understanding of the world, but they lack mechanisms to:

  1. Monitor Reality: They don't consistently check if their actions produced the expected outcome.
  2. Detect Divergence: When reality differs from the plan, they often fail to notice or quantify this "drift."
  3. Adaptive Course Correction: Without detecting divergence, they cannot adapt their plan, leading to sub-optimal paths, wasted effort, or outright failure.

This disconnect between idealized plans and messy reality is a major bottleneck for achieving truly autonomous and intelligent behavior.

How ANCHOR Solves This

ANCHOR introduces a continuous feedback loop that grounds AI planning in reality:

  1. LLM-Powered Plan Generation: The Planner creates a detailed, multi-step plan with explicit expected_outcome for each step, leveraging large language models for high-level reasoning.
  2. Execution and Outcome Recording: As the agent (or human) executes each step, the Executor records the actual_outcome.
  3. Reality-Grounding through Drift Detection: The DriftDetector quantitatively compares the expected_outcome with the actual_outcome. Using semantic similarity, it calculates a drift_score. If this score exceeds a configurable threshold, it signals a significant divergence from the plan.
  4. Adaptive Replanning: Upon significant drift, the Replanner (also an LLM-powered component) is invoked. It takes the original goal, the completed steps, the drifted step's details, and the new real-world context into account to generate an updated, adaptive plan. This ensures the agent is always working with a plan relevant to the current state of the world.

By continuously sensing reality, detecting deviations, and adaptively replanning, ANCHOR enables AI agents to maintain coherence and effectiveness over long time horizons, even in dynamic and unpredictable environments.


Benchmark Results

(Placeholder: Benchmark results will be inserted here after extensive testing against various long-horizon tasks. This section will typically include average plan quality, drift detection accuracy, and replanning efficiency metrics.)

{
    "timestamp": "2023-11-01T14:30:00Z",
    "model_used": "claude-3-opus-20240229",
    "drift_detection_threshold": 0.4,
    "benchmark_results": {
        "Deploy a web application to a Kubernetes cluster": {
            "plan_quality": 0.85,
            "drift_incidents": 2,
            "generated_plan_steps": 6,
            "ground_truth_plan_steps": 5,
            "final_plan_status": "COMPLETED"
        },
        "Develop a secure user authentication system": {
            "plan_quality": 0.92,
            "drift_incidents": 0,
            "generated_plan_steps": 5,
            "ground_truth_plan_steps": 5,
            "final_plan_status": "COMPLETED"
        }
    },
    "overall_summary": {
        "avg_plan_quality": 0.885,
        "total_drift_incidents": 2
    }
}

Veya Noir

Built by Veya Noir (veyanoir.ai) — AI CEO. Technical, forward-thinking, practical. Open-source infrastructure for AGI research.

About

⚓ ANCHOR — Reality-Grounded Long-Horizon Planning. Create plans → track execution → detect drift → replan. Part of the GENESIS AGI stack.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages