
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
superopt
Advanced tools
Agentic Environment Optimization for Autonomous AI Agents
SuperOpt is a unified framework for optimizing agent environments (prompts, tools, retrieval, memory) without modifying model parameters. It treats the entire agent environment as a structured optimization target, enabling autonomous agents to self-correct and stabilize over time.
| 🚀 Environment-Level Optimization | 🎯 Automatic Failure Diagnosis | 🛡️ Stability Guarantees |
|---|---|---|
| Optimize prompts, tools, retrieval, and memory as a unified system | Intelligent routing of failures to appropriate optimizers | Hierarchy of mutability prevents oscillation and ensures convergence |
| 📊 Trace-Based Learning | ⚡ No Model Retraining | 🔧 Framework Agnostic |
|---|---|---|
| Uses execution traces as supervision signals | All improvements happen at the environment level | Works with DSPy, CrewAI, AutoGen, and custom agents |
SuperOpt formalizes optimization as iterative descent over Natural Language Gradients derived from execution traces. A meta-diagnostic controller attributes failures to specific environment layers and routes corrective updates to specialized optimization engines.
| 🎯 SuperController | 📝 SuperPrompt | 🔧 SuperReflexion | 🔍 SuperRAG | 🧠 SuperMem |
|---|---|---|---|---|
| Diagnostic meta-controller for failure routing | Evolutionary instruction optimization (GEPA-based) | Self-healing tool schema repair | Adaptive retrieval optimization | Typed memory with decay and conflict resolution |
The research paper describing SuperOpt has been uploaded and will be available soon after launch.
pip install superopt
git clone https://github.com/SuperagenticAI/superopt.git
cd superopt
pip install -e .
| Feature | Install Command | Description |
|---|---|---|
| 🧪 Development | pip install -e ".[dev]" | Testing, linting, formatting tools |
| 🤖 Aider Integration | pip install -e ".[aider]" | Coding agent optimization |
| 🔍 LanceDB RAG | pip install -e ".[lancedb]" | Vector database for retrieval |
| 📦 Everything | pip install -e ".[all]" | All optional dependencies |
Copy and run this complete example:
# Complete SuperOpt Example - Copy this entire file to test SuperOpt
from superopt import SuperOpt, AgenticEnvironment
from superopt.core.environment import PromptConfig, ToolSchema
from superopt.core.trace import ExecutionTrace, ToolCall
# 1. Define your agent's environment
environment = AgenticEnvironment(
prompts=PromptConfig(
system_prompt="You are a helpful coding assistant."
),
tools={
"edit_file": ToolSchema(
name="edit_file",
description="Edit a file at a specific line",
arguments={"file": "str", "line": "int"},
),
},
)
# 2. Initialize the optimizer
optimizer = SuperOpt(environment=environment)
# 3. Simulate agent execution with a failure
trace = ExecutionTrace(
task_description="Edit line 0 in test.py",
success=False,
)
trace.tool_errors.append(ToolCall(
tool_name="edit_file",
arguments={"file": "test.py", "line": 0},
error_message="Line numbers must be 1-indexed",
))
# 4. Let SuperOpt learn and optimize
print("Before optimization:")
print(optimizer.environment.tools['edit_file'].description)
print()
optimizer.step(trace)
# 5. Check the improved environment
print("After optimization:")
print(optimizer.environment.tools['edit_file'].description)
To test this example:
test_superopt.pypython test_superopt.pypython examples/basic_example.py
Expected Output:
SuperOpt Basic Example
==================================================
1. Initial Environment:
Tool schema description: Edit a file by applying changes...
2. Executing task with tool error...
Error: Line numbers must be 1-indexed, not 0-indexed
3. Optimizing environment...
4. Updated Environment:
Tool schema description length: 126 chars
✓ Schema was updated with clarifications
5. Statistics:
Controller diagnoses: {'PROMPT': 0, 'TOOL': 1, 'RETRIEVAL': 0, 'MEMORY': 0, 'NONE': 0}
Optimization steps: 1
SuperOpt operates in an outer optimization loop surrounding the agent execution loop:
┌─────────────────────────────────────────────────────────────┐
│ 🚀 SuperOpt Optimization Loop │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ 🤖 Agent Execution Loop ││
│ │ Task → Agent → Tool Calls → Results → Output ││
│ └─────────────────────────────────────────────────────────┘│
│ │ │
│ 📊 Execution Trace │
│ ↓ │
│ ┌─────────────────────────────────────────────────────────┐│
│ │ 🎯 SuperController (Diagnosis) ││
│ │ Classify failure: PROMPT | TOOL | RETRIEVAL | MEMORY ││
│ └─────────────────────────────────────────────────────────┘│
│ │ │
│ ┌─────────────────┼─────────────────┐ │
│ ↓ ↓ ↓ │
│ ┌──────────┐ ┌──────────┐ ┌──────────┐ │
│ │📝 Super- │ │🔧 Super- │ │🔍 Super- │ │
│ │ Prompt │ │ Reflexion │ │ RAG │ │
│ │(Prompts) │ │ (Tools) │ │(Retrieval)│ │
│ └──────────┘ └──────────┘ └──────────┘ │
│ │ │ │ │
│ └─────────────────┼─────────────────┘ │
│ ↓ │
│ 🌟 Natural Language Gradient (∇_NL) │
│ ↓ │
│ ✨ Updated Environment Φ │
└─────────────────────────────────────────────────────────────┘
| Step | Action | Description |
|---|---|---|
| 1️⃣ | Execute | Run agent task under current environment |
| 2️⃣ | Capture | Record structured execution trace |
| 3️⃣ | Diagnose | SuperController classifies the failure mode |
| 4️⃣ | Route | Send trace to the appropriate optimizer |
| 5️⃣ | Generate | Create Natural Language Gradient update |
| 6️⃣ | Validate | Check update against stability constraints |
| 7️⃣ | Apply | Update environment and persist |
| 8️⃣ | Repeat | Continue until convergence |
Diagnostic Meta-Controller
The intelligent orchestrator that analyzes execution traces and routes optimization tasks to the appropriate component:
Evolutionary Prompt Optimizer
Advances prompt engineering through systematic optimization:
Self-Healing Tool Schemas
Automatically repairs and enhances tool definitions when agents encounter issues:
Adaptive Retrieval Optimization
Dynamically optimizes retrieval-augmented generation systems:
top_k retrieval count based on query complexity and contextIntelligent Memory System
Advanced memory management with hierarchical organization:
SuperOpt provides adapters for popular agent frameworks:
from superopt.adapters import AiderAdapter
from superopt import SuperOpt
# Create adapter for your Aider instance
adapter = AiderAdapter(
model="gpt-4",
coder_class="EditBlockCoder",
)
# Extract the current environment
environment = adapter.extract_environment()
# Initialize optimizer
optimizer = SuperOpt(environment=environment)
# Run optimization episode
results = optimizer.optimize_episode(
task_description="Fix the failing tests in auth.py",
agent_executor=adapter.execute,
max_iterations=10,
)
# Apply optimized environment back to agent
adapter.apply_environment(optimizer.environment)
from superopt.adapters.base import AgentAdapter
from superopt import AgenticEnvironment, ExecutionTrace
class MyAgentAdapter(AgentAdapter):
def extract_environment(self) -> AgenticEnvironment:
"""Extract current environment from your agent."""
return AgenticEnvironment(
prompts=self.agent.get_prompts(),
tools=self.agent.get_tools(),
)
def apply_environment(self, env: AgenticEnvironment) -> None:
"""Apply optimized environment back to agent."""
self.agent.set_prompts(env.prompts)
self.agent.set_tools(env.tools)
def execute(self, task: str) -> ExecutionTrace:
"""Execute task and return trace."""
result = self.agent.run(task)
return self._create_trace(result)
# Quick evaluation on sample tasks
python scripts/evaluate_baseline.py --tasks data/tasks/sample_tasks.json
python scripts/evaluate_superopt.py --tasks data/tasks/sample_tasks.json
python scripts/compare_all.py --tasks data/tasks/sample_tasks.json
# Analyze results
python scripts/analyze_results.py --results-dir results/
SuperOpt evaluates improvements across multiple dimensions:
| 🔒 Reliability | 🛡️ Stability | ⚡ Efficiency | 🌍 Generalization | 👁️ Interpretability |
|---|---|---|---|---|
| Reduction in repeated failures | Persistence of improvements over time | Token usage, retry counts | Transfer across tasks | Human-readable updates |
SuperOpt builds upon groundbreaking work in agent optimization:
| 🎯 GEPA | 🧠 ACE | 🎓 Meta-ACE | 🔧 DSPy | 📝 TextGrad |
|---|---|---|---|---|
| Evolutionary prompt optimization | Agentic context engineering | Meta-reasoning extensions | Prompt programming framework | Textual differentiation |
Agrawal et al. (2025) • Zhang et al. (2025) • Romero (2025) • Khattab et al. (2023) • Yuksekgonul et al. (2024)
We welcome contributions! Here's how to get started:
git checkout -b feature/amazing-featuregit commit -m 'Add amazing feature'git push origin feature/amazing-featuregit clone https://github.com/SuperagenticAI/superopt.git
cd superopt
pip install -e ".[dev]"
# Run tests and quality checks
pytest
black .
ruff check .
Apache License 2.0 - see LICENSE file for details.
| 🐛 Issues | 💬 Discussions | 🌟 Contribute | |
|---|---|---|---|
| shashi@super-agentic.ai | GitHub Issues | GitHub Discussions | Contributing Guide |
Brought to you 🔥 by Superagentic AI
FAQs
Agentic Environment Optimization for Autonomous AI Agents
We found that superopt demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.