botnesia-core 0.1.0__py3-none-any.whl

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 (70) hide show
  1. agent_observability.py +402 -0
  2. agent_os.py +180 -0
  3. agent_registry.py +170 -0
  4. ai_providers/__init__.py +20 -0
  5. ai_providers/base.py +30 -0
  6. ai_providers/deepseek.py +206 -0
  7. ai_providers/gemini.py +441 -0
  8. ai_providers/groq_provider.py +176 -0
  9. ai_providers/openrouter.py +254 -0
  10. ai_providers/router.py +371 -0
  11. ai_providers/types.py +73 -0
  12. anti_hallucination_engine.py +119 -0
  13. base.py +631 -0
  14. botnesia_core-0.1.0.dist-info/METADATA +253 -0
  15. botnesia_core-0.1.0.dist-info/RECORD +70 -0
  16. botnesia_core-0.1.0.dist-info/WHEEL +5 -0
  17. botnesia_core-0.1.0.dist-info/licenses/LICENSE +202 -0
  18. botnesia_core-0.1.0.dist-info/licenses/NOTICE +5 -0
  19. botnesia_core-0.1.0.dist-info/top_level.txt +34 -0
  20. cognitive_loop/__init__.py +16 -0
  21. cognitive_loop/loop.py +151 -0
  22. cognitive_loop/worker.py +32 -0
  23. cost_intelligence.py +196 -0
  24. devil_advocate_agent.py +116 -0
  25. evaluation/__init__.py +15 -0
  26. evaluation/evaluator.py +115 -0
  27. evaluation/schema.py +30 -0
  28. event_bus/__init__.py +46 -0
  29. event_bus/bus.py +101 -0
  30. event_bus/events.py +26 -0
  31. feature_flags/__init__.py +27 -0
  32. feature_flags/flags.py +101 -0
  33. first_principle_agent.py +139 -0
  34. groq_knowledge.py +345 -0
  35. intent_classifier.py +84 -0
  36. kb_embeddings.py +98 -0
  37. knowledge_access_engine.py +209 -0
  38. long_term_memory/__init__.py +19 -0
  39. long_term_memory/schema.py +57 -0
  40. long_term_memory/store.py +126 -0
  41. mcp_client.py +147 -0
  42. mcp_registry.py +148 -0
  43. multi_agent_orchestrator.py +437 -0
  44. perf_cache.py +76 -0
  45. planner_agent.py +81 -0
  46. platform_state/__init__.py +22 -0
  47. platform_state/base.py +73 -0
  48. platform_state/factory.py +26 -0
  49. platform_state/inprocess.py +140 -0
  50. platform_state/redis_store.py +124 -0
  51. policy_engine/__init__.py +21 -0
  52. policy_engine/engine.py +98 -0
  53. policy_engine/loader.py +76 -0
  54. prompt_registry/__init__.py +22 -0
  55. prompt_registry/factory.py +19 -0
  56. prompt_registry/registry.py +160 -0
  57. prompt_registry/schema.py +37 -0
  58. socratic_reasoning.py +119 -0
  59. task_engine.py +143 -0
  60. task_runtime/__init__.py +22 -0
  61. task_runtime/monitor.py +142 -0
  62. task_runtime/repository.py +230 -0
  63. task_runtime/runner.py +344 -0
  64. task_runtime/schema.py +64 -0
  65. task_runtime/worker.py +65 -0
  66. tool_executor.py +836 -0
  67. tool_registry.py +308 -0
  68. uncertainty_engine.py +195 -0
  69. vendor_bootstrap.py +28 -0
  70. workflow_engine.py +646 -0
@@ -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
+ ![botnesia-core](assets/banner.svg)
24
+
25
+ **The open agent-runtime foundation behind BotNesia** — build durable,
26
+ multi-agent, MCP-native AI systems in Python.
27
+
28
+ [![CI](https://github.com/asroryandesfar-art/botnesia-core/actions/workflows/ci.yml/badge.svg)](https://github.com/asroryandesfar-art/botnesia-core/actions/workflows/ci.yml)
29
+ [![Release](https://img.shields.io/github/v/release/asroryandesfar-art/botnesia-core?sort=semver)](https://github.com/asroryandesfar-art/botnesia-core/releases)
30
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
31
+ ![Python](https://img.shields.io/badge/python-3.10%2B-blue)
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
+ [![BotNesia product](assets/product-landing.png)](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
+ ![Architecture](assets/architecture.svg)
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).
@@ -0,0 +1,70 @@
1
+ agent_observability.py,sha256=4iT8hOm5PaqpBFu37O1WphpRXgjWy4e3cyYXkpNR9vM,17432
2
+ agent_os.py,sha256=dqgczkcPE04pA-FfOurTQeezVsAEp5zkVVX3KsLBwEo,8771
3
+ agent_registry.py,sha256=XgGR2-rCOZM0p2CfGlk3GYxUxDav6tdukrkWwtIYVfM,6933
4
+ anti_hallucination_engine.py,sha256=MqV-9WL1zcmJPURmKXgnYvMOktARau2sPVJW4QFRm0M,4333
5
+ base.py,sha256=FlNAHVFy65rYiLmHn3Zbi989M0GPdYhQQj50Hvc2VW4,26852
6
+ cost_intelligence.py,sha256=1MsF8oKDTLPjcj5sgxHn2TfdGZje-RWu5FydHG_dSeQ,9053
7
+ devil_advocate_agent.py,sha256=WFWjf_7CzI37GpHzmp1UcgwBOxPjFa_7qSiYBL__FLw,5513
8
+ first_principle_agent.py,sha256=PICNpdyqIqFJE063NPMtKcwBBzqrqoYnmNcBgQngFwg,6529
9
+ groq_knowledge.py,sha256=CZUTgHfvpwz8sHvr_eXjRZmdk79GmU5iKq1f5p-ZxO4,15718
10
+ intent_classifier.py,sha256=od7eB17LlLYykOs9pYNno62_eW9h2YedKW5YbbXMgYY,3333
11
+ kb_embeddings.py,sha256=an-J7-85YgngDHYoZgkuNDquEtsTeIWlcg-ANo7vm4U,4152
12
+ knowledge_access_engine.py,sha256=O830cj29CPmiDVvvQijeTqeVdFw7ZKTciHkkPUf8flM,9702
13
+ mcp_client.py,sha256=-67P0XClgChfLIhPcFikLwc73JBDe0D8Olaf9P8pDH0,5964
14
+ mcp_registry.py,sha256=vLL9Wjjx2hdCAZV6UhNJSs6iAjMZCHu5ehNw1cmtR3Q,6012
15
+ multi_agent_orchestrator.py,sha256=Jmo3eOenVXHpndDaw-35YuT54vh-6zysJ-IVygW-jkE,20347
16
+ perf_cache.py,sha256=yiZRJ79pk43-b6rJlhbU2lkCXy1YVuN6--V5YgdWNbs,2764
17
+ planner_agent.py,sha256=GmpAKvYYYm2UojpK8rN3tBzyU1nHEW-F0RtrCStHN74,3685
18
+ socratic_reasoning.py,sha256=z7hyaZmalLod5PXGqoboTFDdkOFKuFgNvsSM0ZTnqpI,5909
19
+ task_engine.py,sha256=7TsPbLGD8gd8SApPNdPB70e-TbYGmxJgcVuWvF01H4E,6948
20
+ tool_executor.py,sha256=PFTjQSv8yAXjXdBvzs0n5XrW2LFmFPYz9pvrH7jlQRo,37808
21
+ tool_registry.py,sha256=FlKtOTj5qTQKBeDX3qEnRWoEtvyb68TAJhZZqGRVjN8,12333
22
+ uncertainty_engine.py,sha256=5Qixs8cyQ6Y_AFyty285QkbMg-bZ-gqmz4yky3zzkrM,7632
23
+ vendor_bootstrap.py,sha256=Jg18hRfijVNpJAY2n-FXTg6Rana7qfGjFOt5Tjbv4s0,784
24
+ workflow_engine.py,sha256=_hCYHBmA8CZiC2z2IdadRRiAPfW3Aj4_vrW-BPxBzhk,28567
25
+ ai_providers/__init__.py,sha256=H8T9l1Rf6OGlBC3_iVdibrsjEiG7mr9bCrGw8NPHYKw,596
26
+ ai_providers/base.py,sha256=Y5ofUvjmmdc-xf695RoCFmd_NBaRlVlm3JNlrSYjhOk,794
27
+ ai_providers/deepseek.py,sha256=3nhu4t5sC4LCWXIbZMrN-zHn_ZvnabA5hTUfb3uppLQ,7462
28
+ ai_providers/gemini.py,sha256=UY-TyWPPuvkAlO-HSUcleCgXA28eS59udDjE5itrdz8,17654
29
+ ai_providers/groq_provider.py,sha256=xXrR3Bry5Hj6IIHSbBx4rg2P3y3hgQg1RCiO5r2A01c,6381
30
+ ai_providers/openrouter.py,sha256=WUKYG1VJyZWeKIGrFKQuUMMLzxpAPZ-Hj5ucIXZA11A,9506
31
+ ai_providers/router.py,sha256=_NY7dDi_CLsFVo9GMcReSXSNiHMWG1UR9PXYW1CvIFw,15955
32
+ ai_providers/types.py,sha256=uymcgB_Lzxa9on7f1k1uSuQxBvh8m36Xup3BT3_o0MU,1924
33
+ botnesia_core-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
34
+ botnesia_core-0.1.0.dist-info/licenses/NOTICE,sha256=iCu0Lj-8RiHthIHGFm0y5sTo2VKMuS1o83Ht4lN3NS4,141
35
+ cognitive_loop/__init__.py,sha256=n2sIDE68v0MYV1IFG0pwnzbd_Xnn_HBTDpLtyFXFib8,773
36
+ cognitive_loop/loop.py,sha256=iUd2P9lEJDVQYNCOHEcVUloSTuvktpg_eVpmH_YfBn8,7779
37
+ cognitive_loop/worker.py,sha256=eYS_rn5O8tOpCJDHaBVGwzx35wl8O8UBwzCLnuHb2BI,1681
38
+ evaluation/__init__.py,sha256=MfUQ6M1s6jezSB_Uc7syeZlkzoSL1Lnr9pSst28q9xY,644
39
+ evaluation/evaluator.py,sha256=o1GTHTapJ_Dp-kM9ejcC6l-z-paRnRrkOqT1bdcfvBU,5192
40
+ evaluation/schema.py,sha256=uhS3yVOL-dKVORZO3OMFKRXkpYKraMWRaT8TM1-Ytbw,1143
41
+ event_bus/__init__.py,sha256=jeudxVQg70uwitRGsGDYKAgiRMT5kjQoctkfXICd9bE,1594
42
+ event_bus/bus.py,sha256=pnxUU3SFJ-fvPmTds-MH8yLar6Tfdb0g0Am-STl0N0M,3542
43
+ event_bus/events.py,sha256=VxKY1SNckXItsZViIBHcRTX_zyZYM5roaUoagAeE7wc,685
44
+ feature_flags/__init__.py,sha256=_Zs4aV4_3WMT3SmoO4m3jZHtFWrvHj9yzJepRj-PnHw,791
45
+ feature_flags/flags.py,sha256=7yJmFvCOAVl13_aDvB_61mUq5I6O9UkrqTVqThkVsaQ,3844
46
+ long_term_memory/__init__.py,sha256=23kWNq3fhKNgyFvqUZxo5ijkYX3zszJX02A060aQQ1M,1001
47
+ long_term_memory/schema.py,sha256=y-anevUQa7vVm3nrnRd_q3suXyHED-lSGVemqGaZvS4,2326
48
+ long_term_memory/store.py,sha256=VkCG-Bj3B0iAZ8ndQ4r-VzkIEc5LQY8acFf-Wrwc0d4,5599
49
+ platform_state/__init__.py,sha256=Ets9m7_gjc95Oq2ybijK-qocu28EZ7GOvvjhlZPLcPM,897
50
+ platform_state/base.py,sha256=QmJAVIMTtGYwAVDF2Lm0kbjLk9NLU0Hv_9x-BvZLPS0,3619
51
+ platform_state/factory.py,sha256=NhTdpKhoz-vil5435c487kFXNSWHj36fsrbbOWA-IgA,874
52
+ platform_state/inprocess.py,sha256=VBZSMbEjHB2cZV_ahuwA-kARh4CG2nyuayDtRYHP6Uk,6112
53
+ platform_state/redis_store.py,sha256=GBtMkC5coSg3AfRhLZpSKTVgAMjGqBlsmEIPCGbJ3mw,5656
54
+ policy_engine/__init__.py,sha256=YdaJMOJtYekvBLZbNOS-edbqAaNR1vln0C4ESIUC9VI,975
55
+ policy_engine/engine.py,sha256=WKhmd4BaKgqquqZHpzvr_U4y2MOrbxBoeGQkWdqQsks,3855
56
+ policy_engine/loader.py,sha256=sdhDN1YsNQKw2EYFJ7bluyAlPkjQ1UqBE1jcuO7Sbl8,2797
57
+ prompt_registry/__init__.py,sha256=1UynL69eKE29AN6gid175pQUn99o6rg8zgMb3v6QZ_0,990
58
+ prompt_registry/factory.py,sha256=eIhit84yWQaOvwv5K_UH8Y14JkWJxtaK4E6mBBPxIos,534
59
+ prompt_registry/registry.py,sha256=7gtYm6CQwq2QOog2lUDQjn1Sz5XY4mTZzGsGdLLekRs,7653
60
+ prompt_registry/schema.py,sha256=i5HGExZpArta2rj5K8P7SLzSi_aMvjpASxEfs6w1B7s,1537
61
+ task_runtime/__init__.py,sha256=H5qzi7gDliYAgqhOVmdR6w0bYOCOU9L-PpXyMRpHaAU,1059
62
+ task_runtime/monitor.py,sha256=pjX77Hc6ZwbTrS-321yY1VS-FiNyIHPTg-Q_aDtvQVU,6966
63
+ task_runtime/repository.py,sha256=bWtqL8nex6VJqYZQf2C5l0e96MHV7SnJVwQ_q2K6Eag,11187
64
+ task_runtime/runner.py,sha256=VF1U_zvz0QcuVCv8aJ3GEGDMlqmKWJgUKaQfDh1qO84,19308
65
+ task_runtime/schema.py,sha256=BzCINCfIQl5QTdsjUVyjaeLDVkXhCiaX0mlLtbH_I90,2902
66
+ task_runtime/worker.py,sha256=BlDmq3HRHAm3MzV7hOFf0MX9czjQ-r-Md5BwmM1k9oM,2909
67
+ botnesia_core-0.1.0.dist-info/METADATA,sha256=WmCrRz2uC0ixyFLjEEy7qUqXo-m18Y2Amk27KrgmTT8,10145
68
+ botnesia_core-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
69
+ botnesia_core-0.1.0.dist-info/top_level.txt,sha256=1BSVeGC-x3H-FBsGcwWdaygL_xJ7jjDQqrvrmELRPvQ,530
70
+ botnesia_core-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -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,5 @@
1
+ BotNesia Core
2
+ Copyright 2026 BotNesia
3
+
4
+ This product includes software developed at BotNesia.
5
+ Licensed under the Apache License, Version 2.0.
@@ -0,0 +1,34 @@
1
+ agent_observability
2
+ agent_os
3
+ agent_registry
4
+ ai_providers
5
+ anti_hallucination_engine
6
+ base
7
+ cognitive_loop
8
+ cost_intelligence
9
+ devil_advocate_agent
10
+ evaluation
11
+ event_bus
12
+ feature_flags
13
+ first_principle_agent
14
+ groq_knowledge
15
+ intent_classifier
16
+ kb_embeddings
17
+ knowledge_access_engine
18
+ long_term_memory
19
+ mcp_client
20
+ mcp_registry
21
+ multi_agent_orchestrator
22
+ perf_cache
23
+ planner_agent
24
+ platform_state
25
+ policy_engine
26
+ prompt_registry
27
+ socratic_reasoning
28
+ task_engine
29
+ task_runtime
30
+ tool_executor
31
+ tool_registry
32
+ uncertainty_engine
33
+ vendor_bootstrap
34
+ workflow_engine
@@ -0,0 +1,16 @@
1
+ """cognitive_loop — Planner→Worker→Critic loop untuk BotNesia (P1-A).
2
+
3
+ Loop reasoning iteratif: Critic boleh menyuruh Worker mengulang, Planner membuat
4
+ rencana baru; Supervisor (loop) memutuskan berhenti (diterima / budget / degraded).
5
+
6
+ from cognitive_loop import CognitiveLoop
7
+ out = await CognitiveLoop(max_iters=3, accept_threshold=0.8).run(agent, goal)
8
+
9
+ Dependency-injected (agent cukup punya `_call_llm_json`), fail-open, mandiri.
10
+ Konsumen mengadopsi di belakang feature flag `is_enabled("cognitive_loop")`.
11
+ Lihat docs/adr/ADR-0005-cognitive-loop.md.
12
+ """
13
+ from cognitive_loop.loop import CognitiveLoop, ACCEPT, REVISE, REPLAN
14
+ from cognitive_loop.worker import make_tool_worker
15
+
16
+ __all__ = ["CognitiveLoop", "ACCEPT", "REVISE", "REPLAN", "make_tool_worker"]