agentscope-ai / agentscope-ai/agentscope-runtime

[Bug] Web UI (starter_webui) only supports AgentScope 1.0 API, needs 2.0 compatibility

オープン
#509 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
bug
主要言語
Python
スター
863
フォーク
168
PR マージ指標
30日以内にマージされた PR はありません

説明

## Bug Description

Web UI (`web/starter_webui`) appears to only support AgentScope 1.0 API endpoints and is incompatible with AgentScope 2.0. The Web UI sends POST requests to the `/process` endpoint (which is an AgentScope 1.0 / agentscope-runtime convention), but AgentScope 2.0 uses a completely different API structure with endpoints like `/chat`, `/agent`, `/sessions`, etc. This makes the Web UI unable to connect to AgentScope 2.0 Agent Services.

## Affected Component
- [x] Tools
- [ ] Other: **Web UI (`web/starter_webui`)**

## Reproduction Steps

1. **Agent Service Setup (AgentScope 2.0):**
```python
# run_service.py
from agentscope.app import create_app
from agentscope.app.storage import RedisStorage

storage = RedisStorage(host="localhost", port=6379, db=0)
app = create_app(storage=storage)

# Add CORS middleware
from fastapi.middleware.cors import CORSMiddleware
app.add_middleware(CORSMiddleware, allow_origins=["*"])

import uvicorn
uvicorn.run(app, host="0.0.0.0", port=8000)
```
Run: `python run_service.py`

2. **Web UI Configuration:**
- Open `web/starter_webui`
- Set base URL to: `http://localhost:8000`
- Configure model settings (MODEL_TYPE=openai, correct API key and base_url)

3. **Send a message from Web UI**

## Expected vs Actual Behavior

**Expected:** Web UI should successfully connect to AgentScope 2.0 Agent Service and stream responses via SSE.

**Actual:** Web UI sends `POST /` requests which return `404 Not Found`. The Web UI is designed to connect to `/process` endpoint (AgentScope 1.0 convention), but AgentScope 2.0 uses different endpoints:
- `/chat` - Streaming SSE chat endpoint
- `/agent` - Agent CRUD operations
- `/sessions` - Session management
- `/model` - Model information

## Error Messages

```
INFO: 127.0.0.1:41606 - "OPTIONS / HTTP/1.1" 200 OK
INFO: 127.0.0.1:41606 - "POST / HTTP/1.1" 404 Not Found
INFO: 127.0.0.1:41316 - "POST / HTTP/1.1" 404 Not Found
```

Response body:
```json
{"detail":"Not Found"}
```

## Environment

- **AgentScope Runtime Version:** Web UI from `agentscope-runtime` repository
- **AgentScope Version:** 2.0.0
- **Python Version:** 3.11 / 3.13
- **OS:** Linux (7.0.0-15-generic)
- **Installation:** pip

## Additional Context

### Root Cause Analysis

The incompatibility stems from fundamentally different API architectures:

**AgentScope 1.0 (agentscope-runtime):**
- Uses `AgentApp.deploy(endpoint_path="/process")` pattern
- Single `/process` endpoint handles all agent interactions
- Web UI expects this endpoint structure

**AgentScope 2.0:**
- Uses `create_app(storage=...)` factory pattern with FastAPI
- Modular REST API design with multiple endpoints
- Primary interaction endpoint is `/chat` (SSE streaming)
- Requires session-based workflow: create agent → create session → chat

### Suggested Solutions

1. **Update Web UI to support AgentScope 2.0 API:**
- Add support for `/chat` endpoint
- Implement session management workflow (`/sessions` endpoints)
- Add agent configuration UI (`/agent` endpoints)

2. **Provide backward compatibility layer:**
- Create a `/process` endpoint wrapper that translates AgentScope 1.0 protocol to 2.0 API
- Similar to how `compatible-mode/v1` provides OpenAI SDK compatibility

3. **Migration guide:**
- Document the API differences between 1.0 and 2.0
- Provide example Web UI configurations for both versions

### Working AgentScope 2.0 API Structure

```bash
# List agents
GET /agent/

# Create agent
POST /agent/

# Create session
POST /sessions/

# Chat (SSE streaming)
POST /chat/
Body: {"agent_id": "...", "session_id": "...", "input": "..."}
```

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。