Skip to main content

Autonomous Goals

The AutonomousGoalGeneratorJob gives WASP the ability to act proactively — generating goals based on system state without user intervention.

Overview

Every 30 minutes, the autonomous job:

  1. Gathers the current system state (resources, errors, active goals)
  2. Checks critical thresholds without LLM involvement
  3. For non-critical situations, asks the LLM for recommendations
  4. If action is warranted, creates a goal and notifies the user

System State Gathering

world_state = {
"disk_pct": shutil.disk_usage("/data").percent,
"ram_pct": psutil.virtual_memory().percent,
"cpu_pct": psutil.cpu_percent(),
"active_goals": len(active_goals),
"error_count_1h": await count_recent_errors(),
"current_time": now_local().isoformat(),
"last_user_message": await get_last_active(),
"skill_patterns": await get_top_patterns(),
}

Critical Threshold Checks (No LLM)

Some conditions trigger immediate action without LLM consultation:

ConditionAction
Disk > 95%Create goal: "Free disk space by cleaning logs and temp files"
RAM > 95%Create goal: "Identify and reduce memory usage"

These are handled synchronously to minimize response time.

LLM-Based Evaluation

For non-critical situations:

prompt = f"""
Current system state:
- Disk: {disk_pct}%
- RAM: {ram_pct}%
- Active goals: {active_goals}
- Recent errors: {error_count}
- Time: {current_time}
- User last active: {last_active}

Based on this state, should I take any proactive action?
Options:
1. no_action — Everything is fine
2. maintenance — Run a maintenance task
3. proactive_research — Research something useful for the user
4. alert_user — Notify user of something important

If action needed, provide: action type, objective, and reason.
"""

Goal Creation

When action is warranted:

goal = await self.goal_orchestrator.create_goal(
objective=recommended_objective,
chat_id=self.notify_chat_id,
priority=3, # Low priority — autonomous goals don't preempt user goals
source="autonomous",
)

A Telegram notification is sent:

🤖 Acción proactiva: Limpiando archivos temporales
Motivo: Disco al 88%, limpiando para mantener rendimiento óptimo

Rate Limits

The autonomous job is tightly rate-limited to prevent notification spam:

LimitValue
Max goals per hour1
Max goals per day5
State stored inRedis agent:autonomous_state

State check:

state = await redis.get("agent:autonomous_state")
if state["goals_today"] >= 5:
return # Skip — daily limit reached

CPI Integration

The autonomous job respects the Cognitive Pressure Index:

cpi_high = await redis.get("agent:cpi_high")
if cpi_high:
logger.info("autonomous.skipped_high_cpi")
return # Don't add more load when system is stressed

Quiet Hours

Notifications respect quiet hours (default: 11 PM to 8 AM). Goals can still be created, but notifications are deferred.

Autonomous State

# Check autonomous state
docker exec agent-redis redis-cli GET agent:autonomous_state | python3 -m json.tool

Example:

{
"goals_today": 1,
"goals_this_hour": 0,
"last_goal_time": "2026-03-09T15:00:00",
"last_action": "maintenance",
"last_objective": "Clean old log files to free disk space"
}

Disabling Autonomous Goals

If you don't want WASP acting autonomously:

# Remove the SCHEDULER_NOTIFY_CHAT_ID — job still runs but creates no goals
# without a chat_id to notify

# Or set goal_engine_enabled=false — prevents goal creation
GOAL_ENGINE_ENABLED=false

Or comment out the autonomous job registration in main.py and rebuild.

Manual Trigger

To trigger an autonomous evaluation immediately:

curl -b cookies.txt -X POST https://agentwasp.com/api/scheduler/run/autonomous