Подключить AgentOS API-сервер и обновить документацию запуска.
Добавлены зависимости FastAPI/Uvicorn, отдельный entrypoint для AgentOS и новые переменные окружения, чтобы агент запускался как CLI и как HTTP API.
This commit is contained in:
@@ -1,6 +1,9 @@
|
|||||||
|
AGENT_ID=prisma-agent
|
||||||
OLLAMA_MODEL_ID=gemma4:31b
|
OLLAMA_MODEL_ID=gemma4:31b
|
||||||
OLLAMA_HOST=http://localhost:11435
|
OLLAMA_HOST=http://localhost:11435
|
||||||
OLLAMA_TEMPERATURE=0
|
OLLAMA_TEMPERATURE=0
|
||||||
AGENT_MARKDOWN=false
|
AGENT_MARKDOWN=false
|
||||||
AGENT_DEBUG_MODE=true
|
AGENT_DEBUG_MODE=true
|
||||||
AGENT_INSTRUCTIONS=You are a helpful assistant. Answer briefly and clearly.
|
AGENT_INSTRUCTIONS=You are a helpful assistant. Answer briefly and clearly.
|
||||||
|
AGENT_OS_HOST=127.0.0.1
|
||||||
|
AGENT_OS_PORT=7777
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
# Prisma Platform MVP
|
# Prisma Platform MVP
|
||||||
|
|
||||||
Minimal chat agent on Agno + Ollama.
|
Минимальный чат-агент на Agno + Ollama с рантаймом AgentOS.
|
||||||
|
|
||||||
## Current structure
|
В этом проекте AgentOS работает как HTTP API сервер (FastAPI + Uvicorn).
|
||||||
|
|
||||||
|
## Текущая структура
|
||||||
|
|
||||||
```text
|
```text
|
||||||
prisma_platform/
|
prisma_platform/
|
||||||
@@ -11,11 +13,12 @@ prisma_platform/
|
|||||||
├── requirements.txt
|
├── requirements.txt
|
||||||
└── src/
|
└── src/
|
||||||
├── __init__.py
|
├── __init__.py
|
||||||
|
├── agent_os.py
|
||||||
├── agent_runner.py
|
├── agent_runner.py
|
||||||
└── main.py
|
└── main.py
|
||||||
```
|
```
|
||||||
|
|
||||||
## Setup
|
## Установка
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python -m venv .venv
|
python -m venv .venv
|
||||||
@@ -24,17 +27,46 @@ pip install -r requirements.txt
|
|||||||
cp .env.example .env
|
cp .env.example .env
|
||||||
```
|
```
|
||||||
|
|
||||||
## Run
|
## Запуск
|
||||||
|
|
||||||
Interactive chat mode:
|
Интерактивный режим чата:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python -m src.main
|
python -m src.main
|
||||||
```
|
```
|
||||||
|
|
||||||
Single message mode:
|
Режим одного сообщения:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
python -m src.main --message "Привет, что ты умеешь?"
|
python -m src.main --message "Привет, что ты умеешь?"
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## Запуск AgentOS
|
||||||
|
|
||||||
|
Запуск сервера AgentOS:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python -m src.agent_os
|
||||||
|
```
|
||||||
|
|
||||||
|
По умолчанию AgentOS работает на `http://127.0.0.1:7777`.
|
||||||
|
|
||||||
|
Документация API доступна по адресам:
|
||||||
|
|
||||||
|
- `http://127.0.0.1:7777/docs`
|
||||||
|
- `http://127.0.0.1:7777/redoc`
|
||||||
|
|
||||||
|
## Переменные окружения
|
||||||
|
|
||||||
|
Основные переменные:
|
||||||
|
|
||||||
|
- `AGENT_ID` (по умолчанию: `prisma-agent`)
|
||||||
|
- `OLLAMA_MODEL_ID` (по умолчанию: `gemma4:31b`)
|
||||||
|
- `OLLAMA_HOST` (по умолчанию: `http://localhost:11435`)
|
||||||
|
- `OLLAMA_TEMPERATURE` (по умолчанию: `0`)
|
||||||
|
- `AGENT_MARKDOWN` (по умолчанию: `false`)
|
||||||
|
- `AGENT_DEBUG_MODE` (по умолчанию: `true`)
|
||||||
|
- `AGENT_INSTRUCTIONS` (по умолчанию: `You are a helpful assistant. Answer briefly and clearly.`)
|
||||||
|
- `AGENT_OS_HOST` (по умолчанию: `127.0.0.1`)
|
||||||
|
- `AGENT_OS_PORT` (по умолчанию: `7777`)
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
agno
|
agno
|
||||||
|
fastapi
|
||||||
|
uvicorn
|
||||||
python-dotenv
|
python-dotenv
|
||||||
ollama
|
ollama
|
||||||
socksio
|
socksio
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
import os
|
||||||
|
|
||||||
|
from dotenv import load_dotenv
|
||||||
|
|
||||||
|
from agno.os import AgentOS
|
||||||
|
|
||||||
|
from src.agent_runner import get_agent
|
||||||
|
|
||||||
|
load_dotenv()
|
||||||
|
|
||||||
|
_agent = get_agent()
|
||||||
|
_agent_os = AgentOS(agents=[_agent])
|
||||||
|
app = _agent_os.get_app()
|
||||||
|
|
||||||
|
|
||||||
|
def serve_agent_os() -> None:
|
||||||
|
host = os.getenv("AGENT_OS_HOST", "127.0.0.1")
|
||||||
|
port = int(os.getenv("AGENT_OS_PORT", "7777"))
|
||||||
|
_agent_os.serve(app=app, host=host, port=port, reload=False)
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
serve_agent_os()
|
||||||
@@ -27,6 +27,7 @@ def get_agent() -> Agent:
|
|||||||
if _agent is not None:
|
if _agent is not None:
|
||||||
return _agent
|
return _agent
|
||||||
|
|
||||||
|
agent_id = os.getenv("AGENT_ID", "prisma-agent")
|
||||||
model_id = os.getenv("OLLAMA_MODEL_ID", "gemma4:31b")
|
model_id = os.getenv("OLLAMA_MODEL_ID", "gemma4:31b")
|
||||||
ollama_host = os.getenv("OLLAMA_HOST", "http://localhost:11435")
|
ollama_host = os.getenv("OLLAMA_HOST", "http://localhost:11435")
|
||||||
temperature = _env_float("OLLAMA_TEMPERATURE", 0.0)
|
temperature = _env_float("OLLAMA_TEMPERATURE", 0.0)
|
||||||
@@ -39,6 +40,7 @@ def get_agent() -> Agent:
|
|||||||
|
|
||||||
llm = Ollama(id=model_id, host=ollama_host, options={"temperature": temperature})
|
llm = Ollama(id=model_id, host=ollama_host, options={"temperature": temperature})
|
||||||
_agent = Agent(
|
_agent = Agent(
|
||||||
|
id=agent_id,
|
||||||
model=llm,
|
model=llm,
|
||||||
markdown=markdown,
|
markdown=markdown,
|
||||||
instructions=instructions,
|
instructions=instructions,
|
||||||
|
|||||||
Reference in New Issue
Block a user