koboi-agent 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.
- koboi_agent-0.1.0/LICENSE +21 -0
- koboi_agent-0.1.0/PKG-INFO +232 -0
- koboi_agent-0.1.0/README.md +160 -0
- koboi_agent-0.1.0/koboi/__init__.py +121 -0
- koboi_agent-0.1.0/koboi/__main__.py +16 -0
- koboi_agent-0.1.0/koboi/cli.py +28 -0
- koboi_agent-0.1.0/koboi/client.py +174 -0
- koboi_agent-0.1.0/koboi/config.py +514 -0
- koboi_agent-0.1.0/koboi/config_models.py +252 -0
- koboi_agent-0.1.0/koboi/context/__init__.py +6 -0
- koboi_agent-0.1.0/koboi/context/manager.py +320 -0
- koboi_agent-0.1.0/koboi/context/registry.py +116 -0
- koboi_agent-0.1.0/koboi/diagnostics.py +154 -0
- koboi_agent-0.1.0/koboi/eval/__init__.py +31 -0
- koboi_agent-0.1.0/koboi/eval/config.py +125 -0
- koboi_agent-0.1.0/koboi/eval/loaders/__init__.py +126 -0
- koboi_agent-0.1.0/koboi/eval/loaders/bfcl_loader.py +335 -0
- koboi_agent-0.1.0/koboi/eval/loaders/gaia_loader.py +171 -0
- koboi_agent-0.1.0/koboi/eval/loaders/ragas_generator.py +167 -0
- koboi_agent-0.1.0/koboi/eval/loaders/swe_bench_loader.py +143 -0
- koboi_agent-0.1.0/koboi/eval/registry.py +130 -0
- koboi_agent-0.1.0/koboi/eval/regression.py +129 -0
- koboi_agent-0.1.0/koboi/eval/runner.py +331 -0
- koboi_agent-0.1.0/koboi/eval/scorers/__init__.py +25 -0
- koboi_agent-0.1.0/koboi/eval/scorers/base.py +229 -0
- koboi_agent-0.1.0/koboi/eval/scorers/bfcl_scorer.py +228 -0
- koboi_agent-0.1.0/koboi/eval/scorers/deepeval_scorer.py +170 -0
- koboi_agent-0.1.0/koboi/eval/scorers/gaia_scorer.py +120 -0
- koboi_agent-0.1.0/koboi/eval/scorers/ragas_scorer.py +236 -0
- koboi_agent-0.1.0/koboi/eval/scorers/swe_bench_scorer.py +190 -0
- koboi_agent-0.1.0/koboi/events.py +155 -0
- koboi_agent-0.1.0/koboi/exceptions.py +37 -0
- koboi_agent-0.1.0/koboi/facade.py +1008 -0
- koboi_agent-0.1.0/koboi/guardrails/__init__.py +17 -0
- koboi_agent-0.1.0/koboi/guardrails/approval.py +117 -0
- koboi_agent-0.1.0/koboi/guardrails/audit.py +187 -0
- koboi_agent-0.1.0/koboi/guardrails/base.py +53 -0
- koboi_agent-0.1.0/koboi/guardrails/input.py +58 -0
- koboi_agent-0.1.0/koboi/guardrails/output.py +45 -0
- koboi_agent-0.1.0/koboi/guardrails/rate_limiter.py +67 -0
- koboi_agent-0.1.0/koboi/guardrails/registry.py +77 -0
- koboi_agent-0.1.0/koboi/guardrails/tui_approval.py +11 -0
- koboi_agent-0.1.0/koboi/harness/__init__.py +12 -0
- koboi_agent-0.1.0/koboi/harness/carryover.py +209 -0
- koboi_agent-0.1.0/koboi/harness/doom_loop.py +187 -0
- koboi_agent-0.1.0/koboi/harness/policy.py +158 -0
- koboi_agent-0.1.0/koboi/harness/policy_audit.py +72 -0
- koboi_agent-0.1.0/koboi/harness/telemetry.py +254 -0
- koboi_agent-0.1.0/koboi/harness/utils.py +24 -0
- koboi_agent-0.1.0/koboi/hooks/__init__.py +11 -0
- koboi_agent-0.1.0/koboi/hooks/builtin.py +60 -0
- koboi_agent-0.1.0/koboi/hooks/callback_hook.py +35 -0
- koboi_agent-0.1.0/koboi/hooks/carryover_hook.py +80 -0
- koboi_agent-0.1.0/koboi/hooks/chain.py +293 -0
- koboi_agent-0.1.0/koboi/hooks/context_hook.py +67 -0
- koboi_agent-0.1.0/koboi/hooks/doom_loop_hook.py +68 -0
- koboi_agent-0.1.0/koboi/hooks/guardrail_hook.py +96 -0
- koboi_agent-0.1.0/koboi/hooks/langfuse_hook.py +232 -0
- koboi_agent-0.1.0/koboi/hooks/mode_hook.py +98 -0
- koboi_agent-0.1.0/koboi/hooks/notification_hook.py +68 -0
- koboi_agent-0.1.0/koboi/hooks/policy_hook.py +77 -0
- koboi_agent-0.1.0/koboi/hooks/rag_hook.py +53 -0
- koboi_agent-0.1.0/koboi/hooks/registry.py +270 -0
- koboi_agent-0.1.0/koboi/hooks/rich_subagent_hook.py +58 -0
- koboi_agent-0.1.0/koboi/hooks/rich_task_hook.py +63 -0
- koboi_agent-0.1.0/koboi/hooks/skill_hook.py +71 -0
- koboi_agent-0.1.0/koboi/hooks/subagent_hook.py +78 -0
- koboi_agent-0.1.0/koboi/hooks/task_hook.py +42 -0
- koboi_agent-0.1.0/koboi/hooks/telemetry_hook.py +99 -0
- koboi_agent-0.1.0/koboi/llm/__init__.py +18 -0
- koboi_agent-0.1.0/koboi/llm/anthropic_adapter.py +362 -0
- koboi_agent-0.1.0/koboi/llm/auth.py +49 -0
- koboi_agent-0.1.0/koboi/llm/base.py +76 -0
- koboi_agent-0.1.0/koboi/llm/factory.py +132 -0
- koboi_agent-0.1.0/koboi/llm/http_transport.py +135 -0
- koboi_agent-0.1.0/koboi/llm/openai_adapter.py +204 -0
- koboi_agent-0.1.0/koboi/llm/registry.py +114 -0
- koboi_agent-0.1.0/koboi/logger.py +203 -0
- koboi_agent-0.1.0/koboi/loop.py +426 -0
- koboi_agent-0.1.0/koboi/loop_pipeline.py +208 -0
- koboi_agent-0.1.0/koboi/mcp/__init__.py +9 -0
- koboi_agent-0.1.0/koboi/mcp/base.py +173 -0
- koboi_agent-0.1.0/koboi/mcp/client.py +193 -0
- koboi_agent-0.1.0/koboi/mcp/http_client.py +222 -0
- koboi_agent-0.1.0/koboi/mcp/server.py +169 -0
- koboi_agent-0.1.0/koboi/memory.py +73 -0
- koboi_agent-0.1.0/koboi/memory_sqlite.py +289 -0
- koboi_agent-0.1.0/koboi/modes.py +142 -0
- koboi_agent-0.1.0/koboi/notifications.py +87 -0
- koboi_agent-0.1.0/koboi/orchestration/__init__.py +9 -0
- koboi_agent-0.1.0/koboi/orchestration/_utils.py +27 -0
- koboi_agent-0.1.0/koboi/orchestration/factory.py +430 -0
- koboi_agent-0.1.0/koboi/orchestration/orchestrator.py +511 -0
- koboi_agent-0.1.0/koboi/orchestration/router.py +226 -0
- koboi_agent-0.1.0/koboi/plugins.py +60 -0
- koboi_agent-0.1.0/koboi/py.typed +0 -0
- koboi_agent-0.1.0/koboi/rag/__init__.py +46 -0
- koboi_agent-0.1.0/koboi/rag/augmentation.py +217 -0
- koboi_agent-0.1.0/koboi/rag/chunker.py +315 -0
- koboi_agent-0.1.0/koboi/rag/registry.py +379 -0
- koboi_agent-0.1.0/koboi/rag/retriever.py +292 -0
- koboi_agent-0.1.0/koboi/rag/sample_documents.py +43 -0
- koboi_agent-0.1.0/koboi/rag/types.py +28 -0
- koboi_agent-0.1.0/koboi/skills/__init__.py +3 -0
- koboi_agent-0.1.0/koboi/skills/registry.py +322 -0
- koboi_agent-0.1.0/koboi/subagent.py +378 -0
- koboi_agent-0.1.0/koboi/task.py +186 -0
- koboi_agent-0.1.0/koboi/tokens.py +19 -0
- koboi_agent-0.1.0/koboi/tools/__init__.py +3 -0
- koboi_agent-0.1.0/koboi/tools/builtin/__init__.py +8 -0
- koboi_agent-0.1.0/koboi/tools/builtin/calculator.py +52 -0
- koboi_agent-0.1.0/koboi/tools/builtin/filesystem.py +152 -0
- koboi_agent-0.1.0/koboi/tools/builtin/git.py +163 -0
- koboi_agent-0.1.0/koboi/tools/builtin/memory.py +175 -0
- koboi_agent-0.1.0/koboi/tools/builtin/search.py +197 -0
- koboi_agent-0.1.0/koboi/tools/builtin/shell.py +116 -0
- koboi_agent-0.1.0/koboi/tools/builtin/subagent.py +81 -0
- koboi_agent-0.1.0/koboi/tools/builtin/task.py +234 -0
- koboi_agent-0.1.0/koboi/tools/builtin/web.py +340 -0
- koboi_agent-0.1.0/koboi/tools/registry.py +213 -0
- koboi_agent-0.1.0/koboi/trust.py +194 -0
- koboi_agent-0.1.0/koboi/tui/__init__.py +0 -0
- koboi_agent-0.1.0/koboi/tui/app.py +367 -0
- koboi_agent-0.1.0/koboi/tui/app.tcss +156 -0
- koboi_agent-0.1.0/koboi/tui/approval.py +152 -0
- koboi_agent-0.1.0/koboi/tui/bridge.py +231 -0
- koboi_agent-0.1.0/koboi/tui/commands.py +633 -0
- koboi_agent-0.1.0/koboi/tui/export.py +111 -0
- koboi_agent-0.1.0/koboi/tui/keybindings.py +105 -0
- koboi_agent-0.1.0/koboi/tui/loop.py +429 -0
- koboi_agent-0.1.0/koboi/tui/notifications.py +6 -0
- koboi_agent-0.1.0/koboi/tui/screens/__init__.py +1 -0
- koboi_agent-0.1.0/koboi/tui/screens/command_palette.py +79 -0
- koboi_agent-0.1.0/koboi/tui/screens/help_overlay.py +143 -0
- koboi_agent-0.1.0/koboi/tui/screens/history_search.py +79 -0
- koboi_agent-0.1.0/koboi/tui/screens/permission_dialog.py +159 -0
- koboi_agent-0.1.0/koboi/tui/screens/session_manager.py +121 -0
- koboi_agent-0.1.0/koboi/tui/screens/subagent_monitor.py +183 -0
- koboi_agent-0.1.0/koboi/tui/screens/transcript_viewer.py +107 -0
- koboi_agent-0.1.0/koboi/tui/screens/welcome_screen.py +84 -0
- koboi_agent-0.1.0/koboi/tui/screens/yolo_confirm.py +82 -0
- koboi_agent-0.1.0/koboi/tui/textual_app.py +721 -0
- koboi_agent-0.1.0/koboi/tui/themes.py +43 -0
- koboi_agent-0.1.0/koboi/tui/widgets/__init__.py +21 -0
- koboi_agent-0.1.0/koboi/tui/widgets/chat_log.py +163 -0
- koboi_agent-0.1.0/koboi/tui/widgets/diff_view.py +185 -0
- koboi_agent-0.1.0/koboi/tui/widgets/file_suggester.py +141 -0
- koboi_agent-0.1.0/koboi/tui/widgets/header_bar.py +50 -0
- koboi_agent-0.1.0/koboi/tui/widgets/input_box.py +413 -0
- koboi_agent-0.1.0/koboi/tui/widgets/message_bubble.py +217 -0
- koboi_agent-0.1.0/koboi/tui/widgets/plan_view.py +157 -0
- koboi_agent-0.1.0/koboi/tui/widgets/risk_bar.py +40 -0
- koboi_agent-0.1.0/koboi/tui/widgets/slash_suggester.py +21 -0
- koboi_agent-0.1.0/koboi/tui/widgets/status_bar.py +74 -0
- koboi_agent-0.1.0/koboi/tui/widgets/thinking_block.py +70 -0
- koboi_agent-0.1.0/koboi/tui/widgets/tool_call.py +228 -0
- koboi_agent-0.1.0/koboi/types.py +252 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/PKG-INFO +232 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/SOURCES.txt +272 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/dependency_links.txt +1 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/entry_points.txt +2 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/requires.txt +61 -0
- koboi_agent-0.1.0/koboi_agent.egg-info/top_level.txt +1 -0
- koboi_agent-0.1.0/pyproject.toml +89 -0
- koboi_agent-0.1.0/setup.cfg +4 -0
- koboi_agent-0.1.0/tests/test_calculator_security.py +171 -0
- koboi_agent-0.1.0/tests/test_carryover.py +220 -0
- koboi_agent-0.1.0/tests/test_carryover_hook.py +237 -0
- koboi_agent-0.1.0/tests/test_cli.py +62 -0
- koboi_agent-0.1.0/tests/test_client.py +262 -0
- koboi_agent-0.1.0/tests/test_client_expanded.py +108 -0
- koboi_agent-0.1.0/tests/test_command_palette.py +54 -0
- koboi_agent-0.1.0/tests/test_config.py +286 -0
- koboi_agent-0.1.0/tests/test_context.py +65 -0
- koboi_agent-0.1.0/tests/test_context_hook.py +169 -0
- koboi_agent-0.1.0/tests/test_context_manager.py +197 -0
- koboi_agent-0.1.0/tests/test_context_registry.py +127 -0
- koboi_agent-0.1.0/tests/test_context_sliding_window.py +154 -0
- koboi_agent-0.1.0/tests/test_developer_mode.py +442 -0
- koboi_agent-0.1.0/tests/test_diagnostics.py +215 -0
- koboi_agent-0.1.0/tests/test_doom_loop.py +175 -0
- koboi_agent-0.1.0/tests/test_doom_loop_hook.py +302 -0
- koboi_agent-0.1.0/tests/test_eval.py +159 -0
- koboi_agent-0.1.0/tests/test_eval_config.py +101 -0
- koboi_agent-0.1.0/tests/test_eval_loaders.py +185 -0
- koboi_agent-0.1.0/tests/test_eval_loaders_expanded.py +84 -0
- koboi_agent-0.1.0/tests/test_eval_loaders_framework.py +208 -0
- koboi_agent-0.1.0/tests/test_eval_registry.py +46 -0
- koboi_agent-0.1.0/tests/test_eval_regression.py +87 -0
- koboi_agent-0.1.0/tests/test_eval_runner.py +168 -0
- koboi_agent-0.1.0/tests/test_eval_scorers_ex.py +201 -0
- koboi_agent-0.1.0/tests/test_eval_scorers_framework.py +329 -0
- koboi_agent-0.1.0/tests/test_events.py +94 -0
- koboi_agent-0.1.0/tests/test_events_expanded.py +98 -0
- koboi_agent-0.1.0/tests/test_exceptions.py +50 -0
- koboi_agent-0.1.0/tests/test_facade.py +225 -0
- koboi_agent-0.1.0/tests/test_facade_expanded.py +303 -0
- koboi_agent-0.1.0/tests/test_facade_expanded2.py +246 -0
- koboi_agent-0.1.0/tests/test_factory_helpers.py +284 -0
- koboi_agent-0.1.0/tests/test_filesystem_tools.py +306 -0
- koboi_agent-0.1.0/tests/test_git_tools.py +330 -0
- koboi_agent-0.1.0/tests/test_guardrail_hook.py +266 -0
- koboi_agent-0.1.0/tests/test_guardrails.py +71 -0
- koboi_agent-0.1.0/tests/test_guardrails_audit.py +235 -0
- koboi_agent-0.1.0/tests/test_harness.py +88 -0
- koboi_agent-0.1.0/tests/test_history.py +94 -0
- koboi_agent-0.1.0/tests/test_hook_registry.py +238 -0
- koboi_agent-0.1.0/tests/test_hooks.py +365 -0
- koboi_agent-0.1.0/tests/test_llm_anthropic_adapter.py +318 -0
- koboi_agent-0.1.0/tests/test_llm_anthropic_streaming.py +323 -0
- koboi_agent-0.1.0/tests/test_llm_auth.py +71 -0
- koboi_agent-0.1.0/tests/test_llm_factory.py +119 -0
- koboi_agent-0.1.0/tests/test_llm_openai_adapter.py +194 -0
- koboi_agent-0.1.0/tests/test_llm_openai_streaming.py +239 -0
- koboi_agent-0.1.0/tests/test_llm_transport.py +197 -0
- koboi_agent-0.1.0/tests/test_logger.py +397 -0
- koboi_agent-0.1.0/tests/test_loop.py +224 -0
- koboi_agent-0.1.0/tests/test_loop_expanded.py +655 -0
- koboi_agent-0.1.0/tests/test_loop_integration.py +304 -0
- koboi_agent-0.1.0/tests/test_main.py +20 -0
- koboi_agent-0.1.0/tests/test_mcp.py +98 -0
- koboi_agent-0.1.0/tests/test_mcp_expanded.py +185 -0
- koboi_agent-0.1.0/tests/test_mcp_full.py +267 -0
- koboi_agent-0.1.0/tests/test_mcp_http.py +473 -0
- koboi_agent-0.1.0/tests/test_mcp_server_expanded.py +175 -0
- koboi_agent-0.1.0/tests/test_memory.py +62 -0
- koboi_agent-0.1.0/tests/test_memory_sqlite.py +469 -0
- koboi_agent-0.1.0/tests/test_memory_sqlite_expanded.py +162 -0
- koboi_agent-0.1.0/tests/test_memory_tools.py +384 -0
- koboi_agent-0.1.0/tests/test_mode_hook.py +105 -0
- koboi_agent-0.1.0/tests/test_modes.py +134 -0
- koboi_agent-0.1.0/tests/test_orchestration.py +398 -0
- koboi_agent-0.1.0/tests/test_orchestration_expanded.py +207 -0
- koboi_agent-0.1.0/tests/test_orchestration_factory.py +210 -0
- koboi_agent-0.1.0/tests/test_orchestration_integration.py +509 -0
- koboi_agent-0.1.0/tests/test_orchestration_streaming.py +222 -0
- koboi_agent-0.1.0/tests/test_plugins.py +58 -0
- koboi_agent-0.1.0/tests/test_policy_audit.py +63 -0
- koboi_agent-0.1.0/tests/test_policy_hook.py +241 -0
- koboi_agent-0.1.0/tests/test_rag.py +286 -0
- koboi_agent-0.1.0/tests/test_rag_augmentation.py +192 -0
- koboi_agent-0.1.0/tests/test_rag_hook.py +177 -0
- koboi_agent-0.1.0/tests/test_rag_registry.py +534 -0
- koboi_agent-0.1.0/tests/test_rich_hooks.py +221 -0
- koboi_agent-0.1.0/tests/test_search_tools.py +383 -0
- koboi_agent-0.1.0/tests/test_shell_security.py +150 -0
- koboi_agent-0.1.0/tests/test_skill_hook.py +328 -0
- koboi_agent-0.1.0/tests/test_skills.py +73 -0
- koboi_agent-0.1.0/tests/test_skills_expanded.py +164 -0
- koboi_agent-0.1.0/tests/test_skills_parse_frontmatter.py +186 -0
- koboi_agent-0.1.0/tests/test_slash_commands.py +131 -0
- koboi_agent-0.1.0/tests/test_subagent.py +671 -0
- koboi_agent-0.1.0/tests/test_task.py +526 -0
- koboi_agent-0.1.0/tests/test_telemetry_hook.py +345 -0
- koboi_agent-0.1.0/tests/test_textual_tui.py +846 -0
- koboi_agent-0.1.0/tests/test_tools.py +86 -0
- koboi_agent-0.1.0/tests/test_tracing.py +256 -0
- koboi_agent-0.1.0/tests/test_trust.py +116 -0
- koboi_agent-0.1.0/tests/test_tui.py +698 -0
- koboi_agent-0.1.0/tests/test_tui_approval.py +139 -0
- koboi_agent-0.1.0/tests/test_tui_export.py +107 -0
- koboi_agent-0.1.0/tests/test_tui_features.py +487 -0
- koboi_agent-0.1.0/tests/test_tui_minimal.py +97 -0
- koboi_agent-0.1.0/tests/test_tui_notifications.py +39 -0
- koboi_agent-0.1.0/tests/test_tui_notifications_expanded.py +96 -0
- koboi_agent-0.1.0/tests/test_tui_screens.py +39 -0
- koboi_agent-0.1.0/tests/test_tui_screens_expanded.py +43 -0
- koboi_agent-0.1.0/tests/test_tui_screens_integration.py +278 -0
- koboi_agent-0.1.0/tests/test_tui_visual.py +233 -0
- koboi_agent-0.1.0/tests/test_tui_widgets_diff_plan.py +70 -0
- koboi_agent-0.1.0/tests/test_tui_widgets_ex.py +95 -0
- koboi_agent-0.1.0/tests/test_web_expanded.py +133 -0
- koboi_agent-0.1.0/tests/test_web_tools.py +210 -0
- koboi_agent-0.1.0/tests/test_yolo_pipeline.py +133 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Koboi Contributors
|
|
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,232 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: koboi-agent
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Universal configurable AI agent framework — production-grade, YAML-driven, open-source ready.
|
|
5
|
+
Author: Koboi Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/koboi-ai/koboi-agent
|
|
8
|
+
Project-URL: Repository, https://github.com/koboi-ai/koboi-agent
|
|
9
|
+
Project-URL: Documentation, https://github.com/koboi-ai/koboi-agent#readme
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Classifier: Framework :: AsyncIO
|
|
15
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
16
|
+
Requires-Python: >=3.10
|
|
17
|
+
Description-Content-Type: text/markdown
|
|
18
|
+
License-File: LICENSE
|
|
19
|
+
Requires-Dist: httpx>=0.25
|
|
20
|
+
Requires-Dist: pyyaml>=6.0
|
|
21
|
+
Requires-Dist: python-dotenv>=1.0
|
|
22
|
+
Requires-Dist: pydantic<3.0,>=2.0
|
|
23
|
+
Provides-Extra: tracing
|
|
24
|
+
Requires-Dist: langfuse<3.0,>=2.0; extra == "tracing"
|
|
25
|
+
Provides-Extra: tui
|
|
26
|
+
Requires-Dist: rich>=13.0; extra == "tui"
|
|
27
|
+
Requires-Dist: textual>=0.40; extra == "tui"
|
|
28
|
+
Requires-Dist: click>=8.0; extra == "tui"
|
|
29
|
+
Requires-Dist: prompt_toolkit>=3.0; extra == "tui"
|
|
30
|
+
Requires-Dist: rapidfuzz>=3.0; extra == "tui"
|
|
31
|
+
Provides-Extra: eval-ragas
|
|
32
|
+
Requires-Dist: ragas>=0.2; extra == "eval-ragas"
|
|
33
|
+
Requires-Dist: datasets>=2.14; extra == "eval-ragas"
|
|
34
|
+
Provides-Extra: eval-gaia
|
|
35
|
+
Requires-Dist: datasets>=2.14; extra == "eval-gaia"
|
|
36
|
+
Requires-Dist: pandas>=2.0; extra == "eval-gaia"
|
|
37
|
+
Provides-Extra: eval-swe-bench
|
|
38
|
+
Requires-Dist: datasets>=2.14; extra == "eval-swe-bench"
|
|
39
|
+
Requires-Dist: pandas>=2.0; extra == "eval-swe-bench"
|
|
40
|
+
Provides-Extra: eval-deepeval
|
|
41
|
+
Requires-Dist: deepeval>=0.20; extra == "eval-deepeval"
|
|
42
|
+
Provides-Extra: eval-all
|
|
43
|
+
Requires-Dist: ragas>=0.2; extra == "eval-all"
|
|
44
|
+
Requires-Dist: datasets>=2.14; extra == "eval-all"
|
|
45
|
+
Requires-Dist: pandas>=2.0; extra == "eval-all"
|
|
46
|
+
Requires-Dist: deepeval>=0.20; extra == "eval-all"
|
|
47
|
+
Provides-Extra: dev
|
|
48
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
49
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
50
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
51
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == "dev"
|
|
52
|
+
Requires-Dist: ruff>=0.4.0; extra == "dev"
|
|
53
|
+
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
54
|
+
Provides-Extra: all
|
|
55
|
+
Requires-Dist: langfuse<3.0,>=2.0; extra == "all"
|
|
56
|
+
Requires-Dist: rich>=13.0; extra == "all"
|
|
57
|
+
Requires-Dist: textual>=0.40; extra == "all"
|
|
58
|
+
Requires-Dist: click>=8.0; extra == "all"
|
|
59
|
+
Requires-Dist: prompt_toolkit>=3.0; extra == "all"
|
|
60
|
+
Requires-Dist: rapidfuzz>=3.0; extra == "all"
|
|
61
|
+
Requires-Dist: ragas>=0.2; extra == "all"
|
|
62
|
+
Requires-Dist: datasets>=2.14; extra == "all"
|
|
63
|
+
Requires-Dist: pandas>=2.0; extra == "all"
|
|
64
|
+
Requires-Dist: deepeval>=0.20; extra == "all"
|
|
65
|
+
Requires-Dist: pytest>=7.0; extra == "all"
|
|
66
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "all"
|
|
67
|
+
Requires-Dist: pytest-cov; extra == "all"
|
|
68
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == "all"
|
|
69
|
+
Requires-Dist: ruff>=0.4.0; extra == "all"
|
|
70
|
+
Requires-Dist: mypy>=1.0; extra == "all"
|
|
71
|
+
Dynamic: license-file
|
|
72
|
+
|
|
73
|
+
# koboi-agent
|
|
74
|
+
|
|
75
|
+
Configurable AI agent framework. YAML-driven config, async Python 3.10+, multi-provider LLM (OpenAI, Anthropic, Cloudflare).
|
|
76
|
+
|
|
77
|
+
## Features
|
|
78
|
+
|
|
79
|
+
- **Multi-provider LLM**: OpenAI, Anthropic, Cloudflare Workers AI
|
|
80
|
+
- **YAML-driven config** with `${ENV_VAR}` interpolation
|
|
81
|
+
- **Built-in tools**: calculator, filesystem, shell, web search, memory, git, subagent, task
|
|
82
|
+
- **Hook lifecycle**: 15 event types for logging, guardrails, telemetry
|
|
83
|
+
- **RAG pipeline**: chunking (fixed/sentence/paragraph/semantic), retrieval (keyword/semantic/hybrid), augmentation
|
|
84
|
+
- **Guardrails**: input/output validation, rate limiting, approval workflows, policy engine
|
|
85
|
+
- **Multi-agent orchestration**: keyword/LLM/hybrid routing, sequential/parallel execution
|
|
86
|
+
- **Context management**: truncation, smart truncation, key facts, sliding window
|
|
87
|
+
- **MCP** client (stdio + HTTP) and server support
|
|
88
|
+
- **Evaluation**: BFCL, GAIA, SWE-bench, RAGAS, DeepEval scorers
|
|
89
|
+
- **Terminal UI** (Textual): chat, command palette, diff view, session management
|
|
90
|
+
|
|
91
|
+
## Quickstart
|
|
92
|
+
|
|
93
|
+
### Install
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
pip install -e ".[dev,tui]"
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Set your API key
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
cp .env.example .env
|
|
103
|
+
# Edit .env and set OPENAI_API_KEY
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Run the CLI
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
koboi chat configs/simple_chat.yaml
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
### Run programmatically
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
import asyncio
|
|
116
|
+
from koboi import KoboiAgent
|
|
117
|
+
|
|
118
|
+
async def main():
|
|
119
|
+
async with KoboiAgent.from_config("configs/simple_chat.yaml") as agent:
|
|
120
|
+
result = await agent.run("What is 2 + 2?")
|
|
121
|
+
print(result.content)
|
|
122
|
+
|
|
123
|
+
asyncio.run(main())
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
## Configuration
|
|
127
|
+
|
|
128
|
+
Agents are configured via YAML. Key sections:
|
|
129
|
+
|
|
130
|
+
```yaml
|
|
131
|
+
agent:
|
|
132
|
+
name: "my-agent"
|
|
133
|
+
system_prompt: "You are helpful."
|
|
134
|
+
max_iterations: 10
|
|
135
|
+
mode: "chat" # chat | plan | act | auto
|
|
136
|
+
|
|
137
|
+
llm:
|
|
138
|
+
provider: "openai" # openai | anthropic | cloudflare
|
|
139
|
+
model: "gpt-4o-mini"
|
|
140
|
+
api_key: "${OPENAI_API_KEY}"
|
|
141
|
+
base_url: "${OPENAI_BASE_URL:}"
|
|
142
|
+
|
|
143
|
+
tools:
|
|
144
|
+
builtin: [calculator, web_search, memory_store, memory_recall]
|
|
145
|
+
custom:
|
|
146
|
+
- module: "my_tools"
|
|
147
|
+
|
|
148
|
+
context:
|
|
149
|
+
strategy: "sliding_window" # noop | truncation | smart_truncation | key_facts | sliding_window
|
|
150
|
+
max_context_tokens: 8000
|
|
151
|
+
|
|
152
|
+
rag:
|
|
153
|
+
enabled: true
|
|
154
|
+
chunker: "paragraph" # fixed | sentence | paragraph
|
|
155
|
+
retriever: "keyword" # keyword | semantic
|
|
156
|
+
top_k: 3
|
|
157
|
+
documents:
|
|
158
|
+
- path: "./data/sample/product_catalog.md"
|
|
159
|
+
|
|
160
|
+
guardrails:
|
|
161
|
+
input:
|
|
162
|
+
max_length: 10000
|
|
163
|
+
rate_limit:
|
|
164
|
+
max_calls_per_minute: 20
|
|
165
|
+
|
|
166
|
+
harness:
|
|
167
|
+
doom_loop:
|
|
168
|
+
consecutive_identical_threshold: 3
|
|
169
|
+
telemetry: true
|
|
170
|
+
carryover: true
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
See `configs/` for full examples and `.claude/skills/yaml-config.md` for the complete schema.
|
|
174
|
+
|
|
175
|
+
## Testing
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pytest # all tests
|
|
179
|
+
pytest tests/test_config.py # single file
|
|
180
|
+
pytest -k "hook" # by keyword
|
|
181
|
+
pytest --cov=koboi # with coverage
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
## Examples
|
|
185
|
+
|
|
186
|
+
`examples/` contains 28 numbered scripts covering every feature:
|
|
187
|
+
|
|
188
|
+
| Range | Features |
|
|
189
|
+
|-------|----------|
|
|
190
|
+
| 01-04 | Basic chat and tool use |
|
|
191
|
+
| 05-08 | Context management and RAG |
|
|
192
|
+
| 09-10 | MCP client/server |
|
|
193
|
+
| 11-14 | Policy, hooks, skills, custom tools |
|
|
194
|
+
| 15-16 | Multi-agent orchestration |
|
|
195
|
+
| 17 | Anthropic provider |
|
|
196
|
+
| 18-20 | Harness (telemetry, doom loop, carryover) |
|
|
197
|
+
| 21-24 | Evaluation, production setup, SWE-bench, config-driven orchestration |
|
|
198
|
+
| 25-28 | Subagent delegation, task management, benchmarks, custom RAG |
|
|
199
|
+
|
|
200
|
+
Run any example:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
python examples/01_simple_chat.py # automatic mode
|
|
204
|
+
python examples/01_simple_chat.py -m interactive # interactive mode
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
## Architecture
|
|
208
|
+
|
|
209
|
+
For a detailed architecture overview (agent loop lifecycle, hook system, tool pipeline, extension points), see **[docs/architecture.md](docs/architecture.md)**.
|
|
210
|
+
|
|
211
|
+
`KoboiAgent` (`facade.py`) is the single entry point. It assembles:
|
|
212
|
+
|
|
213
|
+
- **AgentCore** (`loop.py`) -- async agent loop
|
|
214
|
+
- **RetryClient** (`client.py`) -- LLM HTTP transport with retry
|
|
215
|
+
- **ToolRegistry** (`tools/`) -- tool registration and execution
|
|
216
|
+
- **HookChain** (`hooks/`) -- lifecycle event dispatch (15 events)
|
|
217
|
+
- **ContextManager** (`context/`) -- context window strategies
|
|
218
|
+
- **AugmentationStrategy** (`rag/`) -- RAG pipeline
|
|
219
|
+
- **Guardrails** (`guardrails/`) -- input/output validation
|
|
220
|
+
- **PolicyEngine** (`harness/`) -- rule-based tool filtering
|
|
221
|
+
- **SkillRegistry** (`skills/`) -- skill discovery
|
|
222
|
+
- **ModeManager** (`modes.py`) -- chat/plan/act/auto modes
|
|
223
|
+
- **TrustDatabase** (`trust.py`) -- graduated permissions
|
|
224
|
+
- **Orchestrator** (`orchestration/`) -- multi-agent coordination
|
|
225
|
+
- **SubAgentManager** (`subagent.py`) -- parallel sub-agent delegation
|
|
226
|
+
- **MCP clients** (`mcp/`) -- external tool servers
|
|
227
|
+
|
|
228
|
+
All subsystems are configured from a single YAML file via `Config` (`config.py`).
|
|
229
|
+
|
|
230
|
+
## License
|
|
231
|
+
|
|
232
|
+
MIT
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# koboi-agent
|
|
2
|
+
|
|
3
|
+
Configurable AI agent framework. YAML-driven config, async Python 3.10+, multi-provider LLM (OpenAI, Anthropic, Cloudflare).
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- **Multi-provider LLM**: OpenAI, Anthropic, Cloudflare Workers AI
|
|
8
|
+
- **YAML-driven config** with `${ENV_VAR}` interpolation
|
|
9
|
+
- **Built-in tools**: calculator, filesystem, shell, web search, memory, git, subagent, task
|
|
10
|
+
- **Hook lifecycle**: 15 event types for logging, guardrails, telemetry
|
|
11
|
+
- **RAG pipeline**: chunking (fixed/sentence/paragraph/semantic), retrieval (keyword/semantic/hybrid), augmentation
|
|
12
|
+
- **Guardrails**: input/output validation, rate limiting, approval workflows, policy engine
|
|
13
|
+
- **Multi-agent orchestration**: keyword/LLM/hybrid routing, sequential/parallel execution
|
|
14
|
+
- **Context management**: truncation, smart truncation, key facts, sliding window
|
|
15
|
+
- **MCP** client (stdio + HTTP) and server support
|
|
16
|
+
- **Evaluation**: BFCL, GAIA, SWE-bench, RAGAS, DeepEval scorers
|
|
17
|
+
- **Terminal UI** (Textual): chat, command palette, diff view, session management
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
### Install
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install -e ".[dev,tui]"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Set your API key
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
cp .env.example .env
|
|
31
|
+
# Edit .env and set OPENAI_API_KEY
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Run the CLI
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
koboi chat configs/simple_chat.yaml
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Run programmatically
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import asyncio
|
|
44
|
+
from koboi import KoboiAgent
|
|
45
|
+
|
|
46
|
+
async def main():
|
|
47
|
+
async with KoboiAgent.from_config("configs/simple_chat.yaml") as agent:
|
|
48
|
+
result = await agent.run("What is 2 + 2?")
|
|
49
|
+
print(result.content)
|
|
50
|
+
|
|
51
|
+
asyncio.run(main())
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## Configuration
|
|
55
|
+
|
|
56
|
+
Agents are configured via YAML. Key sections:
|
|
57
|
+
|
|
58
|
+
```yaml
|
|
59
|
+
agent:
|
|
60
|
+
name: "my-agent"
|
|
61
|
+
system_prompt: "You are helpful."
|
|
62
|
+
max_iterations: 10
|
|
63
|
+
mode: "chat" # chat | plan | act | auto
|
|
64
|
+
|
|
65
|
+
llm:
|
|
66
|
+
provider: "openai" # openai | anthropic | cloudflare
|
|
67
|
+
model: "gpt-4o-mini"
|
|
68
|
+
api_key: "${OPENAI_API_KEY}"
|
|
69
|
+
base_url: "${OPENAI_BASE_URL:}"
|
|
70
|
+
|
|
71
|
+
tools:
|
|
72
|
+
builtin: [calculator, web_search, memory_store, memory_recall]
|
|
73
|
+
custom:
|
|
74
|
+
- module: "my_tools"
|
|
75
|
+
|
|
76
|
+
context:
|
|
77
|
+
strategy: "sliding_window" # noop | truncation | smart_truncation | key_facts | sliding_window
|
|
78
|
+
max_context_tokens: 8000
|
|
79
|
+
|
|
80
|
+
rag:
|
|
81
|
+
enabled: true
|
|
82
|
+
chunker: "paragraph" # fixed | sentence | paragraph
|
|
83
|
+
retriever: "keyword" # keyword | semantic
|
|
84
|
+
top_k: 3
|
|
85
|
+
documents:
|
|
86
|
+
- path: "./data/sample/product_catalog.md"
|
|
87
|
+
|
|
88
|
+
guardrails:
|
|
89
|
+
input:
|
|
90
|
+
max_length: 10000
|
|
91
|
+
rate_limit:
|
|
92
|
+
max_calls_per_minute: 20
|
|
93
|
+
|
|
94
|
+
harness:
|
|
95
|
+
doom_loop:
|
|
96
|
+
consecutive_identical_threshold: 3
|
|
97
|
+
telemetry: true
|
|
98
|
+
carryover: true
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
See `configs/` for full examples and `.claude/skills/yaml-config.md` for the complete schema.
|
|
102
|
+
|
|
103
|
+
## Testing
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pytest # all tests
|
|
107
|
+
pytest tests/test_config.py # single file
|
|
108
|
+
pytest -k "hook" # by keyword
|
|
109
|
+
pytest --cov=koboi # with coverage
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Examples
|
|
113
|
+
|
|
114
|
+
`examples/` contains 28 numbered scripts covering every feature:
|
|
115
|
+
|
|
116
|
+
| Range | Features |
|
|
117
|
+
|-------|----------|
|
|
118
|
+
| 01-04 | Basic chat and tool use |
|
|
119
|
+
| 05-08 | Context management and RAG |
|
|
120
|
+
| 09-10 | MCP client/server |
|
|
121
|
+
| 11-14 | Policy, hooks, skills, custom tools |
|
|
122
|
+
| 15-16 | Multi-agent orchestration |
|
|
123
|
+
| 17 | Anthropic provider |
|
|
124
|
+
| 18-20 | Harness (telemetry, doom loop, carryover) |
|
|
125
|
+
| 21-24 | Evaluation, production setup, SWE-bench, config-driven orchestration |
|
|
126
|
+
| 25-28 | Subagent delegation, task management, benchmarks, custom RAG |
|
|
127
|
+
|
|
128
|
+
Run any example:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
python examples/01_simple_chat.py # automatic mode
|
|
132
|
+
python examples/01_simple_chat.py -m interactive # interactive mode
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
## Architecture
|
|
136
|
+
|
|
137
|
+
For a detailed architecture overview (agent loop lifecycle, hook system, tool pipeline, extension points), see **[docs/architecture.md](docs/architecture.md)**.
|
|
138
|
+
|
|
139
|
+
`KoboiAgent` (`facade.py`) is the single entry point. It assembles:
|
|
140
|
+
|
|
141
|
+
- **AgentCore** (`loop.py`) -- async agent loop
|
|
142
|
+
- **RetryClient** (`client.py`) -- LLM HTTP transport with retry
|
|
143
|
+
- **ToolRegistry** (`tools/`) -- tool registration and execution
|
|
144
|
+
- **HookChain** (`hooks/`) -- lifecycle event dispatch (15 events)
|
|
145
|
+
- **ContextManager** (`context/`) -- context window strategies
|
|
146
|
+
- **AugmentationStrategy** (`rag/`) -- RAG pipeline
|
|
147
|
+
- **Guardrails** (`guardrails/`) -- input/output validation
|
|
148
|
+
- **PolicyEngine** (`harness/`) -- rule-based tool filtering
|
|
149
|
+
- **SkillRegistry** (`skills/`) -- skill discovery
|
|
150
|
+
- **ModeManager** (`modes.py`) -- chat/plan/act/auto modes
|
|
151
|
+
- **TrustDatabase** (`trust.py`) -- graduated permissions
|
|
152
|
+
- **Orchestrator** (`orchestration/`) -- multi-agent coordination
|
|
153
|
+
- **SubAgentManager** (`subagent.py`) -- parallel sub-agent delegation
|
|
154
|
+
- **MCP clients** (`mcp/`) -- external tool servers
|
|
155
|
+
|
|
156
|
+
All subsystems are configured from a single YAML file via `Config` (`config.py`).
|
|
157
|
+
|
|
158
|
+
## License
|
|
159
|
+
|
|
160
|
+
MIT
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""koboi — Universal configurable AI agent framework.
|
|
2
|
+
|
|
3
|
+
Usage:
|
|
4
|
+
from koboi import KoboiAgent
|
|
5
|
+
|
|
6
|
+
agent = KoboiAgent.from_config("configs/sales_agent.yaml")
|
|
7
|
+
result = await agent.run("What products are available?")
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
try:
|
|
12
|
+
from importlib.metadata import version as _get_version
|
|
13
|
+
__version__ = _get_version("koboi-agent")
|
|
14
|
+
except Exception:
|
|
15
|
+
__version__ = "0.1.0"
|
|
16
|
+
|
|
17
|
+
# --- Eager imports: lightweight, always needed ---
|
|
18
|
+
from koboi.config import Config, ConfigBuilder
|
|
19
|
+
from koboi.facade import KoboiAgent
|
|
20
|
+
from koboi.types import (
|
|
21
|
+
RiskLevel, ToolDefinition, ToolCall, ToolResult,
|
|
22
|
+
TokenUsage, AgentResponse, RunResult,
|
|
23
|
+
GuardrailResult, AuditEntry, RateLimitConfig,
|
|
24
|
+
RoutingDecision, AgentResult, OrchestratorResult, AgentBlueprint, AgentDef,
|
|
25
|
+
MCPToolInfo, SkillDefinition,
|
|
26
|
+
EvalScore, EvalResult, EvalCase,
|
|
27
|
+
)
|
|
28
|
+
from koboi.client import RetryClient, Client, ClientError, RetryClientError
|
|
29
|
+
from koboi.memory import ConversationMemory, MemoryBackend
|
|
30
|
+
from koboi.tools.registry import ToolRegistry, tool, register_decorated
|
|
31
|
+
from koboi.logger import AgentLogger
|
|
32
|
+
from koboi.tokens import estimate_tokens, estimate_single
|
|
33
|
+
from koboi.exceptions import (
|
|
34
|
+
AgentError, AgentMaxIterationsError, AgentGuardrailError,
|
|
35
|
+
AgentToolError, AgentTimeoutError, AgentStreamError, AgentAbortedError,
|
|
36
|
+
)
|
|
37
|
+
from koboi.events import (
|
|
38
|
+
StreamEvent, TextDeltaEvent, ToolCallEvent, ToolResultEvent,
|
|
39
|
+
IterationEvent, CompleteEvent, ErrorEvent,
|
|
40
|
+
RoutingDecisionEvent, AgentDispatchEvent, AgentResultEvent, OrchestrationCompleteEvent,
|
|
41
|
+
)
|
|
42
|
+
from koboi.hooks import HookEvent, HookContext, Hook, HookChain, HookOutcome, AgentInfo
|
|
43
|
+
from koboi.hooks.callback_hook import CallbackHook
|
|
44
|
+
|
|
45
|
+
# --- Lazy imports: heavier subsystems, loaded on first access ---
|
|
46
|
+
_LAZY_IMPORTS: dict[str, tuple[str, str]] = {
|
|
47
|
+
# LLM
|
|
48
|
+
"LLMClient": ("koboi.llm.base", "LLMClient"),
|
|
49
|
+
"LLMError": ("koboi.llm.base", "LLMError"),
|
|
50
|
+
"LLMConnectionError": ("koboi.llm.base", "LLMConnectionError"),
|
|
51
|
+
"LLMAuthenticationError": ("koboi.llm.base", "LLMAuthenticationError"),
|
|
52
|
+
"LLMRateLimitError": ("koboi.llm.base", "LLMRateLimitError"),
|
|
53
|
+
"LLMServerError": ("koboi.llm.base", "LLMServerError"),
|
|
54
|
+
"LLMInvalidRequestError": ("koboi.llm.base", "LLMInvalidRequestError"),
|
|
55
|
+
"LLMResponseParseError": ("koboi.llm.base", "LLMResponseParseError"),
|
|
56
|
+
"create_client": ("koboi.llm.factory", "create_client"),
|
|
57
|
+
# Orchestration
|
|
58
|
+
"BaseRouter": ("koboi.orchestration.router", "BaseRouter"),
|
|
59
|
+
"KeywordRouter": ("koboi.orchestration.router", "KeywordRouter"),
|
|
60
|
+
"LLMRouter": ("koboi.orchestration.router", "LLMRouter"),
|
|
61
|
+
"HybridRouter": ("koboi.orchestration.router", "HybridRouter"),
|
|
62
|
+
"Orchestrator": ("koboi.orchestration.orchestrator", "Orchestrator"),
|
|
63
|
+
"QualityEvaluator": ("koboi.orchestration.orchestrator", "QualityEvaluator"),
|
|
64
|
+
"AgentFactory": ("koboi.orchestration.factory", "AgentFactory"),
|
|
65
|
+
"DynamicAgentBuilder": ("koboi.orchestration.factory", "DynamicAgentBuilder"),
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
def __getattr__(name: str):
|
|
70
|
+
if name in _LAZY_IMPORTS:
|
|
71
|
+
module_path, attr_name = _LAZY_IMPORTS[name]
|
|
72
|
+
import importlib
|
|
73
|
+
module = importlib.import_module(module_path)
|
|
74
|
+
return getattr(module, attr_name)
|
|
75
|
+
raise AttributeError(f"module 'koboi' has no attribute {name!r}")
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
# Discover and load external plugins at import time
|
|
79
|
+
try:
|
|
80
|
+
from koboi.plugins import discover_plugins as _discover_plugins
|
|
81
|
+
_discover_plugins()
|
|
82
|
+
except Exception:
|
|
83
|
+
pass # Plugin discovery is best-effort
|
|
84
|
+
|
|
85
|
+
__all__ = [
|
|
86
|
+
# Core
|
|
87
|
+
"__version__", "KoboiAgent", "Config", "ConfigBuilder",
|
|
88
|
+
# Orchestration
|
|
89
|
+
"BaseRouter", "KeywordRouter", "LLMRouter", "HybridRouter",
|
|
90
|
+
"Orchestrator", "QualityEvaluator", "AgentFactory", "DynamicAgentBuilder",
|
|
91
|
+
# Types
|
|
92
|
+
"RiskLevel", "ToolDefinition", "ToolCall", "ToolResult",
|
|
93
|
+
"TokenUsage", "AgentResponse", "RunResult",
|
|
94
|
+
"GuardrailResult", "AuditEntry", "RateLimitConfig",
|
|
95
|
+
"RoutingDecision", "AgentResult", "OrchestratorResult", "AgentBlueprint", "AgentDef",
|
|
96
|
+
"MCPToolInfo", "SkillDefinition",
|
|
97
|
+
"EvalScore", "EvalResult", "EvalCase",
|
|
98
|
+
# Client
|
|
99
|
+
"RetryClient", "Client", "ClientError", "RetryClientError",
|
|
100
|
+
# Memory
|
|
101
|
+
"ConversationMemory", "MemoryBackend",
|
|
102
|
+
# Tools
|
|
103
|
+
"ToolRegistry", "tool", "register_decorated",
|
|
104
|
+
# Logging
|
|
105
|
+
"AgentLogger",
|
|
106
|
+
# Tokens
|
|
107
|
+
"estimate_tokens", "estimate_single",
|
|
108
|
+
# Exceptions
|
|
109
|
+
"AgentError", "AgentMaxIterationsError", "AgentGuardrailError",
|
|
110
|
+
"AgentToolError", "AgentTimeoutError", "AgentStreamError", "AgentAbortedError",
|
|
111
|
+
# Events
|
|
112
|
+
"StreamEvent", "TextDeltaEvent", "ToolCallEvent", "ToolResultEvent",
|
|
113
|
+
"IterationEvent", "CompleteEvent", "ErrorEvent",
|
|
114
|
+
"RoutingDecisionEvent", "AgentDispatchEvent", "AgentResultEvent", "OrchestrationCompleteEvent",
|
|
115
|
+
# Hooks
|
|
116
|
+
"HookEvent", "HookContext", "Hook", "HookChain", "HookOutcome", "AgentInfo", "CallbackHook",
|
|
117
|
+
# LLM
|
|
118
|
+
"LLMClient", "LLMError", "LLMConnectionError", "LLMAuthenticationError",
|
|
119
|
+
"LLMRateLimitError", "LLMServerError", "LLMInvalidRequestError", "LLMResponseParseError",
|
|
120
|
+
"create_client",
|
|
121
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"""Allow running koboi as `python -m koboi`."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
try:
|
|
5
|
+
from koboi.tui.app import main
|
|
6
|
+
except ImportError:
|
|
7
|
+
import sys
|
|
8
|
+
print(
|
|
9
|
+
"Error: TUI dependencies not installed.\n"
|
|
10
|
+
"Install with: pip install koboi-agent[tui]",
|
|
11
|
+
file=sys.stderr,
|
|
12
|
+
)
|
|
13
|
+
sys.exit(1)
|
|
14
|
+
|
|
15
|
+
if __name__ == "__main__":
|
|
16
|
+
main()
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""koboi/cli -- Console-script entry point with graceful TUI-dep handling."""
|
|
2
|
+
from __future__ import annotations
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
def main() -> None:
|
|
8
|
+
"""Entry point for the ``koboi`` console script."""
|
|
9
|
+
try:
|
|
10
|
+
from koboi.tui.app import main as tui_main
|
|
11
|
+
except ImportError:
|
|
12
|
+
print(
|
|
13
|
+
"Error: TUI dependencies (click, rich, textual) are not installed.\n"
|
|
14
|
+
"\n"
|
|
15
|
+
"Install them with:\n"
|
|
16
|
+
" pip install koboi-agent[tui]\n"
|
|
17
|
+
"\n"
|
|
18
|
+
"Or install everything:\n"
|
|
19
|
+
" pip install koboi-agent[all]\n",
|
|
20
|
+
file=sys.stderr,
|
|
21
|
+
)
|
|
22
|
+
sys.exit(1)
|
|
23
|
+
|
|
24
|
+
tui_main()
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
if __name__ == "__main__":
|
|
28
|
+
main()
|