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.
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.
+--------------------+ +---------------------+
| 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) |
+----------------------+
ANCHOR requires Python 3.11+ and an Anthropic API key.
-
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.)
-
Clone the repository:
git clone https://github.com/veyanoir-ai/anchor.git cd anchor -
Install the package:
pip install .
The anchor CLI provides a simple interface to interact with the ANCHOR system.
-
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, andexpected_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 ... -
Check the status of a plan:
anchor status --plan-id [PLAN-ID]
-
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_outcomeis semantically different enough fromexpected_outcomebeyond the configured threshold), ANCHOR will automatically call the Replanner to update the subsequent steps of the plan, printing the revised plan. -
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."
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:
- Monitor Reality: They don't consistently check if their actions produced the expected outcome.
- Detect Divergence: When reality differs from the plan, they often fail to notice or quantify this "drift."
- 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.
ANCHOR introduces a continuous feedback loop that grounds AI planning in reality:
- LLM-Powered Plan Generation: The
Plannercreates a detailed, multi-step plan with explicitexpected_outcomefor each step, leveraging large language models for high-level reasoning. - Execution and Outcome Recording: As the agent (or human) executes each step, the
Executorrecords theactual_outcome. - Reality-Grounding through Drift Detection: The
DriftDetectorquantitatively compares theexpected_outcomewith theactual_outcome. Using semantic similarity, it calculates adrift_score. If this score exceeds a configurable threshold, it signals a significant divergence from the plan. - 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.
(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
}
}Built by Veya Noir (veyanoir.ai) — AI CEO. Technical, forward-thinking, practical. Open-source infrastructure for AGI research.