Metadata-Version: 2.4
Name: biopoiesis
Version: 1.0.0
Summary: The lightest AI agent framework
Author: dvwoo
License-Expression: MIT
Keywords: ai,agent,llm,multi-agent,framework
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: License.md
Requires-Dist: openai>=2.0
Requires-Dist: pyyaml>=6.0
Requires-Dist: aiohttp>=3.9
Dynamic: license-file

# Biopoiesis

The lightest AI application framework. One Python process, one YAML config, one plugin directory.

最轻量级 AI 应用开发框架。一个 Python 进程，一个 YAML 配置，一个插件目录。

---

## Quick Start

### 1. Install

```bash

pip install biopoiesis

```
### 2. Configure


Copy config/robots.example.yaml to config/robots.yaml, fill in your API key.

### 3. Run

```bash

biopoiesis

```
API gateway at http://127.0.0.1:9000.

### 4. Create your first plugin

```bash

biopoiesis --create-plugin hello

```

restart, then test:

```bash


curl -X POST http://127.0.0.1:9000/api/hello -H "Content-Type: application/json" -d '{"content":"Hello"}'


```

```PowerShell

$body = '{"content":"Hello"}'
Invoke-RestMethod -Uri http://127.0.0.1:9000/api/hello -Method POST -ContentType "application/json" -Body $body
```
### 5. Examples


| # | Example | Mode | Description |
|---|---------|------|-------------|
| 1 | Translator | Simple | Direct LLM call |
| 2 | Daily Brief | Simple | LLM with template |
| 3 | Counselor | Agent | Assess → Counsel → Summarize |
| 4 | Debate | Group | Dynamic agents + pointer scheduling |
| 5 | Brainstorm | Parallel | `asyncio.gather` for parallel LLM |
| 6 | Agent Memory | Full Stack | Standard pipeline + memory + pointer |



[Full examples guide →](examples/README.md)

## Architecture
Three-tier usage, from simple to complex:

| Tier | Usage | When |
|------|-------|------|
| Simple | `system.llm.chat()` | Translation, summarization |
| Agent | `system.create_agent()` + pipeline | Conversational AI with memory |
| Group | `system.create_group()` + pointer | Multi-agent collaboration |

## API


| Method | Path | Description |
|--------|------|-------------|
| GET | `/api/health` | Health check |
| GET | `/api/plugins` | Plugin list |
| POST | `/api/invoke` | Generic plugin call |
| POST | `/api/human/create` | Create data entry |



## Plugin Development

```python
# plugins/my_plugin.py

async def execute(envelop, cancel_checker):
    llm = cancel_checker.llm if cancel_checker else None
    result = await llm.chat([{"role": "user", "content": envelop.payload.get("content")}])
    envelop.payload = {"result": result}
    return envelop

def on_load(system, app):
    from aiohttp import web
    async def handler(request):
        data = await request.json()
        result = await execute(AICPEnvelop(payload=data), system)
        return web.json_response({"ok": True, "data": result.payload})
    app.router.add_post('/api/my_plugin', handler)

```


**Note**: After updating a plugin, restart the framework for changes to take effect.

**注意**: 更新插件后需重启框架才能生效。

## Dependencies

- Python >= 3.10
- openai >= 2.0
- PyYAML >= 6.0
- aiohttp >= 3.9

## License

MIT — see [LICENSE](LICENSE) for details.
