botnesia-core 0.1.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.
- botnesia_core-0.1.0/LICENSE +202 -0
- botnesia_core-0.1.0/NOTICE +5 -0
- botnesia_core-0.1.0/PKG-INFO +253 -0
- botnesia_core-0.1.0/README.md +233 -0
- botnesia_core-0.1.0/pyproject.toml +58 -0
- botnesia_core-0.1.0/setup.cfg +4 -0
- botnesia_core-0.1.0/src/agent_observability.py +402 -0
- botnesia_core-0.1.0/src/agent_os.py +180 -0
- botnesia_core-0.1.0/src/agent_registry.py +170 -0
- botnesia_core-0.1.0/src/ai_providers/__init__.py +20 -0
- botnesia_core-0.1.0/src/ai_providers/base.py +30 -0
- botnesia_core-0.1.0/src/ai_providers/deepseek.py +206 -0
- botnesia_core-0.1.0/src/ai_providers/gemini.py +441 -0
- botnesia_core-0.1.0/src/ai_providers/groq_provider.py +176 -0
- botnesia_core-0.1.0/src/ai_providers/openrouter.py +254 -0
- botnesia_core-0.1.0/src/ai_providers/router.py +371 -0
- botnesia_core-0.1.0/src/ai_providers/types.py +73 -0
- botnesia_core-0.1.0/src/anti_hallucination_engine.py +119 -0
- botnesia_core-0.1.0/src/base.py +631 -0
- botnesia_core-0.1.0/src/botnesia_core.egg-info/PKG-INFO +253 -0
- botnesia_core-0.1.0/src/botnesia_core.egg-info/SOURCES.txt +87 -0
- botnesia_core-0.1.0/src/botnesia_core.egg-info/dependency_links.txt +1 -0
- botnesia_core-0.1.0/src/botnesia_core.egg-info/requires.txt +11 -0
- botnesia_core-0.1.0/src/botnesia_core.egg-info/top_level.txt +34 -0
- botnesia_core-0.1.0/src/cognitive_loop/__init__.py +16 -0
- botnesia_core-0.1.0/src/cognitive_loop/loop.py +151 -0
- botnesia_core-0.1.0/src/cognitive_loop/worker.py +32 -0
- botnesia_core-0.1.0/src/cost_intelligence.py +196 -0
- botnesia_core-0.1.0/src/devil_advocate_agent.py +116 -0
- botnesia_core-0.1.0/src/evaluation/__init__.py +15 -0
- botnesia_core-0.1.0/src/evaluation/evaluator.py +115 -0
- botnesia_core-0.1.0/src/evaluation/schema.py +30 -0
- botnesia_core-0.1.0/src/event_bus/__init__.py +46 -0
- botnesia_core-0.1.0/src/event_bus/bus.py +101 -0
- botnesia_core-0.1.0/src/event_bus/events.py +26 -0
- botnesia_core-0.1.0/src/feature_flags/__init__.py +27 -0
- botnesia_core-0.1.0/src/feature_flags/flags.py +101 -0
- botnesia_core-0.1.0/src/first_principle_agent.py +139 -0
- botnesia_core-0.1.0/src/groq_knowledge.py +345 -0
- botnesia_core-0.1.0/src/intent_classifier.py +84 -0
- botnesia_core-0.1.0/src/kb_embeddings.py +98 -0
- botnesia_core-0.1.0/src/knowledge_access_engine.py +209 -0
- botnesia_core-0.1.0/src/long_term_memory/__init__.py +19 -0
- botnesia_core-0.1.0/src/long_term_memory/schema.py +57 -0
- botnesia_core-0.1.0/src/long_term_memory/store.py +126 -0
- botnesia_core-0.1.0/src/mcp_client.py +147 -0
- botnesia_core-0.1.0/src/mcp_registry.py +148 -0
- botnesia_core-0.1.0/src/multi_agent_orchestrator.py +437 -0
- botnesia_core-0.1.0/src/perf_cache.py +76 -0
- botnesia_core-0.1.0/src/planner_agent.py +81 -0
- botnesia_core-0.1.0/src/platform_state/__init__.py +22 -0
- botnesia_core-0.1.0/src/platform_state/base.py +73 -0
- botnesia_core-0.1.0/src/platform_state/factory.py +26 -0
- botnesia_core-0.1.0/src/platform_state/inprocess.py +140 -0
- botnesia_core-0.1.0/src/platform_state/redis_store.py +124 -0
- botnesia_core-0.1.0/src/policy_engine/__init__.py +21 -0
- botnesia_core-0.1.0/src/policy_engine/engine.py +98 -0
- botnesia_core-0.1.0/src/policy_engine/loader.py +76 -0
- botnesia_core-0.1.0/src/prompt_registry/__init__.py +22 -0
- botnesia_core-0.1.0/src/prompt_registry/factory.py +19 -0
- botnesia_core-0.1.0/src/prompt_registry/registry.py +160 -0
- botnesia_core-0.1.0/src/prompt_registry/schema.py +37 -0
- botnesia_core-0.1.0/src/socratic_reasoning.py +119 -0
- botnesia_core-0.1.0/src/task_engine.py +143 -0
- botnesia_core-0.1.0/src/task_runtime/__init__.py +22 -0
- botnesia_core-0.1.0/src/task_runtime/monitor.py +142 -0
- botnesia_core-0.1.0/src/task_runtime/repository.py +230 -0
- botnesia_core-0.1.0/src/task_runtime/runner.py +344 -0
- botnesia_core-0.1.0/src/task_runtime/schema.py +64 -0
- botnesia_core-0.1.0/src/task_runtime/worker.py +65 -0
- botnesia_core-0.1.0/src/tool_executor.py +836 -0
- botnesia_core-0.1.0/src/tool_registry.py +308 -0
- botnesia_core-0.1.0/src/uncertainty_engine.py +195 -0
- botnesia_core-0.1.0/src/vendor_bootstrap.py +28 -0
- botnesia_core-0.1.0/src/workflow_engine.py +646 -0
- botnesia_core-0.1.0/tests/test_agent_os.py +79 -0
- botnesia_core-0.1.0/tests/test_base_llm_fallback.py +167 -0
- botnesia_core-0.1.0/tests/test_base_tool_calling.py +137 -0
- botnesia_core-0.1.0/tests/test_circuit_breaker_shared_state.py +87 -0
- botnesia_core-0.1.0/tests/test_event_bus.py +99 -0
- botnesia_core-0.1.0/tests/test_examples_smoke.py +12 -0
- botnesia_core-0.1.0/tests/test_feature_flags.py +73 -0
- botnesia_core-0.1.0/tests/test_mcp_client.py +116 -0
- botnesia_core-0.1.0/tests/test_mcp_registry.py +109 -0
- botnesia_core-0.1.0/tests/test_perf_cache.py +92 -0
- botnesia_core-0.1.0/tests/test_platform_state.py +132 -0
- botnesia_core-0.1.0/tests/test_platform_state_redis.py +116 -0
- botnesia_core-0.1.0/tests/test_policy_engine.py +58 -0
- botnesia_core-0.1.0/tests/test_task_engine.py +136 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1,253 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: botnesia-core
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Open-source agent runtime primitives extracted from the BotNesia platform (SDK core, runtime, state, memory, policy, providers).
|
|
5
|
+
Author: BotNesia
|
|
6
|
+
License: Apache-2.0
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
License-File: NOTICE
|
|
11
|
+
Requires-Dist: httpx>=0.27
|
|
12
|
+
Requires-Dist: asyncpg>=0.29
|
|
13
|
+
Provides-Extra: redis
|
|
14
|
+
Requires-Dist: redis>=5.0; extra == "redis"
|
|
15
|
+
Provides-Extra: numpy
|
|
16
|
+
Requires-Dist: numpy>=1.26; extra == "numpy"
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest>=8; extra == "dev"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# botnesia-core
|
|
22
|
+
|
|
23
|
+

|
|
24
|
+
|
|
25
|
+
**The open agent-runtime foundation behind BotNesia** — build durable,
|
|
26
|
+
multi-agent, MCP-native AI systems in Python.
|
|
27
|
+
|
|
28
|
+
[](https://github.com/asroryandesfar-art/botnesia-core/actions/workflows/ci.yml)
|
|
29
|
+
[](https://github.com/asroryandesfar-art/botnesia-core/releases)
|
|
30
|
+
[](LICENSE)
|
|
31
|
+

|
|
32
|
+
|
|
33
|
+
**🌐 Live product:** [app.botnesia.uk](https://app.botnesia.uk) · **🎬 Demo:** [YouTube](https://youtu.be/aNIVa4Q-okI)
|
|
34
|
+
|
|
35
|
+
> `botnesia-core` is the Apache-2.0 engine extracted from the BotNesia platform.
|
|
36
|
+
> The commercial product (billing, marketplace, pricing, the AI-Workforce agents,
|
|
37
|
+
> multi-tenant management, SSO) stays in **BotNesia Cloud** — this repo is the
|
|
38
|
+
> reusable core you can build on.
|
|
39
|
+
|
|
40
|
+
## See it in production
|
|
41
|
+
|
|
42
|
+
[](https://app.botnesia.uk)
|
|
43
|
+
|
|
44
|
+
*The live BotNesia product ([app.botnesia.uk](https://app.botnesia.uk)) runs on
|
|
45
|
+
this engine — a Supervisor agent orchestrating CS, Sales, Marketing, Knowledge,
|
|
46
|
+
Finance and HR agents across WhatsApp, Instagram, Telegram and web chat.*
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## The problem
|
|
51
|
+
|
|
52
|
+
Building real AI agents means re-solving the same hard parts every time:
|
|
53
|
+
durability (surviving restarts, retries), multi-agent routing, tool/plugin
|
|
54
|
+
integration, provider fallback and cost control, memory, and safe outbound
|
|
55
|
+
calls. Most open agent frameworks stop at "prompt in a loop" and leave the
|
|
56
|
+
production plumbing to you. `botnesia-core` ships that plumbing — the exact
|
|
57
|
+
engine that powers the BotNesia product — as a clean, business-free library.
|
|
58
|
+
|
|
59
|
+
## What is BotNesia?
|
|
60
|
+
|
|
61
|
+
BotNesia is an **AI Workforce platform**: it turns business conversations and
|
|
62
|
+
operations into work done by a team of cooperating AI agents. `botnesia-core`
|
|
63
|
+
open-sources the primitives that make that possible — the agent SDK, a durable
|
|
64
|
+
runtime, shared state & memory, a tool/MCP plugin layer, provider routing, RAG,
|
|
65
|
+
reasoning components, and a workflow engine.
|
|
66
|
+
|
|
67
|
+
> **Open core:** this library is the engine; the hosted **BotNesia Cloud** adds
|
|
68
|
+
> the commercial layer (billing, marketplace, the AI-Workforce agents, tenant
|
|
69
|
+
> management, SSO). Learn more at the BotNesia product site.
|
|
70
|
+
|
|
71
|
+
## Why it's different
|
|
72
|
+
|
|
73
|
+
- **Durable, not just a wrapper.** A Postgres-backed task runtime with
|
|
74
|
+
retry/DLQ — agents survive restarts, unlike prompt-in-a-loop demos.
|
|
75
|
+
- **MCP-native plugins.** Add tools by pointing at any MCP server via one env
|
|
76
|
+
var — no code changes.
|
|
77
|
+
- **Multi-agent by design.** A registry + orchestrator route work across agents
|
|
78
|
+
that each implement `run()`.
|
|
79
|
+
- **Provider-agnostic + cost-aware.** `SmartModelRouter` across DeepSeek/Gemini/
|
|
80
|
+
Groq/OpenRouter with task-class routing.
|
|
81
|
+
- **Batteries, not lock-in.** Shared state (in-proc or Redis), long-term memory,
|
|
82
|
+
policy engine, prompt registry, evaluation, RAG — all as independent modules.
|
|
83
|
+
- **Business-free & auditable.** Zero secrets, zero billing/pricing/tenant code.
|
|
84
|
+
|
|
85
|
+
## How it compares
|
|
86
|
+
|
|
87
|
+
| | prompt-loop scripts | typical agent frameworks | **botnesia-core** |
|
|
88
|
+
|---|:---:|:---:|:---:|
|
|
89
|
+
| Durable runtime (retry/DLQ, survives restarts) | ❌ | partial | ✅ |
|
|
90
|
+
| Multi-agent registry + orchestrator | ❌ | ✅ | ✅ |
|
|
91
|
+
| MCP-native plugins (add tools via env) | ❌ | varies | ✅ |
|
|
92
|
+
| Shared state (in-proc **or** Redis) | ❌ | ❌ | ✅ |
|
|
93
|
+
| Cost-aware provider routing | ❌ | ❌ | ✅ |
|
|
94
|
+
| SSRF-guarded tool fetch | ❌ | ❌ | ✅ |
|
|
95
|
+
| Extracted from a live production product | ❌ | rare | ✅ |
|
|
96
|
+
|
|
97
|
+
*Not a benchmark — a capability comparison of what ships in the box.*
|
|
98
|
+
|
|
99
|
+
## Install
|
|
100
|
+
|
|
101
|
+
> **Note:** not on PyPI yet (planned for 0.1.x — see [Roadmap](#roadmap)). Install
|
|
102
|
+
> from the release wheel or from source today.
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# from the v0.1.0 release wheel:
|
|
106
|
+
pip install https://github.com/asroryandesfar-art/botnesia-core/releases/download/v0.1.0/botnesia_core-0.1.0-py3-none-any.whl
|
|
107
|
+
|
|
108
|
+
# or from source:
|
|
109
|
+
git clone https://github.com/asroryandesfar-art/botnesia-core
|
|
110
|
+
cd botnesia-core && pip install -e ".[dev]"
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Optional extras: `pip install "botnesia-core[redis]"` (distributed state).
|
|
114
|
+
|
|
115
|
+
## Quick Start (5 minutes)
|
|
116
|
+
|
|
117
|
+
<!-- Demo: replace with assets/demo.gif once recorded (see assets/README.md) -->
|
|
118
|
+
> 🎬 **Demo:** a 60–90s quickstart recording will live at `assets/demo.gif`.
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import asyncio
|
|
122
|
+
from base import BaseAgent
|
|
123
|
+
|
|
124
|
+
class GreeterAgent(BaseAgent):
|
|
125
|
+
name = "greeter"
|
|
126
|
+
skills = ["greet"]
|
|
127
|
+
|
|
128
|
+
async def run(self, context: dict) -> dict:
|
|
129
|
+
return {"output": f"Halo {context.get('name', 'dunia')}!"}
|
|
130
|
+
|
|
131
|
+
print(asyncio.run(GreeterAgent(api_key=None).run({"name": "Sari"})))
|
|
132
|
+
# {'output': 'Halo Sari!'}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Then explore the runnable examples:
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
python examples/01_list_builtin_tools.py # inspect the tool registry
|
|
139
|
+
python examples/02_mcp_plugin_config.py # add tools via MCP plugins
|
|
140
|
+
python examples/03_define_workflow.py # render a workflow step
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## Example: an LLM-backed agent
|
|
144
|
+
|
|
145
|
+
```python
|
|
146
|
+
from base import BaseAgent
|
|
147
|
+
|
|
148
|
+
class SummarizerAgent(BaseAgent):
|
|
149
|
+
name = "summarizer"
|
|
150
|
+
|
|
151
|
+
async def run(self, context: dict) -> dict:
|
|
152
|
+
text = context["text"]
|
|
153
|
+
# BaseAgent provides multi-provider LLM plumbing (bring your own key):
|
|
154
|
+
summary = await self._call_llm(
|
|
155
|
+
system="Summarize the user's text in one sentence.",
|
|
156
|
+
user=text,
|
|
157
|
+
)
|
|
158
|
+
return {"summary": summary}
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
Route across many agents with the orchestrator (`multi_agent_orchestrator`),
|
|
162
|
+
and run them durably with `task_runtime`.
|
|
163
|
+
|
|
164
|
+
## Architecture
|
|
165
|
+
|
|
166
|
+

|
|
167
|
+
|
|
168
|
+
`botnesia-core` is a set of independent, importable modules. Your app (or
|
|
169
|
+
BotNesia Cloud) sits on top, registers its own agents/tools, and adds the
|
|
170
|
+
commercial layer. Full guide: [`docs/SDK_GUIDE.md`](docs/SDK_GUIDE.md).
|
|
171
|
+
|
|
172
|
+
## BotNesia × Casper — verifiable AI decisions
|
|
173
|
+
|
|
174
|
+
AI agents increasingly take actions that affect money and customers. BotNesia
|
|
175
|
+
turns *"trust the AI"* into *"verify the AI"* by anchoring a hash of each
|
|
176
|
+
important agent decision on-chain.
|
|
177
|
+
|
|
178
|
+
- **On-chain proof:** the BotNesia product anchors decision hashes to an
|
|
179
|
+
`ai_proof_registry` smart contract on **Casper Testnet** (`casper-test`) via a
|
|
180
|
+
`store_proof` entry point. Each anchored decision produces a Casper deploy that
|
|
181
|
+
anyone can independently verify on the block explorer.
|
|
182
|
+
- **Real, verifiable references:**
|
|
183
|
+
- Contract hash — `15009cd4a6489c904b699c0a1f292e7e5557e823e54c236539c9ce9973ee2323`
|
|
184
|
+
- [Contract package on testnet.cspr.live](https://testnet.cspr.live/contract-package/897c4bd670325c1f17ab1704633a470f55eeeb1ec2b357ef48e5d26ecb78a9f0)
|
|
185
|
+
- Sample confirmed deploy — [`fbb4b7e7…aa7b4e`](https://testnet.cspr.live/deploy/fbb4b7e766c0275980074d070d446d8e64703c2c2eb81be84637dfa531aa7b4e)
|
|
186
|
+
- **Why Casper:** predictable fees and upgradable contracts suit a
|
|
187
|
+
per-decision anchoring workload, and its explorer makes proofs easy to verify.
|
|
188
|
+
|
|
189
|
+
> Scope note: the Casper anchoring client and contract run inside the **BotNesia
|
|
190
|
+
> product** (not in this open runtime package). This section documents how the
|
|
191
|
+
> platform uses Casper; `botnesia-core` is the agent engine those decisions run on.
|
|
192
|
+
|
|
193
|
+
## Plugins
|
|
194
|
+
|
|
195
|
+
The plugin system is **MCP** + the tool registry. Point at any MCP server:
|
|
196
|
+
|
|
197
|
+
```python
|
|
198
|
+
import os, json, mcp_registry
|
|
199
|
+
os.environ["MCP_SERVERS"] = json.dumps({"github": {"url": "https://mcp.example.com/github"}})
|
|
200
|
+
registry = mcp_registry.configure_from_env() # tools appear as mcp__github__*
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
See [`docs/PLUGIN_GUIDE.md`](docs/PLUGIN_GUIDE.md).
|
|
204
|
+
|
|
205
|
+
## Workflows
|
|
206
|
+
|
|
207
|
+
Define multi-step automations (agent → action → notification) with
|
|
208
|
+
`workflow_engine`; templated fields (`{{agent_output}}`) and conditional nodes
|
|
209
|
+
are supported. See `examples/03_define_workflow.py`.
|
|
210
|
+
|
|
211
|
+
## Roadmap
|
|
212
|
+
|
|
213
|
+
- **0.1.x** — stabilize primitives, PyPI, CI, guides.
|
|
214
|
+
- **0.2.x** — entry-point plugin discovery, injectable provider/observability hooks.
|
|
215
|
+
- **→ 1.0** — API stability guarantee, reference deployments, plugin gallery.
|
|
216
|
+
|
|
217
|
+
Full roadmap: [`ROADMAP.md`](ROADMAP.md).
|
|
218
|
+
|
|
219
|
+
## FAQ
|
|
220
|
+
|
|
221
|
+
**Is this the whole BotNesia product?**
|
|
222
|
+
No. It's the open engine. Billing, marketplace, pricing, the AI-Workforce
|
|
223
|
+
agents, tenant management and SSO stay in the commercial BotNesia Cloud.
|
|
224
|
+
|
|
225
|
+
**Do I need a database or Redis?**
|
|
226
|
+
No for the SDK basics. `task_runtime` uses Postgres for durable jobs, and
|
|
227
|
+
`platform_state` can use Redis for distributed state — both optional. The
|
|
228
|
+
default state backend is in-process.
|
|
229
|
+
|
|
230
|
+
**Which LLM providers are supported?**
|
|
231
|
+
DeepSeek, Gemini, Groq and OpenRouter via `SmartModelRouter`. Bring your own
|
|
232
|
+
API key; routing is cost-aware by task class.
|
|
233
|
+
|
|
234
|
+
**How do I add a tool or integration?**
|
|
235
|
+
Point at an MCP server via the `MCP_SERVERS` env var (no code), or register a
|
|
236
|
+
custom tool. See [`docs/PLUGIN_GUIDE.md`](docs/PLUGIN_GUIDE.md).
|
|
237
|
+
|
|
238
|
+
**Is it production-ready?**
|
|
239
|
+
The primitives are extracted from a production system and covered by tests.
|
|
240
|
+
APIs may still adjust before 1.0 (see `CHANGELOG.md` / `SUPPORTED_VERSIONS.md`).
|
|
241
|
+
|
|
242
|
+
**What Python versions?**
|
|
243
|
+
3.10+ (CI runs 3.10–3.12).
|
|
244
|
+
|
|
245
|
+
## Contributing & Community
|
|
246
|
+
|
|
247
|
+
Issues and PRs welcome — see [`CONTRIBUTING.md`](CONTRIBUTING.md),
|
|
248
|
+
[`GOVERNANCE.md`](GOVERNANCE.md), and [`CODE_OF_CONDUCT.md`](CODE_OF_CONDUCT.md).
|
|
249
|
+
Security: [`SECURITY.md`](SECURITY.md).
|
|
250
|
+
|
|
251
|
+
## License
|
|
252
|
+
|
|
253
|
+
[Apache-2.0](LICENSE) © BotNesia. See [`NOTICE`](NOTICE).
|