Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ downloads/
eggs/
.eggs/
lib/
!sgr-deep-research-frontend/src/shared/lib/
lib64/
parts/
sdist/
Expand Down
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# SGR Agent Core — the first SGR open-source agentic framework for Schema-Guided Reasoning

# UI For Testing

https://github.com/user-attachments/assets/aa85b4d9-b2cb-454c-97d0-ad1443ac9a59

[How run UI](https://github.com/vamplabAI/sgr-agent-core/blob/feature/frontend-integration/sgr-deep-research-frontend/README.md)

## Description

![SGR Concept Architecture](docs/sgr_concept.png)
Expand Down
130 changes: 130 additions & 0 deletions agents.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# Example Custom Agents Configuration
# =====================================
# This file demonstrates how to define custom agents for SGR Deep Research

# Notes:
# ------
# 1. Agent names must be unique or will be overridden
# 2. All tools must be registered in the tool registry
# 3. LLM, Search, Prompts, Execution, MCP settings are optional and inherit from global config
# 4. Agents override global settings by providing their own values

agents:
# Example 1: Simple custom research agent with overrides
custom_research_agent:
base_class: "sgr_deep_research.core.SGRAgent"
# Optional: Override LLM settings for this agent
openai:
model: "gpt-4o"
temperature: 0.3
max_tokens: 16000
# api_key: "your-custom-api-key" # Optional: use different API key
# base_url: "https://api.openai.com/v1" # Optional: use different endpoint
# proxy: "http://127.0.0.1:8080" # Optional: use proxy

# Optional: Override search settings
search:
max_results: 15
max_pages: 8
content_limit: 2000

# Optional: Execution configuration
execution:
max_steps: 8
max_iterations: 15
max_clarifications: 5
max_searches: 6
mcp_context_limit: 20000
logs_dir: "logs/custom_agent"
reports_dir: "reports/custom_agent"

# Optional: MCP configuration
mcp:
mcpServers:
deepwiki:
url: "https://mcp.deepwiki.com/mcp"

# Tools this agent can use (must be registered in tool registry)
tools:
- "WebSearchTool"
- "ExtractPageContentTool"
- "CreateReportTool"
- "ClarificationTool"
- "GeneratePlanTool"
- "AdaptPlanTool"
- "FinalAnswerTool"

# Example 2: Minimal agent with defaults
simple_agent:
base_class: "SGRToolCallingResearchAgent"

# Only override what's needed
llm:
model: "gpt-4o-mini"

tools:
- "WebSearchTool"
- "FinalAnswerTool"

# Example 3: Fast research agent optimized for speed
fast_research_agent:
base_class: "SGRToolCallingAgent"

llm:
model: "gpt-4o-mini"
temperature: 0.1
max_tokens: 4000

execution:
max_steps: 4
max_iterations: 8
max_clarifications: 2
max_searches: 3

tools:
- "WebSearchTool"
- "CreateReportTool"
- "FinalAnswerTool"
- "ReasoningTool"

# Example 4: Specialized technical analyst with custom prompts
technical_analyst:
base_class: "SGRAgent"

llm:
model: "gpt-4o"
temperature: 0.2

prompts:
system_prompt: "You are a highly specialized technical analyst."

execution:
max_steps: 10
max_iterations: 20
max_clarifications: 3
max_searches: 8

tools:
- "WebSearchTool"
- "ExtractPageContentTool"
- "CreateReportTool"
- "ClarificationTool"
- "FinalAnswerTool"

# Example 5: Agent using inline prompts instead of files
inline_prompt_agent:
base_class: "SGRResearchAgent"

prompts:
system_prompt_str: |
You are a helpful research assistant.
Your goal is to provide accurate and concise information.
initial_user_request_str: |
User request: {user_request}
Please analyze and respond.
clarification_response_str: |
I need clarification on: {clarification_needed}

tools:
- "WebSearchTool"
- "FinalAnswerTool"
142 changes: 142 additions & 0 deletions services/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,142 @@
# SGR Deep Research - Docker Deployment

Запуск полного стека (backend + frontend) через Docker Compose.

## Быстрый старт

1. **Скопируйте `.env.example` в `.env`:**

```bash
cp .env.example .env
```

2. **Отредактируйте `.env` при необходимости** (опционально)

3. **Запустите все сервисы:**

```bash
docker-compose up -d --build
```

4. **Откройте в браузере:**

- Frontend: http://localhost:5174
- Backend API: http://localhost:8010
- API Docs: http://localhost:8010/docs

## Управление

### Запуск

```bash
# Запуск всех сервисов
docker-compose up -d

# Запуск с пересборкой
docker-compose up -d --build

# Запуск только backend
docker-compose up -d sgr-backend

# Запуск только frontend
docker-compose up -d sgr-frontend
```

### Остановка

```bash
# Остановить все сервисы
docker-compose down

# Остановить и удалить volumes
docker-compose down -v
```

### Логи

```bash
# Все логи
docker-compose logs -f

# Логи backend
docker-compose logs -f sgr-backend

# Логи frontend
docker-compose logs -f sgr-frontend
```

### Перезапуск

```bash
# Перезапустить все
docker-compose restart

# Перезапустить только backend
docker-compose restart sgr-backend
```

## Конфигурация

### Переменные окружения (.env)

```bash
# Backend
BACKEND_PORT=8010 # Порт для backend API

# Frontend
FRONTEND_PORT=5174 # Порт для frontend
VITE_API_BASE_URL=http://localhost:8010 # URL backend API
VITE_APP_ENV=production # Окружение (production/development)

# Transcription API (опционально)
VITE_TRANSCRIPTION_API_URL=https://speechcoreai.com/api
VITE_TRANSCRIPTION_API_TOKEN=your_token_here
```

### Структура сервисов

- **sgr-backend**: FastAPI backend на порту 8010

- Healthcheck: проверяет `/health` каждые 30 секунд
- Volumes: код, конфиги, логи, отчеты

- **sgr-frontend**: Nginx + Vue.js frontend на порту 5174

- Зависит от backend (запускается после healthcheck)
- Статические файлы собираются при сборке образа

### Сеть

Оба сервиса находятся в одной Docker сети `sgr-network`, что позволяет им взаимодействовать по именам контейнеров.

## Troubleshooting

### Frontend не может подключиться к backend

Проверьте, что `VITE_API_BASE_URL` в `.env` указывает на правильный URL backend.

### Backend не стартует

Проверьте логи:

```bash
docker-compose logs sgr-backend
```

Убедитесь, что `config.yaml` и `logging_config.yaml` существуют в корне проекта.

### Порты заняты

Измените порты в `.env`:

```bash
BACKEND_PORT=8011
FRONTEND_PORT=5175
```

Затем перезапустите:

```bash
docker-compose down
docker-compose up -d
```
37 changes: 30 additions & 7 deletions services/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,47 @@
services:
sgr:
sgr-backend:
build:
context: ./api_service
dockerfile: Dockerfile
container_name: sgr-deep-research
container_name: sgr-deep-research-backend
restart: unless-stopped

ports:
- "8010:8010"
- "${BACKEND_PORT:-8010}:8010"
volumes:
- ../sgr_deep_research:/app/sgr_deep_research:ro
- ../config.yaml:/app/config.yaml:ro
- ../agents.yaml:/app/agents.yaml:ro
- ../logging_config.yaml:/app/logging_config.yaml:ro
- ./logs:/app/logs
- ./reports:/app/reports

- ./logs:/app/logs
- ./reports:/app/reports
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:8010/health"]
interval: 30s
timeout: 10s
retries: 3
start_period: 40s
networks:
- sgr-network

sgr-frontend:
build:
context: ../sgr-deep-research-frontend
dockerfile: Dockerfile
args:
- VITE_API_BASE_URL=${VITE_API_BASE_URL:-http://localhost:8010}
- VITE_APP_ENV=${VITE_APP_ENV:-production}
- VITE_TRANSCRIPTION_API_URL=${VITE_TRANSCRIPTION_API_URL:-https://speechcoreai.com/api}
- VITE_TRANSCRIPTION_API_TOKEN=${VITE_TRANSCRIPTION_API_TOKEN:-}
container_name: sgr-deep-research-frontend
restart: unless-stopped
ports:
- "${FRONTEND_PORT:-5173}:80"
depends_on:
sgr-backend:
condition: service_healthy
networks:
- sgr-network

networks:
sgr-network:
driver: bridge
21 changes: 21 additions & 0 deletions sgr-deep-research-frontend/.dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# dependencies
/node_modules
.idea*

# production
/dist

*.tar

# misc
.DS_Store
*.pem
.vscode

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# typescript
*.tsbuildinfo
Loading