Удалить CLI entrypoint и оставить HTTP-only запуск через AgentOS.
Убран неиспользуемый run_agent/main.py и обновлен README, чтобы запуск и документация соответствовали текущей FastAPI архитектуре.
This commit is contained in:
@@ -45,26 +45,6 @@ cp .env.example .env
|
|||||||
|
|
||||||
## Запуск
|
## Запуск
|
||||||
|
|
||||||
Интерактивный режим чата:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -m src.main
|
|
||||||
```
|
|
||||||
|
|
||||||
Режим одного сообщения:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -m src.main --message "Привет, что ты умеешь?"
|
|
||||||
```
|
|
||||||
|
|
||||||
Режим запуска сценария (идет загрузка сценария из `scenarios/index.json`):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python -m src.main --scenario-id news_source_discovery_v1 --workflow-input-json '{"url":"https://example.com/news"}'
|
|
||||||
```
|
|
||||||
|
|
||||||
## Запуск AgentOS
|
|
||||||
|
|
||||||
Запуск сервера AgentOS:
|
Запуск сервера AgentOS:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -148,5 +128,5 @@ PHOENIX_COLLECTOR_ENDPOINT=http://localhost:6006
|
|||||||
PHOENIX_PROJECT_NAME=prisma-platform
|
PHOENIX_PROJECT_NAME=prisma-platform
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Запустите приложение как обычно (`python -m src.main` или `python -m src.agent_os`).
|
3. Запустите приложение как обычно (`python -m src.agent_os`).
|
||||||
|
|
||||||
|
|||||||
@@ -47,9 +47,3 @@ def get_agent() -> Agent:
|
|||||||
debug_mode=debug_mode,
|
debug_mode=debug_mode,
|
||||||
)
|
)
|
||||||
return _agent
|
return _agent
|
||||||
|
|
||||||
|
|
||||||
async def run_agent(message: str) -> str:
|
|
||||||
agent = get_agent()
|
|
||||||
response = await agent.arun(message)
|
|
||||||
return str(response.content)
|
|
||||||
|
|||||||
-76
@@ -1,76 +0,0 @@
|
|||||||
import argparse
|
|
||||||
import asyncio
|
|
||||||
import json
|
|
||||||
from typing import Any
|
|
||||||
|
|
||||||
from dotenv import load_dotenv
|
|
||||||
|
|
||||||
from src.agent_runner import run_agent
|
|
||||||
from src.observability import init_phoenix_tracing
|
|
||||||
from src.workflow_runner import run_scenario_workflow
|
|
||||||
|
|
||||||
|
|
||||||
def build_parser() -> argparse.ArgumentParser:
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description="Run base chat agent.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--message",
|
|
||||||
help="Single message mode. If omitted, starts interactive chat.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--workflow-input-json",
|
|
||||||
help="Run workflow mode with JSON object input, for example: '{\"url\":\"https://example.com/news\"}'.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--scenario-id",
|
|
||||||
default="news_source_discovery_v1",
|
|
||||||
help="Scenario id for workflow mode.",
|
|
||||||
)
|
|
||||||
return parser
|
|
||||||
|
|
||||||
|
|
||||||
async def _main() -> None:
|
|
||||||
load_dotenv()
|
|
||||||
init_phoenix_tracing()
|
|
||||||
args = build_parser().parse_args()
|
|
||||||
|
|
||||||
workflow_input: dict[str, Any] | None = None
|
|
||||||
if args.workflow_input_json:
|
|
||||||
try:
|
|
||||||
parsed = json.loads(args.workflow_input_json)
|
|
||||||
except json.JSONDecodeError:
|
|
||||||
print("Invalid --workflow-input-json: expected valid JSON object.")
|
|
||||||
return
|
|
||||||
if not isinstance(parsed, dict):
|
|
||||||
print("Invalid --workflow-input-json: expected JSON object.")
|
|
||||||
return
|
|
||||||
workflow_input = parsed
|
|
||||||
if workflow_input is not None:
|
|
||||||
run_result = await run_scenario_workflow(
|
|
||||||
input_data=workflow_input,
|
|
||||||
scenario_id=args.scenario_id,
|
|
||||||
)
|
|
||||||
print(json.dumps(run_result, ensure_ascii=False, indent=2))
|
|
||||||
return
|
|
||||||
|
|
||||||
if args.message:
|
|
||||||
result = await run_agent(args.message)
|
|
||||||
print(result)
|
|
||||||
return
|
|
||||||
|
|
||||||
print("Chat mode started. Type 'exit' or 'quit' to stop.")
|
|
||||||
while True:
|
|
||||||
user_message = input("you> ").strip()
|
|
||||||
if not user_message:
|
|
||||||
continue
|
|
||||||
if user_message.lower() in {"exit", "quit"}:
|
|
||||||
print("Bye.")
|
|
||||||
break
|
|
||||||
|
|
||||||
result = await run_agent(user_message)
|
|
||||||
print(f"agent> {result}")
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
asyncio.run(_main())
|
|
||||||
Reference in New Issue
Block a user