sgr-agent-core 0.6.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- sgr_agent_core-0.6.0/LICENSE +21 -0
- sgr_agent_core-0.6.0/MANIFEST.in +8 -0
- sgr_agent_core-0.6.0/PKG-INFO +156 -0
- sgr_agent_core-0.6.0/README.md +101 -0
- sgr_agent_core-0.6.0/agents.yaml.example +130 -0
- sgr_agent_core-0.6.0/config.yaml.example +112 -0
- sgr_agent_core-0.6.0/pyproject.toml +120 -0
- sgr_agent_core-0.6.0/setup.cfg +4 -0
- sgr_agent_core-0.6.0/sgr_agent_core/__init__.py +73 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agent_config.py +123 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agent_definition.py +294 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agent_factory.py +205 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agents/__init__.py +11 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agents/sgr_agent.py +92 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agents/sgr_tool_calling_agent.py +133 -0
- sgr_agent_core-0.6.0/sgr_agent_core/agents/tool_calling_agent.py +83 -0
- sgr_agent_core-0.6.0/sgr_agent_core/base_agent.py +227 -0
- sgr_agent_core-0.6.0/sgr_agent_core/base_tool.py +60 -0
- sgr_agent_core-0.6.0/sgr_agent_core/models.py +74 -0
- sgr_agent_core-0.6.0/sgr_agent_core/next_step_tool.py +67 -0
- sgr_agent_core-0.6.0/sgr_agent_core/prompts/__init__.py +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core/prompts/clarification_response.txt +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core/prompts/initial_user_request.txt +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core/prompts/research_system_prompt.txt +65 -0
- sgr_agent_core-0.6.0/sgr_agent_core/prompts/system_prompt.txt +45 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/__init__.py +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/__main__.py +61 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/app.py +35 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/endpoints.py +151 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/models.py +126 -0
- sgr_agent_core-0.6.0/sgr_agent_core/server/settings.py +37 -0
- sgr_agent_core-0.6.0/sgr_agent_core/services/__init__.py +14 -0
- sgr_agent_core-0.6.0/sgr_agent_core/services/mcp_service.py +51 -0
- sgr_agent_core-0.6.0/sgr_agent_core/services/prompt_loader.py +49 -0
- sgr_agent_core-0.6.0/sgr_agent_core/services/registry.py +126 -0
- sgr_agent_core-0.6.0/sgr_agent_core/services/tavily_search.py +107 -0
- sgr_agent_core-0.6.0/sgr_agent_core/stream.py +107 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/__init__.py +30 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/adapt_plan_tool.py +29 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/clarification_tool.py +38 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/create_report_tool.py +84 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/extract_page_content_tool.py +76 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/final_answer_tool.py +38 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/generate_plan_tool.py +31 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/reasoning_tool.py +48 -0
- sgr_agent_core-0.6.0/sgr_agent_core/tools/web_search_tool.py +89 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/PKG-INFO +156 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/SOURCES.txt +102 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/dependency_links.txt +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/entry_points.txt +2 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/not-zip-safe +1 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/requires.txt +25 -0
- sgr_agent_core-0.6.0/sgr_agent_core.egg-info/top_level.txt +1 -0
- sgr_agent_core-0.6.0/tests/test_agent_config_integration.py +184 -0
- sgr_agent_core-0.6.0/tests/test_agent_definition.py +122 -0
- sgr_agent_core-0.6.0/tests/test_agent_e2e.py +306 -0
- sgr_agent_core-0.6.0/tests/test_agent_factory.py +821 -0
- sgr_agent_core-0.6.0/tests/test_agents_loading.py +611 -0
- sgr_agent_core-0.6.0/tests/test_api_endpoints.py +496 -0
- sgr_agent_core-0.6.0/tests/test_api_models.py +596 -0
- sgr_agent_core-0.6.0/tests/test_base_agent.py +500 -0
- sgr_agent_core-0.6.0/tests/test_base_tool.py +54 -0
- sgr_agent_core-0.6.0/tests/test_models.py +313 -0
- sgr_agent_core-0.6.0/tests/test_prompts.py +299 -0
- sgr_agent_core-0.6.0/tests/test_streaming.py +583 -0
- sgr_agent_core-0.6.0/tests/test_tools.py +150 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 vamplabAI
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
include sgr_agent_core/core/prompts/system_prompt.txt
|
|
2
|
+
include sgr_agent_core/core/prompts/research_system_prompt.txt
|
|
3
|
+
include sgr_agent_core/core/prompts/initial_user_request.txt
|
|
4
|
+
include sgr_agent_core/core/prompts/clarification_response.txt
|
|
5
|
+
include LICENSE
|
|
6
|
+
include README.md
|
|
7
|
+
include agents.yaml.example
|
|
8
|
+
include config.yaml.example
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sgr-agent-core
|
|
3
|
+
Version: 0.6.0
|
|
4
|
+
Summary: SGR Agent Core - Schema-Guided Reasoning for building agent
|
|
5
|
+
Author: virrius, VaKovaLskii, abdullin, EvilFreelancer, Shadekss, mixaill76
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/vamplabAI/sgr-agent-core
|
|
8
|
+
Project-URL: Repository, https://github.com/vamplabAI/sgr-agent-core
|
|
9
|
+
Project-URL: Issues, https://github.com/vamplabAI/sgr-agent-core/issues
|
|
10
|
+
Project-URL: Documentation, https://vamplabai.github.io/sgr-agent-core/
|
|
11
|
+
Project-URL: SGR Concept Creator - @abdullin, https://t.me/llm_under_hood
|
|
12
|
+
Project-URL: Coordinator - @VaKovaLskii, https://t.me/neuraldeep
|
|
13
|
+
Project-URL: Core Developer - @virrius, https://t.me/virrius_tech
|
|
14
|
+
Project-URL: Core Developer - @EvilFreelancer, https://t.me/evilfreelancer
|
|
15
|
+
Project-URL: DevOps & Deployment - @mixaill76, https://t.me/mixaill76
|
|
16
|
+
Project-URL: Hybrid FC research - @Shadekss, https://t.me/Shadekss
|
|
17
|
+
Keywords: ai,research,reasoning,schema-guided,openai
|
|
18
|
+
Classifier: Development Status :: 3 - Alpha
|
|
19
|
+
Classifier: Intended Audience :: Developers
|
|
20
|
+
Classifier: Intended Audience :: Science/Research
|
|
21
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
22
|
+
Classifier: Programming Language :: Python :: 3
|
|
23
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
24
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
26
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
27
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
28
|
+
Requires-Python: >=3.11
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Requires-Dist: PyYAML>=6.0
|
|
32
|
+
Requires-Dist: python-dateutil>=2.8.0
|
|
33
|
+
Requires-Dist: pydantic>=2.0.0
|
|
34
|
+
Requires-Dist: pydantic-settings>=2.10.1
|
|
35
|
+
Requires-Dist: openai>=1.0.0
|
|
36
|
+
Requires-Dist: httpx[socks]>=0.25.0
|
|
37
|
+
Requires-Dist: tavily-python>=0.3.0
|
|
38
|
+
Requires-Dist: fastapi>=0.116.1
|
|
39
|
+
Requires-Dist: uvicorn>=0.35.0
|
|
40
|
+
Requires-Dist: fastmcp>=2.12.4
|
|
41
|
+
Requires-Dist: jambo>=0.1.3.post2
|
|
42
|
+
Provides-Extra: dev
|
|
43
|
+
Requires-Dist: pytest>=7.0.0; extra == "dev"
|
|
44
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "dev"
|
|
45
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "dev"
|
|
46
|
+
Requires-Dist: black>=23.0.0; extra == "dev"
|
|
47
|
+
Requires-Dist: isort>=5.12.0; extra == "dev"
|
|
48
|
+
Requires-Dist: flake8>=6.0.0; extra == "dev"
|
|
49
|
+
Requires-Dist: mypy>=1.0.0; extra == "dev"
|
|
50
|
+
Provides-Extra: tests
|
|
51
|
+
Requires-Dist: pytest>=7.0.0; extra == "tests"
|
|
52
|
+
Requires-Dist: pytest-cov>=4.0.0; extra == "tests"
|
|
53
|
+
Requires-Dist: pytest-asyncio>=0.21.0; extra == "tests"
|
|
54
|
+
Dynamic: license-file
|
|
55
|
+
|
|
56
|
+
# SGR Agent Core — the first SGR open-source agentic framework for Schema-Guided Reasoning
|
|
57
|
+
|
|
58
|
+
## Description
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
Open-source agentic framework for building intelligent research agents using Schema-Guided Reasoning. The project provides a core library with a extendable BaseAgent interface implementing a two-phase architecture and multiple ready-to-use research agent implementations built on top of it.
|
|
62
|
+
|
|
63
|
+
The library includes extensible tools for search, reasoning, and clarification, real-time streaming responses, OpenAI-compatible REST API. Works with any OpenAI-compatible LLM, including local models for fully private research.
|
|
64
|
+
|
|
65
|
+
______________________________________________________________________
|
|
66
|
+
|
|
67
|
+
## Documentation
|
|
68
|
+
|
|
69
|
+
> **Get started quickly with our documentation:**
|
|
70
|
+
|
|
71
|
+
- **[Project Docs](https://vamplabai.github.io/sgr-agent-core/)** - Complete project documentation
|
|
72
|
+
- **[Framework Quick Start Guide](https://vamplabai.github.io/sgr-agent-core/framework/first-steps/)** - Get up and running in minutes
|
|
73
|
+
- **[DeepSearch Service Documentation](https://vamplabai.github.io/sgr-agent-core/sgr-api/SGR-Quick-Start/)** - REST API reference with examples
|
|
74
|
+
|
|
75
|
+
______________________________________________________________________
|
|
76
|
+
|
|
77
|
+
## Quick Start
|
|
78
|
+
|
|
79
|
+
### Installation
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install sgr-agent-core
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### Running Research Agents
|
|
86
|
+
|
|
87
|
+
The project includes example research agent configurations in the `examples/` directory. To get started with deep research agents:
|
|
88
|
+
|
|
89
|
+
1. Copy and configure the config file:
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
cp examples/sgr_deep_research/config.yaml my_config.yaml
|
|
93
|
+
# Edit my_config.yaml and set your API keys:
|
|
94
|
+
# - llm.api_key: Your OpenAI API key
|
|
95
|
+
# - search.tavily_api_key: Your Tavily API key (optional)
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
2. Run the API server using the `sgr` utility:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
sgr --config-file examples/sgr_deep_research/config.yaml
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
The server will start on `http://localhost:8010` with OpenAI-compatible API endpoints.
|
|
105
|
+
|
|
106
|
+
> **Note:** You can also run the server directly with Python:
|
|
107
|
+
>
|
|
108
|
+
> ```bash
|
|
109
|
+
> python -m sgr_agent_core.server --config-file examples/sgr_deep_research/config.yaml
|
|
110
|
+
> ```
|
|
111
|
+
|
|
112
|
+
For more examples and detailed usage instructions, see the [examples/](examples/) directory.
|
|
113
|
+
|
|
114
|
+
______________________________________________________________________
|
|
115
|
+
|
|
116
|
+
## Benchmarking
|
|
117
|
+
|
|
118
|
+

|
|
119
|
+
|
|
120
|
+
**Performance Metrics on gpt-4.1-mini:**
|
|
121
|
+
|
|
122
|
+
- **Accuracy:** 86.08%
|
|
123
|
+
- **Correct:** 3,724 answers
|
|
124
|
+
- **Incorrect:** 554 answers
|
|
125
|
+
- **Not Attempted:** 48 answers
|
|
126
|
+
|
|
127
|
+
More detailed benchmark results are available [here](https://github.com/vamplabAI/sgr-agent-core/blob/main/benchmark/simpleqa_benchmark_results.md).
|
|
128
|
+
|
|
129
|
+
______________________________________________________________________
|
|
130
|
+
|
|
131
|
+
## Open-Source Development Team
|
|
132
|
+
|
|
133
|
+
*All development is driven by pure enthusiasm and open-source community collaboration. We welcome contributors of all skill levels!*
|
|
134
|
+
|
|
135
|
+
- **SGR Concept Creator** // [@abdullin](https://t.me/llm_under_hood)
|
|
136
|
+
- **Project Coordinator & Vision** // [@VaKovaLskii](https://t.me/neuraldeep)
|
|
137
|
+
- **Lead Core Developer** // [@virrius](https://t.me/virrius_tech)
|
|
138
|
+
- **API Development** // [@EvilFreelancer](https://t.me/evilfreelancer)
|
|
139
|
+
- **DevOps & Deployment** // [@mixaill76](https://t.me/mixaill76)
|
|
140
|
+
- **Hybrid FC research** // [@Shadekss](https://t.me/Shadekss)
|
|
141
|
+
|
|
142
|
+
If you have any questions - feel free to join our [community chat](https://t.me/sgragentcore)↗️ or reach out [Valerii Kovalskii](https://www.linkedin.com/in/vakovalskii/)↗️.
|
|
143
|
+
|
|
144
|
+
## Special Thanks To:
|
|
145
|
+
|
|
146
|
+
This project is developed by the **neuraldeep** community. It is inspired by the Schema-Guided Reasoning (SGR) work and [SGR Agent Demo](https://abdullin.com/schema-guided-reasoning/demo)↗️ delivered by "LLM Under the Hood" community and AI R&D Hub of [TIMETOACT GROUP Österreich](https://www.timetoact-group.at)↗️
|
|
147
|
+
|
|
148
|
+

|
|
149
|
+
|
|
150
|
+
This project is supported by the AI R&D team at red_mad_robot, providing research capacity, engineering expertise, infrastructure, and operational support.
|
|
151
|
+
|
|
152
|
+
Learn more about red_mad_robot: [redmadrobot.ai](https://redmadrobot.ai/)↗️ [habr](https://habr.com/ru/companies/redmadrobot/articles/)↗️ [telegram](https://t.me/Redmadnews/)↗️
|
|
153
|
+
|
|
154
|
+
## Star History
|
|
155
|
+
|
|
156
|
+
[](https://star-history.com/#vamplabAI/sgr-agent-core&Date)
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
# SGR Agent Core — the first SGR open-source agentic framework for Schema-Guided Reasoning
|
|
2
|
+
|
|
3
|
+
## Description
|
|
4
|
+
|
|
5
|
+

|
|
6
|
+
Open-source agentic framework for building intelligent research agents using Schema-Guided Reasoning. The project provides a core library with a extendable BaseAgent interface implementing a two-phase architecture and multiple ready-to-use research agent implementations built on top of it.
|
|
7
|
+
|
|
8
|
+
The library includes extensible tools for search, reasoning, and clarification, real-time streaming responses, OpenAI-compatible REST API. Works with any OpenAI-compatible LLM, including local models for fully private research.
|
|
9
|
+
|
|
10
|
+
______________________________________________________________________
|
|
11
|
+
|
|
12
|
+
## Documentation
|
|
13
|
+
|
|
14
|
+
> **Get started quickly with our documentation:**
|
|
15
|
+
|
|
16
|
+
- **[Project Docs](https://vamplabai.github.io/sgr-agent-core/)** - Complete project documentation
|
|
17
|
+
- **[Framework Quick Start Guide](https://vamplabai.github.io/sgr-agent-core/framework/first-steps/)** - Get up and running in minutes
|
|
18
|
+
- **[DeepSearch Service Documentation](https://vamplabai.github.io/sgr-agent-core/sgr-api/SGR-Quick-Start/)** - REST API reference with examples
|
|
19
|
+
|
|
20
|
+
______________________________________________________________________
|
|
21
|
+
|
|
22
|
+
## Quick Start
|
|
23
|
+
|
|
24
|
+
### Installation
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
pip install sgr-agent-core
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Running Research Agents
|
|
31
|
+
|
|
32
|
+
The project includes example research agent configurations in the `examples/` directory. To get started with deep research agents:
|
|
33
|
+
|
|
34
|
+
1. Copy and configure the config file:
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
cp examples/sgr_deep_research/config.yaml my_config.yaml
|
|
38
|
+
# Edit my_config.yaml and set your API keys:
|
|
39
|
+
# - llm.api_key: Your OpenAI API key
|
|
40
|
+
# - search.tavily_api_key: Your Tavily API key (optional)
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
2. Run the API server using the `sgr` utility:
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
sgr --config-file examples/sgr_deep_research/config.yaml
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
The server will start on `http://localhost:8010` with OpenAI-compatible API endpoints.
|
|
50
|
+
|
|
51
|
+
> **Note:** You can also run the server directly with Python:
|
|
52
|
+
>
|
|
53
|
+
> ```bash
|
|
54
|
+
> python -m sgr_agent_core.server --config-file examples/sgr_deep_research/config.yaml
|
|
55
|
+
> ```
|
|
56
|
+
|
|
57
|
+
For more examples and detailed usage instructions, see the [examples/](examples/) directory.
|
|
58
|
+
|
|
59
|
+
______________________________________________________________________
|
|
60
|
+
|
|
61
|
+
## Benchmarking
|
|
62
|
+
|
|
63
|
+

|
|
64
|
+
|
|
65
|
+
**Performance Metrics on gpt-4.1-mini:**
|
|
66
|
+
|
|
67
|
+
- **Accuracy:** 86.08%
|
|
68
|
+
- **Correct:** 3,724 answers
|
|
69
|
+
- **Incorrect:** 554 answers
|
|
70
|
+
- **Not Attempted:** 48 answers
|
|
71
|
+
|
|
72
|
+
More detailed benchmark results are available [here](https://github.com/vamplabAI/sgr-agent-core/blob/main/benchmark/simpleqa_benchmark_results.md).
|
|
73
|
+
|
|
74
|
+
______________________________________________________________________
|
|
75
|
+
|
|
76
|
+
## Open-Source Development Team
|
|
77
|
+
|
|
78
|
+
*All development is driven by pure enthusiasm and open-source community collaboration. We welcome contributors of all skill levels!*
|
|
79
|
+
|
|
80
|
+
- **SGR Concept Creator** // [@abdullin](https://t.me/llm_under_hood)
|
|
81
|
+
- **Project Coordinator & Vision** // [@VaKovaLskii](https://t.me/neuraldeep)
|
|
82
|
+
- **Lead Core Developer** // [@virrius](https://t.me/virrius_tech)
|
|
83
|
+
- **API Development** // [@EvilFreelancer](https://t.me/evilfreelancer)
|
|
84
|
+
- **DevOps & Deployment** // [@mixaill76](https://t.me/mixaill76)
|
|
85
|
+
- **Hybrid FC research** // [@Shadekss](https://t.me/Shadekss)
|
|
86
|
+
|
|
87
|
+
If you have any questions - feel free to join our [community chat](https://t.me/sgragentcore)↗️ or reach out [Valerii Kovalskii](https://www.linkedin.com/in/vakovalskii/)↗️.
|
|
88
|
+
|
|
89
|
+
## Special Thanks To:
|
|
90
|
+
|
|
91
|
+
This project is developed by the **neuraldeep** community. It is inspired by the Schema-Guided Reasoning (SGR) work and [SGR Agent Demo](https://abdullin.com/schema-guided-reasoning/demo)↗️ delivered by "LLM Under the Hood" community and AI R&D Hub of [TIMETOACT GROUP Österreich](https://www.timetoact-group.at)↗️
|
|
92
|
+
|
|
93
|
+

|
|
94
|
+
|
|
95
|
+
This project is supported by the AI R&D team at red_mad_robot, providing research capacity, engineering expertise, infrastructure, and operational support.
|
|
96
|
+
|
|
97
|
+
Learn more about red_mad_robot: [redmadrobot.ai](https://redmadrobot.ai/)↗️ [habr](https://habr.com/ru/companies/redmadrobot/articles/)↗️ [telegram](https://t.me/Redmadnews/)↗️
|
|
98
|
+
|
|
99
|
+
## Star History
|
|
100
|
+
|
|
101
|
+
[](https://star-history.com/#vamplabAI/sgr-agent-core&Date)
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Example Custom Agents Configuration
|
|
2
|
+
# =====================================
|
|
3
|
+
# This file demonstrates how to define custom agents for SGR Agent Core.
|
|
4
|
+
|
|
5
|
+
# Notes:
|
|
6
|
+
# ------
|
|
7
|
+
# 1. Agent names must be unique or will be overridden
|
|
8
|
+
# 2. All tools must be registered in the tool registry
|
|
9
|
+
# 3. LLM, Search, Prompts, Execution, MCP settings are optional and inherit from global config
|
|
10
|
+
# 4. Agents override global settings by providing their own values
|
|
11
|
+
|
|
12
|
+
agents:
|
|
13
|
+
# Example 1: Simple custom research agent with overrides
|
|
14
|
+
custom_research_agent:
|
|
15
|
+
base_class: "sgr_agent_core.agents.sgr_agent.SGRAgent"
|
|
16
|
+
# Optional: Override LLM settings for this agentк
|
|
17
|
+
llm:
|
|
18
|
+
model: "gpt-4o"
|
|
19
|
+
temperature: 0.3
|
|
20
|
+
max_tokens: 16000
|
|
21
|
+
# api_key: "your-custom-api-key" # Optional: use different API key
|
|
22
|
+
# base_url: "https://api.openai.com/v1" # Optional: use different endpoint
|
|
23
|
+
# proxy: "http://127.0.0.1:8080" # Optional: use proxy
|
|
24
|
+
|
|
25
|
+
# Optional: Override search settings
|
|
26
|
+
search:
|
|
27
|
+
max_results: 15
|
|
28
|
+
max_pages: 8
|
|
29
|
+
content_limit: 2000
|
|
30
|
+
|
|
31
|
+
# Optional: Execution configuration
|
|
32
|
+
execution:
|
|
33
|
+
max_steps: 8
|
|
34
|
+
max_iterations: 15
|
|
35
|
+
max_clarifications: 5
|
|
36
|
+
max_searches: 6
|
|
37
|
+
mcp_context_limit: 20000
|
|
38
|
+
logs_dir: "logs/custom_agent"
|
|
39
|
+
reports_dir: "reports/custom_agent"
|
|
40
|
+
|
|
41
|
+
# Optional: MCP configuration
|
|
42
|
+
mcp:
|
|
43
|
+
mcpServers:
|
|
44
|
+
deepwiki:
|
|
45
|
+
url: "https://mcp.deepwiki.com/mcp"
|
|
46
|
+
|
|
47
|
+
# Tools this agent can use (names from tools section in config)
|
|
48
|
+
tools:
|
|
49
|
+
- "web_search_tool"
|
|
50
|
+
- "extract_page_content_tool"
|
|
51
|
+
- "create_report_tool"
|
|
52
|
+
- "clarification_tool"
|
|
53
|
+
- "generate_plan_tool"
|
|
54
|
+
- "adapt_plan_tool"
|
|
55
|
+
- "final_answer_tool"
|
|
56
|
+
|
|
57
|
+
# Example 2: Minimal agent with defaults
|
|
58
|
+
simple_agent:
|
|
59
|
+
base_class: "SGRToolCallingAgent"
|
|
60
|
+
|
|
61
|
+
# Only override what's needed
|
|
62
|
+
llm:
|
|
63
|
+
model: "gpt-4o-mini"
|
|
64
|
+
|
|
65
|
+
tools:
|
|
66
|
+
- "WebSearchTool"
|
|
67
|
+
- "FinalAnswerTool"
|
|
68
|
+
|
|
69
|
+
# Example 3: Fast research agent optimized for speed
|
|
70
|
+
fast_research_agent:
|
|
71
|
+
base_class: "SGRToolCallingAgent"
|
|
72
|
+
|
|
73
|
+
llm:
|
|
74
|
+
model: "gpt-4o-mini"
|
|
75
|
+
temperature: 0.1
|
|
76
|
+
max_tokens: 4000
|
|
77
|
+
|
|
78
|
+
execution:
|
|
79
|
+
max_steps: 4
|
|
80
|
+
max_iterations: 8
|
|
81
|
+
max_clarifications: 2
|
|
82
|
+
max_searches: 3
|
|
83
|
+
|
|
84
|
+
tools:
|
|
85
|
+
- "WebSearchTool"
|
|
86
|
+
- "CreateReportTool"
|
|
87
|
+
- "FinalAnswerTool"
|
|
88
|
+
- "ReasoningTool"
|
|
89
|
+
|
|
90
|
+
# Example 4: Specialized technical analyst with custom prompts
|
|
91
|
+
technical_analyst:
|
|
92
|
+
base_class: "SGRAgent"
|
|
93
|
+
|
|
94
|
+
llm:
|
|
95
|
+
model: "gpt-4o"
|
|
96
|
+
temperature: 0.2
|
|
97
|
+
|
|
98
|
+
prompts:
|
|
99
|
+
system_prompt: "You are a highly specialized technical analyst."
|
|
100
|
+
|
|
101
|
+
execution:
|
|
102
|
+
max_steps: 10
|
|
103
|
+
max_iterations: 20
|
|
104
|
+
max_clarifications: 3
|
|
105
|
+
max_searches: 8
|
|
106
|
+
|
|
107
|
+
tools:
|
|
108
|
+
- "WebSearchTool"
|
|
109
|
+
- "ExtractPageContentTool"
|
|
110
|
+
- "CreateReportTool"
|
|
111
|
+
- "ClarificationTool"
|
|
112
|
+
- "FinalAnswerTool"
|
|
113
|
+
|
|
114
|
+
# Example 5: Agent using inline prompts instead of files
|
|
115
|
+
inline_prompt_agent:
|
|
116
|
+
base_class: "SGRAgent"
|
|
117
|
+
|
|
118
|
+
prompts:
|
|
119
|
+
system_prompt_str: |
|
|
120
|
+
You are a helpful research assistant.
|
|
121
|
+
Your goal is to provide accurate and concise information.
|
|
122
|
+
initial_user_request_str: |
|
|
123
|
+
User request: {user_request}
|
|
124
|
+
Please analyze and respond.
|
|
125
|
+
clarification_response_str: |
|
|
126
|
+
I need clarification on: {clarification_needed}
|
|
127
|
+
|
|
128
|
+
tools:
|
|
129
|
+
- "WebSearchTool"
|
|
130
|
+
- "FinalAnswerTool"
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# SGR Agent Core - Configuration Template
|
|
2
|
+
# Copy this file to config.yaml and fill in your data
|
|
3
|
+
|
|
4
|
+
# LLM Configuration
|
|
5
|
+
llm:
|
|
6
|
+
api_key: "your-openai-api-key-here" # Your OpenAI API key
|
|
7
|
+
base_url: "https://api.openai.com/v1" # API base URL
|
|
8
|
+
model: "gpt-4o-mini" # Model name
|
|
9
|
+
max_tokens: 8000 # Max output tokens
|
|
10
|
+
temperature: 0.4 # Temperature (0.0-1.0)
|
|
11
|
+
# proxy: "socks5://127.0.0.1:1081" # Optional proxy (socks5:// or http://)
|
|
12
|
+
|
|
13
|
+
# Search Configuration (Tavily)
|
|
14
|
+
search:
|
|
15
|
+
tavily_api_key: "your-tavily-api-key-here" # Tavily API key (get at tavily.com)
|
|
16
|
+
tavily_api_base_url: "https://api.tavily.com" # Tavily API URL
|
|
17
|
+
max_searches: 4 # Max search operations
|
|
18
|
+
max_results: 10 # Max results in search query
|
|
19
|
+
content_limit: 1500 # Content char limit per source
|
|
20
|
+
|
|
21
|
+
# Execution Settings
|
|
22
|
+
execution:
|
|
23
|
+
max_clarifications: 3 # Max clarification requests
|
|
24
|
+
max_iterations: 10 # Max agent iterations
|
|
25
|
+
mcp_context_limit: 15000 # Max context length from MCP server response
|
|
26
|
+
logs_dir: "logs" # Directory for saving agent execution logs
|
|
27
|
+
reports_dir: "reports" # Directory for saving agent reports
|
|
28
|
+
|
|
29
|
+
# Prompts Configuration
|
|
30
|
+
# prompts:
|
|
31
|
+
# # Option 1: Use file paths (absolute or relative to project root)
|
|
32
|
+
# system_prompt_file: "path/to/your/system_prompt.txt"
|
|
33
|
+
# initial_user_request_file: "path/to/your/initial_user_request.txt"
|
|
34
|
+
# clarification_response_file: "path/to/your/clarification_response.txt"
|
|
35
|
+
|
|
36
|
+
# # Option 2: Provide prompts directly as strings
|
|
37
|
+
# system_prompt_str: "Your custom system prompt here..."
|
|
38
|
+
# initial_user_request_str: "Your custom initial request template..."
|
|
39
|
+
# clarification_response_str: "Your custom clarification template..."
|
|
40
|
+
|
|
41
|
+
# Note: If both file and string are provided, string takes precedence
|
|
42
|
+
|
|
43
|
+
# MCP (Model Context Protocol) Configuration
|
|
44
|
+
mcp:
|
|
45
|
+
mcpServers:
|
|
46
|
+
deepwiki:
|
|
47
|
+
url: "https://mcp.deepwiki.com/mcp"
|
|
48
|
+
|
|
49
|
+
# Add more MCP servers here:
|
|
50
|
+
# your_server:
|
|
51
|
+
# url: "https://your-mcp-server.com/mcp"
|
|
52
|
+
# headers:
|
|
53
|
+
# Authorization: "Bearer your-token"
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
# Note: The 'agents' field is optional and can be loaded from either:
|
|
57
|
+
# - This config.yaml file
|
|
58
|
+
# - Any separate file by GlobalConfig.definitions_from_yaml method
|
|
59
|
+
# See examples in agents.yaml.example for agent configuration options
|
|
60
|
+
|
|
61
|
+
tools:
|
|
62
|
+
# Core tools (base_class defaults to sgr_agent_core.tools.*)
|
|
63
|
+
my_custom_tool:
|
|
64
|
+
base_class: path.to.my.tools.CustomTool
|
|
65
|
+
my_other_tool:
|
|
66
|
+
base_class: "name_of_tool_class_in_registry"
|
|
67
|
+
|
|
68
|
+
agents:
|
|
69
|
+
custom_research_agent:
|
|
70
|
+
base_class: "sgr_agent_core.agents.sgr_agent.SGRAgent"
|
|
71
|
+
# Optional: Override LLM settings for this agent
|
|
72
|
+
llm:
|
|
73
|
+
model: "gpt-4o"
|
|
74
|
+
temperature: 0.3
|
|
75
|
+
max_tokens: 16000
|
|
76
|
+
# api_key: "your-custom-api-key" # Optional: use different API key
|
|
77
|
+
# base_url: "https://api.openai.com/v1" # Optional: use different endpoint
|
|
78
|
+
# proxy: "http://127.0.0.1:8080" # Optional: use proxy
|
|
79
|
+
|
|
80
|
+
# Optional: Override search settings
|
|
81
|
+
search:
|
|
82
|
+
max_results: 15
|
|
83
|
+
max_pages: 8
|
|
84
|
+
content_limit: 2000
|
|
85
|
+
|
|
86
|
+
# Optional: Execution configuration
|
|
87
|
+
execution:
|
|
88
|
+
max_steps: 8
|
|
89
|
+
max_iterations: 15
|
|
90
|
+
max_clarifications: 5
|
|
91
|
+
max_searches: 6
|
|
92
|
+
mcp_context_limit: 20000
|
|
93
|
+
logs_dir: "logs/custom_agent"
|
|
94
|
+
reports_dir: "reports/custom_agent"
|
|
95
|
+
|
|
96
|
+
# Optional: MCP configuration
|
|
97
|
+
mcp:
|
|
98
|
+
mcpServers:
|
|
99
|
+
deepwiki:
|
|
100
|
+
url: "https://mcp.deepwiki.com/mcp"
|
|
101
|
+
|
|
102
|
+
# Tools this agent can use (must be registered in tool registry)
|
|
103
|
+
tools:
|
|
104
|
+
- "WebSearchTool"
|
|
105
|
+
- "ExtractPageContentTool"
|
|
106
|
+
- "CreateReportTool"
|
|
107
|
+
- "ClarificationTool"
|
|
108
|
+
- "GeneratePlanTool"
|
|
109
|
+
- "AdaptPlanTool"
|
|
110
|
+
- "FinalAnswerTool"
|
|
111
|
+
- "my_custom_tool"
|
|
112
|
+
- "my_other_tool"
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=64.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "sgr-agent-core"
|
|
7
|
+
dynamic = ["version"]
|
|
8
|
+
description = "SGR Agent Core - Schema-Guided Reasoning for building agent"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "virrius"},
|
|
12
|
+
{name = "VaKovaLskii"},
|
|
13
|
+
{name = "abdullin"},
|
|
14
|
+
{name = "EvilFreelancer"},
|
|
15
|
+
{name = "Shadekss"},
|
|
16
|
+
{name = "mixaill76"}
|
|
17
|
+
]
|
|
18
|
+
requires-python = ">=3.11"
|
|
19
|
+
license = {text = "MIT"}
|
|
20
|
+
classifiers = [
|
|
21
|
+
"Development Status :: 3 - Alpha",
|
|
22
|
+
"Intended Audience :: Developers",
|
|
23
|
+
"Intended Audience :: Science/Research",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.11",
|
|
27
|
+
"Programming Language :: Python :: 3.12",
|
|
28
|
+
"Programming Language :: Python :: 3.13",
|
|
29
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
30
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
31
|
+
]
|
|
32
|
+
keywords = ["ai", "research", "reasoning", "schema-guided", "openai"]
|
|
33
|
+
|
|
34
|
+
dependencies = [
|
|
35
|
+
# Core dependencies
|
|
36
|
+
"PyYAML>=6.0",
|
|
37
|
+
"python-dateutil>=2.8.0",
|
|
38
|
+
"pydantic>=2.0.0",
|
|
39
|
+
"pydantic-settings>=2.10.1",
|
|
40
|
+
"openai>=1.0.0",
|
|
41
|
+
"httpx[socks]>=0.25.0",
|
|
42
|
+
# Search and research
|
|
43
|
+
"tavily-python>=0.3.0",
|
|
44
|
+
# Configuration and utilities
|
|
45
|
+
"fastapi>=0.116.1",
|
|
46
|
+
"uvicorn>=0.35.0",
|
|
47
|
+
"fastmcp>=2.12.4",
|
|
48
|
+
"jambo>=0.1.3.post2",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://github.com/vamplabAI/sgr-agent-core"
|
|
53
|
+
Repository = "https://github.com/vamplabAI/sgr-agent-core"
|
|
54
|
+
Issues = "https://github.com/vamplabAI/sgr-agent-core/issues"
|
|
55
|
+
Documentation = "https://vamplabai.github.io/sgr-agent-core/"
|
|
56
|
+
"SGR Concept Creator - @abdullin" = "https://t.me/llm_under_hood"
|
|
57
|
+
"Coordinator - @VaKovaLskii" = "https://t.me/neuraldeep"
|
|
58
|
+
"Core Developer - @virrius" = "https://t.me/virrius_tech"
|
|
59
|
+
"Core Developer - @EvilFreelancer" = "https://t.me/evilfreelancer"
|
|
60
|
+
"DevOps & Deployment - @mixaill76" = "https://t.me/mixaill76"
|
|
61
|
+
"Hybrid FC research - @Shadekss" = "https://t.me/Shadekss"
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
[project.scripts]
|
|
65
|
+
sgr = "sgr_agent_core.server.__main__:main"
|
|
66
|
+
|
|
67
|
+
[project.optional-dependencies]
|
|
68
|
+
dev = [
|
|
69
|
+
"pytest>=7.0.0",
|
|
70
|
+
"pytest-cov>=4.0.0",
|
|
71
|
+
"pytest-asyncio>=0.21.0",
|
|
72
|
+
"black>=23.0.0",
|
|
73
|
+
"isort>=5.12.0",
|
|
74
|
+
"flake8>=6.0.0",
|
|
75
|
+
"mypy>=1.0.0",
|
|
76
|
+
]
|
|
77
|
+
tests = [
|
|
78
|
+
"pytest>=7.0.0",
|
|
79
|
+
"pytest-cov>=4.0.0",
|
|
80
|
+
"pytest-asyncio>=0.21.0",
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
[tool.setuptools.packages.find]
|
|
84
|
+
where = ["."]
|
|
85
|
+
include = ["sgr_agent_core*"]
|
|
86
|
+
|
|
87
|
+
[tool.setuptools]
|
|
88
|
+
zip-safe = false
|
|
89
|
+
|
|
90
|
+
[tool.setuptools.dynamic]
|
|
91
|
+
version = {attr = "sgr_agent_core.__version__"}
|
|
92
|
+
|
|
93
|
+
[tool.setuptools.package-dir]
|
|
94
|
+
"" = "."
|
|
95
|
+
|
|
96
|
+
[tool.setuptools.package-data]
|
|
97
|
+
"sgr_agent_core" = ["**/*.yaml", "**/*.yml", "**/*.json", "**/*.txt"]
|
|
98
|
+
|
|
99
|
+
[tool.ruff]
|
|
100
|
+
target-version = "py312"
|
|
101
|
+
line-length = 120
|
|
102
|
+
|
|
103
|
+
[tool.ruff.lint]
|
|
104
|
+
# Add the `line-too-long` rule to the enforced rule set. By default, Ruff omits rules that
|
|
105
|
+
# overlap with the use of a formatter, like Black, but we can override this behavior by
|
|
106
|
+
# explicitly adding the rule.
|
|
107
|
+
extend-select = ["E501", "I"]
|
|
108
|
+
|
|
109
|
+
[tool.ruff.format]
|
|
110
|
+
docstring-code-format = true
|
|
111
|
+
line-ending = "lf"
|
|
112
|
+
|
|
113
|
+
[tool.pytest.ini_options]
|
|
114
|
+
asyncio_mode = "auto"
|
|
115
|
+
|
|
116
|
+
[tool.coverage.run]
|
|
117
|
+
source = ["sgr_agent_core"]
|
|
118
|
+
|
|
119
|
+
[tool.coverage.report]
|
|
120
|
+
show_missing = true
|