rqark-core 0.4.1__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.
Files changed (66) hide show
  1. rqark_core-0.4.1/.gitea/workflows/lint-and-test.yaml +43 -0
  2. rqark_core-0.4.1/.gitea/workflows/pypi-hub.yaml +31 -0
  3. rqark_core-0.4.1/.gitea/workflows/pypi.yaml +32 -0
  4. rqark_core-0.4.1/.gitignore +176 -0
  5. rqark_core-0.4.1/.python-version +1 -0
  6. rqark_core-0.4.1/.vscode/settings.json +37 -0
  7. rqark_core-0.4.1/AGENTS.md +4 -0
  8. rqark_core-0.4.1/LICENSE +18 -0
  9. rqark_core-0.4.1/PKG-INFO +132 -0
  10. rqark_core-0.4.1/README.md +120 -0
  11. rqark_core-0.4.1/example/base.py +47 -0
  12. rqark_core-0.4.1/example/model.py +1 -0
  13. rqark_core-0.4.1/example/use_plan.py +34 -0
  14. rqark_core-0.4.1/example/use_prompt.py +51 -0
  15. rqark_core-0.4.1/example/use_subagent.py +67 -0
  16. rqark_core-0.4.1/example/use_tool.py +53 -0
  17. rqark_core-0.4.1/pyproject.toml +58 -0
  18. rqark_core-0.4.1/src/rqark_core/__init__.py +0 -0
  19. rqark_core-0.4.1/src/rqark_core/_core/event.py +31 -0
  20. rqark_core-0.4.1/src/rqark_core/_core/stream.py +126 -0
  21. rqark_core-0.4.1/src/rqark_core/core.py +140 -0
  22. rqark_core-0.4.1/src/rqark_core/func/epistemic.py +246 -0
  23. rqark_core-0.4.1/src/rqark_core/func/image.py +41 -0
  24. rqark_core-0.4.1/src/rqark_core/libs/event.py +28 -0
  25. rqark_core-0.4.1/src/rqark_core/libs/gitignore.py +175 -0
  26. rqark_core-0.4.1/src/rqark_core/prompts/__init__.py +11 -0
  27. rqark_core-0.4.1/src/rqark_core/prompts/agents_md.py +17 -0
  28. rqark_core-0.4.1/src/rqark_core/prompts/anti_sycophancy.py +17 -0
  29. rqark_core-0.4.1/src/rqark_core/prompts/character.py +35 -0
  30. rqark_core-0.4.1/src/rqark_core/prompts/datetime.py +22 -0
  31. rqark_core-0.4.1/src/rqark_core/prompts/git_project.py +50 -0
  32. rqark_core-0.4.1/src/rqark_core/prompts/platform.py +17 -0
  33. rqark_core-0.4.1/src/rqark_core/prompts/role.py +15 -0
  34. rqark_core-0.4.1/src/rqark_core/prompts/subagent.py +25 -0
  35. rqark_core-0.4.1/src/rqark_core/prompts/workspace.py +13 -0
  36. rqark_core-0.4.1/src/rqark_core/tools/__init__.py +13 -0
  37. rqark_core-0.4.1/src/rqark_core/tools/edit_file.py +165 -0
  38. rqark_core-0.4.1/src/rqark_core/tools/exec.py +173 -0
  39. rqark_core-0.4.1/src/rqark_core/tools/git/__init__.py +6 -0
  40. rqark_core-0.4.1/src/rqark_core/tools/git/base_git.py +301 -0
  41. rqark_core-0.4.1/src/rqark_core/tools/git/gitea.py +439 -0
  42. rqark_core-0.4.1/src/rqark_core/tools/git/github.py +306 -0
  43. rqark_core-0.4.1/src/rqark_core/tools/git/gitlab.py +326 -0
  44. rqark_core-0.4.1/src/rqark_core/tools/grep.py +112 -0
  45. rqark_core-0.4.1/src/rqark_core/tools/list_dir.py +47 -0
  46. rqark_core-0.4.1/src/rqark_core/tools/plan_update.py +100 -0
  47. rqark_core-0.4.1/src/rqark_core/tools/read_file.py +61 -0
  48. rqark_core-0.4.1/src/rqark_core/tools/subagent.py +91 -0
  49. rqark_core-0.4.1/src/rqark_core/tools/web_fetch.py +84 -0
  50. rqark_core-0.4.1/src/rqark_core/tools/web_search.py +69 -0
  51. rqark_core-0.4.1/src/rqark_core/tools/write_file.py +44 -0
  52. rqark_core-0.4.1/src/rqark_core/types/chat.py +147 -0
  53. rqark_core-0.4.1/src/rqark_core/types/event.py +11 -0
  54. rqark_core-0.4.1/src/rqark_core/types/prompt.py +33 -0
  55. rqark_core-0.4.1/src/rqark_core/types/provider.py +70 -0
  56. rqark_core-0.4.1/src/rqark_core/types/tool.py +70 -0
  57. rqark_core-0.4.1/tests/test_chat.py +47 -0
  58. rqark_core-0.4.1/tests/test_exec.py +51 -0
  59. rqark_core-0.4.1/tests/test_git_release.py +120 -0
  60. rqark_core-0.4.1/tests/test_git_repos.py +41 -0
  61. rqark_core-0.4.1/tests/test_grep.py +146 -0
  62. rqark_core-0.4.1/tests/test_prompt_context.py +120 -0
  63. rqark_core-0.4.1/tests/test_tool_context.py +107 -0
  64. rqark_core-0.4.1/tests/test_tool_prompt_refresh.py +116 -0
  65. rqark_core-0.4.1/tests/test_usage.py +68 -0
  66. rqark_core-0.4.1/uv.lock +940 -0
@@ -0,0 +1,43 @@
1
+ name: Lint and Test
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ pull_request:
8
+ workflow_dispatch:
9
+
10
+ concurrency:
11
+ group: ci-${{ github.ref }}
12
+ cancel-in-progress: true
13
+
14
+ jobs:
15
+ check:
16
+ name: Lint, type check and test
17
+ runs-on: ubuntu-latest
18
+ steps:
19
+ - name: Checkout code
20
+ uses: actions/checkout@v4
21
+
22
+ - name: Install uv
23
+ uses: astral-sh/setup-uv@v3
24
+ with:
25
+ enable-cache: true
26
+
27
+ - name: Set up Python
28
+ run: uv python install 3.14
29
+
30
+ - name: Sync dependencies
31
+ run: uv sync
32
+
33
+ - name: Lint
34
+ run: uv run ruff check
35
+
36
+ - name: Format check
37
+ run: uv run ruff format --check
38
+
39
+ - name: Type check
40
+ run: uv run ty check
41
+
42
+ - name: Test
43
+ run: uv run pytest
@@ -0,0 +1,31 @@
1
+ name: Publish to PyPI Hub
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v3
18
+ with:
19
+ enable-cache: true
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.14
23
+
24
+ - name: Build the package
25
+ run: uv build
26
+
27
+ - name: Publish to PyPI
28
+ env:
29
+ UV_PUBLISH_USERNAME: __token__
30
+ UV_PUBLISH_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
31
+ run: uv publish
@@ -0,0 +1,32 @@
1
+ name: Build and Publish with uv
2
+
3
+ on:
4
+ push:
5
+ tags:
6
+ - 'v*'
7
+ workflow_dispatch:
8
+
9
+ jobs:
10
+ release:
11
+ runs-on: ubuntu-latest
12
+ steps:
13
+ - name: Checkout code
14
+ uses: actions/checkout@v4
15
+
16
+ - name: Install uv
17
+ uses: astral-sh/setup-uv@v3
18
+ with:
19
+ enable-cache: true
20
+
21
+ - name: Set up Python
22
+ run: uv python install 3.14
23
+
24
+ - name: Build the package
25
+ run: uv build
26
+
27
+ - name: Publish to Gitea PyPI
28
+ env:
29
+ UV_PUBLISH_URL: ${{ github.server_url }}/api/packages/${{ github.repository_owner }}/pypi
30
+ UV_PUBLISH_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
31
+ UV_PUBLISH_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
32
+ run: uv publish
@@ -0,0 +1,176 @@
1
+ # ---> Python
2
+ # Byte-compiled / optimized / DLL files
3
+ __pycache__/
4
+ *.py[cod]
5
+ *$py.class
6
+
7
+ # C extensions
8
+ *.so
9
+
10
+ # Distribution / packaging
11
+ .Python
12
+ build/
13
+ develop-eggs/
14
+ dist/
15
+ downloads/
16
+ eggs/
17
+ .eggs/
18
+ lib/
19
+ lib64/
20
+ parts/
21
+ sdist/
22
+ var/
23
+ wheels/
24
+ share/python-wheels/
25
+ *.egg-info/
26
+ .installed.cfg
27
+ *.egg
28
+ MANIFEST
29
+
30
+ # PyInstaller
31
+ # Usually these files are written by a python script from a template
32
+ # before PyInstaller builds the exe, so as to inject date/other infos into it.
33
+ *.manifest
34
+ *.spec
35
+
36
+ # Installer logs
37
+ pip-log.txt
38
+ pip-delete-this-directory.txt
39
+
40
+ # Unit test / coverage reports
41
+ htmlcov/
42
+ .tox/
43
+ .nox/
44
+ .coverage
45
+ .coverage.*
46
+ .cache
47
+ nosetests.xml
48
+ coverage.xml
49
+ *.cover
50
+ *.py,cover
51
+ .hypothesis/
52
+ .pytest_cache/
53
+ cover/
54
+
55
+ # Translations
56
+ *.mo
57
+ *.pot
58
+
59
+ # Django stuff:
60
+ *.log
61
+ local_settings.py
62
+ db.sqlite3
63
+ db.sqlite3-journal
64
+
65
+ # Flask stuff:
66
+ instance/
67
+ .webassets-cache
68
+
69
+ # Scrapy stuff:
70
+ .scrapy
71
+
72
+ # Sphinx documentation
73
+ docs/_build/
74
+
75
+ # PyBuilder
76
+ .pybuilder/
77
+ target/
78
+
79
+ # Jupyter Notebook
80
+ .ipynb_checkpoints
81
+
82
+ # IPython
83
+ profile_default/
84
+ ipython_config.py
85
+
86
+ # pyenv
87
+ # For a library or package, you might want to ignore these files since the code is
88
+ # intended to run in multiple environments; otherwise, check them in:
89
+ # .python-version
90
+
91
+ # pipenv
92
+ # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93
+ # However, in case of collaboration, if having platform-specific dependencies or dependencies
94
+ # having no cross-platform support, pipenv may install dependencies that don't work, or not
95
+ # install all needed dependencies.
96
+ #Pipfile.lock
97
+
98
+ # UV
99
+ # Similar to Pipfile.lock, it is generally recommended to include uv.lock in version control.
100
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
101
+ # commonly ignored for libraries.
102
+ #uv.lock
103
+
104
+ # poetry
105
+ # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control.
106
+ # This is especially recommended for binary packages to ensure reproducibility, and is more
107
+ # commonly ignored for libraries.
108
+ # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control
109
+ #poetry.lock
110
+
111
+ # pdm
112
+ # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control.
113
+ #pdm.lock
114
+ # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it
115
+ # in version control.
116
+ # https://pdm.fming.dev/latest/usage/project/#working-with-version-control
117
+ .pdm.toml
118
+ .pdm-python
119
+ .pdm-build/
120
+
121
+ # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm
122
+ __pypackages__/
123
+
124
+ # Celery stuff
125
+ celerybeat-schedule
126
+ celerybeat.pid
127
+
128
+ # SageMath parsed files
129
+ *.sage.py
130
+
131
+ # Environments
132
+ .env
133
+ .venv
134
+ env/
135
+ venv/
136
+ ENV/
137
+ env.bak/
138
+ venv.bak/
139
+
140
+ # Spyder project settings
141
+ .spyderproject
142
+ .spyproject
143
+
144
+ # Rope project settings
145
+ .ropeproject
146
+
147
+ # mkdocs documentation
148
+ /site
149
+
150
+ # mypy
151
+ .mypy_cache/
152
+ .dmypy.json
153
+ dmypy.json
154
+
155
+ # Pyre type checker
156
+ .pyre/
157
+
158
+ # pytype static type analyzer
159
+ .pytype/
160
+
161
+ # Cython debug symbols
162
+ cython_debug/
163
+
164
+ # PyCharm
165
+ # JetBrains specific template is maintained in a separate JetBrains.gitignore that can
166
+ # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore
167
+ # and can be added to the global gitignore or merged into this file. For a more nuclear
168
+ # option (not recommended) you can uncomment the following to ignore the entire idea folder.
169
+ #.idea/
170
+
171
+ # Ruff stuff:
172
+ .ruff_cache/
173
+
174
+ # PyPI configuration file
175
+ .pypirc
176
+
@@ -0,0 +1 @@
1
+ 3.14
@@ -0,0 +1,37 @@
1
+ {
2
+ /*
3
+ * BASE
4
+ */
5
+ "files.encoding": "utf8",
6
+ "editor.linkedEditing": true, // 使得同時編輯相同變數或符號更容易。
7
+ "editor.bracketPairColorization.enabled": true, // 啟用括號配對著色功能。
8
+ "editor.guides.bracketPairs": true, // 在括號間顯示視覺導引線
9
+ "explorer.compactFolders": false,
10
+ /*
11
+ * GIT
12
+ */
13
+ "git.autofetch": true,
14
+ "git.enableSmartCommit": true,
15
+ "git.confirmSync": false,
16
+ /*
17
+ * PYTHON
18
+ */
19
+ "python.analysis.inlayHints.callArgumentNames": "partial",
20
+ "python.analysis.inlayHints.functionReturnTypes": true,
21
+ "python.analysis.inlayHints.pytestParameters": true,
22
+ "python.analysis.inlayHints.variableTypes": true,
23
+ "python.analysis.autoSearchPaths": true,
24
+ "python.analysis.autoIndent": true,
25
+ "python.analysis.autoFormatStrings": true, // 在字串內輸入“{”時,是否自動加上“f”前綴。
26
+ "python.analysis.completeFunctionParens": true,
27
+ "python.analysis.typeEvaluation.analyzeUnannotatedFunctions": true, // 為函數補全添加括號。
28
+ "python.analysis.typeEvaluation.strictSetInference": true,
29
+ "python.analysis.includeAliasesFromUserFiles": false,
30
+ "python.analysis.typeCheckingMode": "basic",
31
+ "python.analysis.typeEvaluation.strictDictionaryInference": true,
32
+ "python.analysis.typeEvaluation.strictListInference": true,
33
+ /*
34
+ * JUPYTER
35
+ */
36
+ "jupyter.exportWithOutputEnabled": false,
37
+ }
@@ -0,0 +1,4 @@
1
+ # Rules
2
+ - 禁寫註解
3
+ - 運行 `uv run ruff check --fix` + `uv run ty check --fix`(主力)
4
+ - 偶爾行 `uv run pyright` / `uv run mypy` 輔助確認 type safety
@@ -0,0 +1,18 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 RedQueenArk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy of this software and
6
+ associated documentation files (the "Software"), to deal in the Software without restriction, including
7
+ without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
+ copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be included in all copies or substantial
12
+ portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
15
+ LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
16
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
17
+ IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
18
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,132 @@
1
+ Metadata-Version: 2.5
2
+ Name: rqark-core
3
+ Version: 0.4.1
4
+ Summary: Red Queen Ark Core Agent Library
5
+ License-File: LICENSE
6
+ Requires-Python: >=3.14
7
+ Requires-Dist: ddgs>=0.5.3
8
+ Requires-Dist: httpx>=0.28.1
9
+ Requires-Dist: openai>=2.37.0
10
+ Requires-Dist: tzdata>=2026.3
11
+ Description-Content-Type: text/markdown
12
+
13
+ # rqark-core
14
+
15
+ The engine of the RQArk Ecology System
16
+
17
+ A stateless agent engine for Python. Ships a basic agent toolkit, a set of base prompts, and a unified streaming interface for agent events.
18
+
19
+ ## Why rqark-core
20
+
21
+ The `openai` package gives you a client. This adds the loop on top of it — same protocol, same streaming, nothing replaced.
22
+
23
+ - **Cleaner event flow** — `@core.on_xx`, in the spirit of flask / fastapi
24
+ - **Live prompts** — the latest prompt content is injected on every turn
25
+
26
+ ## Installation
27
+
28
+ Requires Python 3.14+.
29
+
30
+ ```bash
31
+ uv add rqark-core
32
+ # or
33
+ pip install rqark-core
34
+ ```
35
+
36
+ ## Quick Start
37
+
38
+ ```python
39
+ import asyncio
40
+ from rqark_core.core import AgentCore
41
+ from rqark_core.types.provider import Provider
42
+ from rqark_core.types.event import AgentPayload
43
+ from rqark_core.types.chat import Chunk, Message, UserMessage
44
+ from rqark_core.tools import WebFetch, WebSearch
45
+ from rqark_core.prompts import DateTimePrompt
46
+
47
+ provider = Provider(model_name='gpt-5', api_base='https://api.openai.com/v1', priority=0, api_key='sk-...')
48
+
49
+ core = AgentCore()
50
+
51
+
52
+ @core.on_chunk()
53
+ async def print_chunk(event: AgentPayload[Chunk]):
54
+ print(event.payload)
55
+
56
+
57
+ @core.on_message()
58
+ async def print_message(event: AgentPayload[Message]):
59
+ print(event.payload)
60
+
61
+
62
+ prompts = [DateTimePrompt()]
63
+ tools = [WebSearch(), WebFetch()]
64
+
65
+
66
+ async def main():
67
+ messages = [UserMessage('What news in Hong Kong?')]
68
+ history, error = await core.chat(provider, messages, prompts=prompts, tools=tools)
69
+ if error:
70
+ print('failed:', error)
71
+
72
+
73
+ asyncio.run(main())
74
+ ```
75
+
76
+ ## Events
77
+
78
+ - `on_chunk`
79
+ - `on_message`
80
+ - `on_plan`
81
+
82
+ ## Prompts
83
+
84
+ ### Dynamic injection
85
+
86
+ Prompt content is rebuilt on every turn — `DateTimePrompt` calls `now()`, for example.
87
+ If no `AGENTS.md` is found, `AgentsMdPrompt` hides its content to save context; `GitProjectPrompt` behaves the same way.
88
+
89
+ ### General
90
+
91
+ - `DateTimePrompt`
92
+ - `PlatformPrompt`
93
+ - `WorkspacePrompt`
94
+ - `AgentsMdPrompt`
95
+ - `GitProjectPrompt`
96
+
97
+ ### Roleplay
98
+
99
+ - `RolePrompt`
100
+ - `CharacterPrompt`
101
+
102
+ ### Other
103
+
104
+ - `AntiSycophancyPrompt`
105
+ - `SubAgentPrompt`
106
+
107
+ ## Tools
108
+
109
+ ### Files
110
+
111
+ - `ReadFile`
112
+ - `WriteFile`
113
+ - `EditFile`
114
+ - `ListDir`
115
+ - `Grep`
116
+
117
+ ### Search
118
+
119
+ - `WebSearch`
120
+ - `WebFetch`
121
+
122
+ ### Git
123
+
124
+ - `GitHub`
125
+ - `GitLab`
126
+ - `Gitea`
127
+
128
+ ### Other
129
+
130
+ - `Exec`
131
+ - `PlanUpdate`
132
+ - `SubAgent`
@@ -0,0 +1,120 @@
1
+ # rqark-core
2
+
3
+ The engine of the RQArk Ecology System
4
+
5
+ A stateless agent engine for Python. Ships a basic agent toolkit, a set of base prompts, and a unified streaming interface for agent events.
6
+
7
+ ## Why rqark-core
8
+
9
+ The `openai` package gives you a client. This adds the loop on top of it — same protocol, same streaming, nothing replaced.
10
+
11
+ - **Cleaner event flow** — `@core.on_xx`, in the spirit of flask / fastapi
12
+ - **Live prompts** — the latest prompt content is injected on every turn
13
+
14
+ ## Installation
15
+
16
+ Requires Python 3.14+.
17
+
18
+ ```bash
19
+ uv add rqark-core
20
+ # or
21
+ pip install rqark-core
22
+ ```
23
+
24
+ ## Quick Start
25
+
26
+ ```python
27
+ import asyncio
28
+ from rqark_core.core import AgentCore
29
+ from rqark_core.types.provider import Provider
30
+ from rqark_core.types.event import AgentPayload
31
+ from rqark_core.types.chat import Chunk, Message, UserMessage
32
+ from rqark_core.tools import WebFetch, WebSearch
33
+ from rqark_core.prompts import DateTimePrompt
34
+
35
+ provider = Provider(model_name='gpt-5', api_base='https://api.openai.com/v1', priority=0, api_key='sk-...')
36
+
37
+ core = AgentCore()
38
+
39
+
40
+ @core.on_chunk()
41
+ async def print_chunk(event: AgentPayload[Chunk]):
42
+ print(event.payload)
43
+
44
+
45
+ @core.on_message()
46
+ async def print_message(event: AgentPayload[Message]):
47
+ print(event.payload)
48
+
49
+
50
+ prompts = [DateTimePrompt()]
51
+ tools = [WebSearch(), WebFetch()]
52
+
53
+
54
+ async def main():
55
+ messages = [UserMessage('What news in Hong Kong?')]
56
+ history, error = await core.chat(provider, messages, prompts=prompts, tools=tools)
57
+ if error:
58
+ print('failed:', error)
59
+
60
+
61
+ asyncio.run(main())
62
+ ```
63
+
64
+ ## Events
65
+
66
+ - `on_chunk`
67
+ - `on_message`
68
+ - `on_plan`
69
+
70
+ ## Prompts
71
+
72
+ ### Dynamic injection
73
+
74
+ Prompt content is rebuilt on every turn — `DateTimePrompt` calls `now()`, for example.
75
+ If no `AGENTS.md` is found, `AgentsMdPrompt` hides its content to save context; `GitProjectPrompt` behaves the same way.
76
+
77
+ ### General
78
+
79
+ - `DateTimePrompt`
80
+ - `PlatformPrompt`
81
+ - `WorkspacePrompt`
82
+ - `AgentsMdPrompt`
83
+ - `GitProjectPrompt`
84
+
85
+ ### Roleplay
86
+
87
+ - `RolePrompt`
88
+ - `CharacterPrompt`
89
+
90
+ ### Other
91
+
92
+ - `AntiSycophancyPrompt`
93
+ - `SubAgentPrompt`
94
+
95
+ ## Tools
96
+
97
+ ### Files
98
+
99
+ - `ReadFile`
100
+ - `WriteFile`
101
+ - `EditFile`
102
+ - `ListDir`
103
+ - `Grep`
104
+
105
+ ### Search
106
+
107
+ - `WebSearch`
108
+ - `WebFetch`
109
+
110
+ ### Git
111
+
112
+ - `GitHub`
113
+ - `GitLab`
114
+ - `Gitea`
115
+
116
+ ### Other
117
+
118
+ - `Exec`
119
+ - `PlanUpdate`
120
+ - `SubAgent`
@@ -0,0 +1,47 @@
1
+ import asyncio
2
+
3
+ from model import MODEL_NAME
4
+
5
+ from rqark_core.core import AgentCore
6
+ from rqark_core.types.chat import Chunk, Message, ToolMessage, UserMessage
7
+ from rqark_core.types.event import AgentPayload
8
+ from rqark_core.types.provider import Provider
9
+
10
+ provider = Provider(MODEL_NAME, 'http://127.0.0.1:8080', 0, 'api_key', combine=True)
11
+ core = AgentCore(agent_id='root')
12
+
13
+ last_chunk_type = Chunk('reasoning_content', '')
14
+
15
+
16
+ @core.on_chunk()
17
+ async def print_chunk(ev: AgentPayload[Chunk]):
18
+ global last_chunk_type
19
+ chunk = ev.payload
20
+ if last_chunk_type.type != chunk.type:
21
+ print()
22
+ if chunk.type == 'reasoning_content':
23
+ print(chunk.content, flush=True, end='')
24
+ elif chunk.type == 'content':
25
+ print(chunk.content, flush=True, end='')
26
+ elif chunk.type == 'tool_calls' and isinstance(chunk.content, list):
27
+ for call in chunk.content:
28
+ print(call.name, call.arguments)
29
+ elif chunk.type == 'tool_result' and isinstance(chunk.content, ToolMessage):
30
+ print(chunk.content.tool_name, chunk.content.content)
31
+ elif chunk.type == 'error':
32
+ print(f'[error] {chunk.content}')
33
+ last_chunk_type = chunk
34
+
35
+
36
+ @core.on_message()
37
+ async def print_message(ev: AgentPayload[Message]):
38
+ print(f'[message] {type(ev.payload).__name__}')
39
+
40
+
41
+ async def main() -> None:
42
+ messages = [UserMessage('你好')]
43
+ new_messages, error = await core.chat(provider=provider, messages=messages)
44
+
45
+
46
+ if __name__ == '__main__':
47
+ asyncio.run(main())
@@ -0,0 +1 @@
1
+ MODEL_NAME = 'mlx-community/Qwen3.6-35B-A3B-4bit'
@@ -0,0 +1,34 @@
1
+ import asyncio
2
+
3
+ from model import MODEL_NAME
4
+
5
+ from rqark_core.core import AgentCore
6
+ from rqark_core.tools import PlanUpdate
7
+ from rqark_core.types.chat import Message, UserMessage
8
+ from rqark_core.types.event import AgentPayload
9
+ from rqark_core.types.provider import Provider
10
+ from rqark_core.types.tool import PlanItem
11
+
12
+ provider = Provider(MODEL_NAME, 'http://127.0.0.1:8080', 0, 'api_key', combine=True)
13
+ core = AgentCore(agent_id='root')
14
+
15
+ tools = [PlanUpdate()]
16
+
17
+
18
+ @core.on_message()
19
+ async def print_msg(ev: AgentPayload[Message]):
20
+ print(ev.payload.role, ev.payload.content)
21
+
22
+
23
+ @core.on_plan()
24
+ async def print_plan(ev: AgentPayload[list[PlanItem]]):
25
+ print(ev.payload)
26
+
27
+
28
+ async def main() -> None:
29
+ messages = [UserMessage('利用 plan_update 生成三個 items, 測試 1, 測試 2, 測試 3, 逐一切換狀態, 最後清空plan')]
30
+ new_messages, error = await core.chat(provider=provider, messages=messages, tools=tools)
31
+
32
+
33
+ if __name__ == '__main__':
34
+ asyncio.run(main())