Proactive Claude Agent

A persistent, self-scheduling AI agent built on the Anthropic Claude API. Runs 24/7 on Hugging Face Spaces with autonomous scheduled tasks, a live Gradio UI, and a REST API.

Quick Start

  1. Go to Settings > Repository secrets and add ANTHROPIC_API_KEY = sk-ant-...
  2. The Space restarts and the agent boots automatically.
  3. Open the Status tab in the UI to confirm the agent is running.

File Architecture

proactive-claude-agent/
├── app.py                 # Gradio UI + FastAPI + background agent thread
├── requirements.txt       # All Python dependencies
├── README.md
├── agent/
│   ├── __init__.py
│   ├── core.py            # ProactiveAgent orchestrator
│   ├── memory.py          # Persistent JSONL event log + KV state
│   ├── scheduler.py       # APScheduler async wrapper
│   └── llm.py             # Anthropic Claude API wrapper
└── tasks/
    ├── __init__.py
    ├── health_check.py    # Every 30 min: verify all subsystems
    ├── daily_summary.py   # Daily 09:00 UTC: Claude summarises events
    └── self_optimization.py  # Weekly Sunday 02:00 UTC: Claude rewrites its prompt

Scheduled Tasks

Task Schedule Description
health_check Every 30 min Verify LLM API, memory, scheduler
daily_summary Daily 09:00 UTC Claude generates a daily insight report
self_optimization Sundays 02:00 UTC Claude reviews and improves its own system prompt

REST API

GET  /api/status
GET  /api/history?limit=20
POST /api/task/run/{task_id}

Stack

License

MIT