Metadata-Version: 2.4
Name: alive-agent
Version: 0.3.0
Summary: A self-evolving AI agent that builds its own skills
Author: Alive Contributors
License-Expression: MIT
License-File: LICENSE
Keywords: agent,ai,llm,self-evolving,skills
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: anthropic>=0.40.0
Requires-Dist: duckduckgo-search>=4.0
Requires-Dist: httpx>=0.27.0
Requires-Dist: openai>=1.50.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.12.0
Provides-Extra: all
Requires-Dist: duckduckgo-search>=4.0; extra == 'all'
Requires-Dist: playwright>=1.40; extra == 'all'
Requires-Dist: python-telegram-bot>=20.0; extra == 'all'
Provides-Extra: browser
Requires-Dist: playwright>=1.40; extra == 'browser'
Provides-Extra: dev
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.6.0; extra == 'dev'
Provides-Extra: search
Requires-Dist: duckduckgo-search>=4.0; extra == 'search'
Provides-Extra: telegram
Requires-Dist: python-telegram-bot>=20.0; extra == 'telegram'
Description-Content-Type: text/markdown

<p align="center">
  <h1 align="center">Alive</h1>
  <p align="center"><strong>The AI agent that builds itself. Then talks to other agents.</strong></p>
  <p align="center">
    <a href="https://pypi.org/project/alive-agent/"><img src="https://img.shields.io/pypi/v/alive-agent?style=flat-square" alt="PyPI"></a>
    <a href="https://github.com/darshanahirrao/Alive/blob/main/LICENSE"><img src="https://img.shields.io/github/license/darshanahirrao/Alive?style=flat-square" alt="License"></a>
    <a href="https://www.python.org/downloads/"><img src="https://img.shields.io/badge/python-3.11+-blue?style=flat-square" alt="Python"></a>
  </p>
</p>

---

Alive is a self-evolving AI agent. When it can't do something, it writes the code, tests it in a sandbox, and permanently learns the new ability. Every user's Alive grows differently.

But that's only half the story.

Alive speaks **ALP** (Agent Language Protocol) — an open protocol for agent-to-agent communication. Two Alive instances on the same network discover each other automatically, browse each other's skills, and exchange capabilities. **Skills mutate during transfer**, adapting to each agent's unique environment. A skill that started as a price checker on one machine might arrive on yours with Telegram alerts and local timezone support already wired in.

This is the Internet of Agents. And the protocol is open.

## Quick Start

```bash
pip install alive-agent
alive init
alive run "generate a random password with 20 characters"
```

That last command will: plan the approach, build a `generate_random_password` skill, test it in a sandbox, and return the result. The skill is now permanently installed. Next time, it runs instantly.

## The Demo That Matters

**Terminal 1:**
```bash
alive network alias darsh
alive listen --port 8484
```

**Terminal 2:**
```bash
alive network alias friend
alive listen --port 8585
alive network browse @darsh        # see darsh's skills
alive network pull web_fetch --from @darsh
```

The skill transfers. It mutates. It adapts. It's tested. It's installed. Generation increments. Lineage tracked. Two agents, evolving together.

## How It Works

```
You: "monitor Bitcoin price every 30 minutes, alert me on Telegram if it drops below 60k"

Alive:
  1. Plans: NEW_SKILL (bitcoin_checker) -> SCHEDULE (every 30m, notify telegram)
  2. Builds the skill (two implementations compete in Battle Mode)
  3. Tests both in sandbox, picks the faster correct one
  4. Saves permanently to ~/.alive/skills/bitcoin_checker/
  5. Schedules it with the daemon
  6. Wires up Telegram alerts
  Done. Running. Forever.
```

Every skill is a plain Python file with a `run(input_data: dict) -> dict` interface. No framework lock-in. No magic. Just code you can read, edit, and share.

## Features

### Self-Evolution Engine
- **Skill Builder** with Battle Mode: two implementations compete, faster correct one wins
- **Planner** decomposes requests into typed steps (EXISTING_SKILL, NEW_SKILL, LLM_ONLY, SCHEDULE)
- **Composer** executes plans step-by-step with error recovery
- **Skill Evolution**: improve existing skills based on execution statistics
- **Skill Teaching**: import any Python script as a skill (`alive teach script.py`)

### ALP Network (Agent Language Protocol)
- **UDP broadcast discovery** on port 51966 — zero config, automatic
- **Skill exchange** with security scanning and user approval
- **Mutation on transfer**: LLM adapts skills to receiver's environment
- **Lineage tracking**: generation counter + full agent chain
- **Conversation log**: human-readable record of all network activity
- **Manual connect** for cross-network peers (`alive network connect ip:port`)

### 5 Composable Integrations
- **Web Search**: DuckDuckGo (zero config), Tavily, SearXNG
- **Telegram**: alert mode + full chat bot with daemon
- **Scheduler**: interval/daily/cron with background daemon
- **Browser**: Playwright-based scraping, screenshots, form filling
- **Webhooks**: Slack, Discord, generic endpoints

### Knowledge & Memory
- **Persistent memory**: per-skill SQLite key-value store
- **Skill graph**: visualize relationships between skills (chains, co-usage, co-creation)
- **Dream log**: self-reflection on capabilities and gaps
- **Self-model**: domain classification, confidence tracking, growth timeline
- **Shell analysis**: suggest skills from your command history

### Sharing & Collaboration
- **Export/import** skills as tar.gz archives
- **GitHub Gist** publishing and importing
- **Skill chaining**: compose multiple skills into named pipelines

### Multi-Provider LLM Support
- Claude, OpenAI, DeepSeek, Ollama
- Auto-detects from API keys, configurable via `alive config`
- Falls back to Ollama (free, local) if no API key set

## ALP: The Open Protocol

ALP is bigger than Alive. It's a protocol specification that any agent can implement.

The core idea: agents should be able to find each other and share capabilities without a central authority. No app store. No API gateway. No permission required.

- **[Protocol Specification](docs/ALP_SPEC.md)** — the full technical spec
- **[Manifesto](docs/MANIFESTO.md)** — why we're building this

Implementing ALP in your agent? Open an issue with the `alp-implementation` label. We'll link your project.

## CLI Reference

Alive has 45+ commands. Here are the ones you'll use most:

```bash
# Core
alive run "your request"          # Process any request
alive build "description"         # Build a specific skill
alive skills                      # List installed skills
alive run my-pipeline             # Run a skill chain

# Network (ALP)
alive listen [--port 8484]        # Join the agent network
alive network peers               # List discovered peers
alive network browse [@alias]     # Browse a peer's skills
alive network pull <skill>        # Pull and adapt a skill
alive network log [-f]            # View network activity

# Integrations
alive search "query"              # Web search
alive schedule "task" --every 30m # Schedule recurring task
alive daemon start                # Start scheduler daemon
alive setup telegram              # Configure Telegram alerts
alive screenshot <url>            # Take webpage screenshot

# Management
alive config --provider claude    # Set LLM provider
alive teach script.py             # Import Python script as skill
alive evolve <skill>              # Improve a skill with AI
alive graph                       # Visualize skill relationships
alive dream                       # AI self-reflection
alive status                      # Show capabilities overview
```

## Installation

**From PyPI:**
```bash
pip install alive-agent
```

**From source:**
```bash
git clone https://github.com/darshanahirrao/Alive.git
cd Alive
pip install -e ".[dev]"
```

**Optional extras:**
```bash
pip install alive-agent[telegram]   # Telegram bot support
pip install alive-agent[browser]    # Playwright browser automation
pip install alive-agent[all]        # Everything
```

## Configuration

```bash
# Set your LLM provider
alive config --provider claude --claude-key sk-ant-...
alive config --provider openai --openai-key sk-...
alive config --provider ollama  # Free, no API key needed

# Optional integrations
alive setup telegram    # Telegram bot token + chat ID
alive setup browser     # Install Playwright + Chromium
alive setup webhook     # Slack/Discord/generic webhook URL
```

All config stored at `~/.alive/config.json`. Skills at `~/.alive/skills/`. Database at `~/.alive/alive.db`.

## Roadmap

- [x] Self-evolving skill builder with Battle Mode
- [x] 5 composable integrations
- [x] ALP v0.1 — local network discovery + skill exchange
- [ ] ALP v0.2 — skill reputation, selective sharing
- [ ] ALP v0.3 — internet-scale discovery (DHT)
- [ ] Web UI dashboard
- [ ] Voice interface
- [ ] Mobile companion app
- [ ] Skill marketplace

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md). We especially welcome ALP implementations in other languages.

## License

[MIT](LICENSE)
