agentkthx 0.6.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 (119) hide show
  1. agentkthx/__init__.py +204 -0
  2. agentkthx/__main__.py +12 -0
  3. agentkthx/acp_plugin.py +2397 -0
  4. agentkthx/agent.py +1736 -0
  5. agentkthx/agent_mode.py +862 -0
  6. agentkthx/backends/__init__.py +180 -0
  7. agentkthx/backends/base.py +271 -0
  8. agentkthx/backends/bitnet.py +63 -0
  9. agentkthx/backends/llama_server.py +923 -0
  10. agentkthx/backends/ollama.py +1603 -0
  11. agentkthx/backends/ollama_registry.py +481 -0
  12. agentkthx/cli.py +3053 -0
  13. agentkthx/colors.py +377 -0
  14. agentkthx/config.py +237 -0
  15. agentkthx/core/__init__.py +151 -0
  16. agentkthx/core/args_normal.py +329 -0
  17. agentkthx/core/error_recovery.py +798 -0
  18. agentkthx/core/helpers.py +1004 -0
  19. agentkthx/core/math_prompts.py +396 -0
  20. agentkthx/core/memory.py +184 -0
  21. agentkthx/core/model_config.py +36 -0
  22. agentkthx/core/model_family_config.py +530 -0
  23. agentkthx/core/models.py +134 -0
  24. agentkthx/core/openresponses.py +1068 -0
  25. agentkthx/core/persistent_memory.py +442 -0
  26. agentkthx/core/prompts.py +386 -0
  27. agentkthx/core/tool_cache.py +224 -0
  28. agentkthx/core/tool_parse.py +687 -0
  29. agentkthx/core/types.py +181 -0
  30. agentkthx/examples/00_basic_agent.py +112 -0
  31. agentkthx/examples/01_quick_diagnostic.py +280 -0
  32. agentkthx/examples/02_tool_test.py +1830 -0
  33. agentkthx/examples/03_reasoning_test.py +316 -0
  34. agentkthx/examples/04_gsm8k_benchmark.py +268 -0
  35. agentkthx/examples/05_common_sense.py +424 -0
  36. agentkthx/examples/06_causal_reasoning.py +405 -0
  37. agentkthx/examples/07_logical_deduction.py +396 -0
  38. agentkthx/examples/08_reading_comprehension.py +457 -0
  39. agentkthx/examples/09_general_knowledge.py +416 -0
  40. agentkthx/examples/10_implicit_reasoning.py +395 -0
  41. agentkthx/examples/11_analogical_reasoning.py +402 -0
  42. agentkthx/examples/__init__.py +21 -0
  43. agentkthx/model_discovery.py +473 -0
  44. agentkthx/orchestrator.py +492 -0
  45. agentkthx/plugins/__init__.py +40 -0
  46. agentkthx/plugins/_loader.py +563 -0
  47. agentkthx/plugins/acp/__init__.py +31 -0
  48. agentkthx/plugins/acp/acp_plugin.py +2397 -0
  49. agentkthx/plugins/acp/plugin.json +28 -0
  50. agentkthx/plugins/bitnet/__init__.py +20 -0
  51. agentkthx/plugins/bitnet/bitnet.py +63 -0
  52. agentkthx/plugins/bitnet/plugin.json +31 -0
  53. agentkthx/plugins/openrouter/__init__.py +20 -0
  54. agentkthx/plugins/openrouter/openrouter.py +1055 -0
  55. agentkthx/plugins/openrouter/plugin.json +32 -0
  56. agentkthx/plugins/test-plugin/__init__.py +92 -0
  57. agentkthx/plugins/test-plugin/plugin.json +31 -0
  58. agentkthx/plugins/test-plugin/test_backend.py +52 -0
  59. agentkthx/plugins/turboquant/__init__.py +36 -0
  60. agentkthx/plugins/turboquant/plugin.json +28 -0
  61. agentkthx/plugins/turboquant/turbo.py +694 -0
  62. agentkthx/plugins/zai/__init__.py +20 -0
  63. agentkthx/plugins/zai/plugin.json +33 -0
  64. agentkthx/plugins/zai/zai.py +985 -0
  65. agentkthx/py.typed +2 -0
  66. agentkthx/shared_args.py +376 -0
  67. agentkthx/skills/__init__.py +38 -0
  68. agentkthx/skills/codebase-audit/SKILL.md +230 -0
  69. agentkthx/skills/crypto-signals/SKILL.md +127 -0
  70. agentkthx/skills/crypto-signals/scripts/crypto_signal_agent.py +425 -0
  71. agentkthx/skills/loader.py +735 -0
  72. agentkthx/skills/skill-creator/SKILL.md +112 -0
  73. agentkthx/skills/skill-creator/scripts/__init__.py +1 -0
  74. agentkthx/skills/skill-creator/scripts/aggregate_benchmark.py +401 -0
  75. agentkthx/skills/skill-creator/scripts/generate_report.py +326 -0
  76. agentkthx/skills/skill-creator/scripts/improve_description.py +247 -0
  77. agentkthx/skills/skill-creator/scripts/init_skill.py +378 -0
  78. agentkthx/skills/skill-creator/scripts/package_skill.py +139 -0
  79. agentkthx/skills/skill-creator/scripts/quick_validate.py +159 -0
  80. agentkthx/skills/skill-creator/scripts/run_eval.py +310 -0
  81. agentkthx/skills/skill-creator/scripts/run_loop.py +328 -0
  82. agentkthx/skills/skill-creator/scripts/security_scan.py +144 -0
  83. agentkthx/skills/skill-creator/scripts/test_package_skill.py +160 -0
  84. agentkthx/skills/skill-creator/scripts/test_quick_validate.py +72 -0
  85. agentkthx/skills/skill-creator/scripts/utils.py +47 -0
  86. agentkthx/skills/skill-creator/scripts/validate.py +147 -0
  87. agentkthx/skills/test-harness/SKILL.md +122 -0
  88. agentkthx/soul/__init__.py +99 -0
  89. agentkthx/soul/loader.py +1067 -0
  90. agentkthx/soul/types.py +285 -0
  91. agentkthx/souls/nova-helper/AGENTS.md +98 -0
  92. agentkthx/souls/nova-helper/IDENTITY.md +14 -0
  93. agentkthx/souls/nova-helper/SOUL.md +192 -0
  94. agentkthx/souls/nova-helper/STYLE.md +83 -0
  95. agentkthx/souls/nova-helper/soul.json +31 -0
  96. agentkthx/souls/nova-skills/AGENTS.md +112 -0
  97. agentkthx/souls/nova-skills/IDENTITY.md +14 -0
  98. agentkthx/souls/nova-skills/SOUL.md +26 -0
  99. agentkthx/souls/nova-skills/STYLE.md +21 -0
  100. agentkthx/souls/nova-skills/soul.json +31 -0
  101. agentkthx/souls/nova-trading/AGENTS.md +78 -0
  102. agentkthx/souls/nova-trading/IDENTITY.md +39 -0
  103. agentkthx/souls/nova-trading/SOUL.md +183 -0
  104. agentkthx/souls/nova-trading/STYLE.md +77 -0
  105. agentkthx/souls/nova-trading/TRADING_REFERENCE.md +234 -0
  106. agentkthx/souls/nova-trading/soul.json +32 -0
  107. agentkthx/tools/__init__.py +23 -0
  108. agentkthx/tools/builtins.py +1431 -0
  109. agentkthx/tools/registry.py +194 -0
  110. agentkthx/tools/sandboxed_repl.py +522 -0
  111. agentkthx/turbo.py +694 -0
  112. agentkthx-0.6.0.dist-info/METADATA +766 -0
  113. agentkthx-0.6.0.dist-info/RECORD +119 -0
  114. agentkthx-0.6.0.dist-info/WHEEL +5 -0
  115. agentkthx-0.6.0.dist-info/entry_points.txt +10 -0
  116. agentkthx-0.6.0.dist-info/licenses/LICENSE +21 -0
  117. agentkthx-0.6.0.dist-info/top_level.txt +3 -0
  118. agentnova/__init__.py +74 -0
  119. localclaw/__init__.py +51 -0
agentkthx/__init__.py ADDED
@@ -0,0 +1,204 @@
1
+ """
2
+ ⚛️ AgentKthx R06.0
3
+ A minimal, hackable agentic framework engineered for local inference.
4
+
5
+ Features:
6
+ • Zero dependencies — uses Python stdlib only
7
+ • Ollama + OpenRouter + BitNet backends — switch with --backend flag
8
+ • Three-tier tool support — native, ReAct, or none (auto-detected)
9
+ • Small model optimized — fuzzy matching, argument normalization
10
+ • Built-in security — path validation, command blocklist, SSRF protection
11
+ • Soul Spec v0.5 — persona packages (disabled by default, use --soul)
12
+ • Multi-cloud support — 500+ models via OpenRouter plugin
13
+
14
+ Status: Alpha
15
+
16
+ Written by VTSTech — https://www.vts-tech.org
17
+
18
+ Example Usage:
19
+ from agentkthx import Agent
20
+ from agentkthx.tools import make_builtin_registry
21
+
22
+ tools = make_builtin_registry().subset(["calculator", "shell"])
23
+ agent = Agent(model="qwen2.5:0.5b", tools=tools)
24
+
25
+ result = agent.run("What is 15 * 8?")
26
+ print(result.final_answer)
27
+
28
+ # With Soul Spec (disabled by default)
29
+ agent = Agent(model="qwen2.5:0.5b", soul="/path/to/soul/package")
30
+ """
31
+
32
+ __version__ = "0.6.0"
33
+ __author__ = "VTSTech"
34
+ __status__ = "Alpha"
35
+
36
+
37
+ def _get_git_short_hash() -> str:
38
+ """
39
+ Get the short git commit hash of the repository.
40
+
41
+ Works when running from source (has .git directory).
42
+ Returns empty string when installed via pip or git is unavailable.
43
+ """
44
+ import subprocess
45
+ try:
46
+ # Try to find the repo root from this file's location
47
+ # Walk up from agentkthx/ looking for .git
48
+ import os
49
+ check_dir = os.path.dirname(os.path.abspath(__file__))
50
+ for _ in range(5): # don't walk up more than 5 levels
51
+ if os.path.isdir(os.path.join(check_dir, ".git")):
52
+ # We're inside a git repo — get the short hash
53
+ result = subprocess.run(
54
+ ["git", "rev-parse", "--short", "HEAD"],
55
+ cwd=check_dir,
56
+ capture_output=True,
57
+ text=True,
58
+ timeout=5,
59
+ )
60
+ if result.returncode == 0:
61
+ return result.stdout.strip()
62
+ break
63
+ parent = os.path.dirname(check_dir)
64
+ if parent == check_dir:
65
+ break
66
+ check_dir = parent
67
+ except Exception:
68
+ pass
69
+ return ""
70
+
71
+
72
+ # Append git commit hash to version if available
73
+ _git_hash = _get_git_short_hash()
74
+ if _git_hash:
75
+ __version__ = f"{__version__}-{_git_hash}"
76
+
77
+ from .agent import Agent
78
+ from .agent_mode import AgentMode, AgentState, TaskPlan
79
+ from .orchestrator import Orchestrator, AgentCard
80
+ from .core.models import StepResult, AgentRun, Tool, ToolParam
81
+ from .core.types import StepResultType, ToolSupportLevel, BackendType
82
+ from .tools import ToolRegistry, make_builtin_registry, BUILTIN_REGISTRY
83
+ from .backends import (
84
+ BaseBackend, OllamaBackend, LlamaServerBackend,
85
+ get_default_backend, get_backend, get_backend_choices,
86
+ )
87
+ from .config import Config, get_config
88
+ from .config import (
89
+ OLLAMA_BASE_URL,
90
+ BITNET_BASE_URL,
91
+ ZAI_BASE_URL,
92
+ OPENROUTER_BASE_URL,
93
+ OPENROUTER_API_KEY,
94
+ OPENROUTER_DEFAULT_MODEL,
95
+ ACP_BASE_URL,
96
+ ACP_USER,
97
+ ACP_PASS,
98
+ DEFAULT_MODEL,
99
+ AGENTNOVA_BACKEND,
100
+ )
101
+ from .model_discovery import (
102
+ get_models, get_available_models, pick_best_model,
103
+ pick_models_for_benchmark, model_exists, get_client,
104
+ )
105
+ from .shared_args import SharedConfig, add_shared_args, parse_shared_args
106
+
107
+ # Persistent memory (graceful import for minimal installs)
108
+ try:
109
+ from .core.persistent_memory import PersistentMemory
110
+ except ImportError:
111
+ PersistentMemory = None # type: ignore
112
+
113
+ # Optional ACP plugin (graceful import — now via plugin system)
114
+ try:
115
+ from .plugins.acp.acp_plugin import ACPPlugin
116
+ except ImportError:
117
+ ACPPlugin = None # type: ignore
118
+
119
+ # Optional Soul Spec support (graceful import)
120
+ try:
121
+ from .soul import (
122
+ SoulManifest, SoulLoader, load_soul, build_system_prompt,
123
+ Environment, InteractionMode, HardwareConstraints,
124
+ )
125
+ except ImportError:
126
+ SoulManifest = None # type: ignore
127
+ SoulLoader = None # type: ignore
128
+ load_soul = None # type: ignore
129
+ build_system_prompt = None # type: ignore
130
+ Environment = None # type: ignore
131
+ InteractionMode = None # type: ignore
132
+ HardwareConstraints = None # type: ignore
133
+
134
+ __all__ = [
135
+ # Version
136
+ "__version__",
137
+ "__author__",
138
+ "__status__",
139
+ # Agent
140
+ "Agent",
141
+ "AgentMode",
142
+ "AgentState",
143
+ "TaskPlan",
144
+ # Memory
145
+ "PersistentMemory",
146
+ # Orchestrator
147
+ "Orchestrator",
148
+ "AgentCard",
149
+ # Models
150
+ "StepResult",
151
+ "AgentRun",
152
+ "Tool",
153
+ "ToolParam",
154
+ # Types
155
+ "StepResultType",
156
+ "ToolSupportLevel",
157
+ "BackendType",
158
+ # Tools
159
+ "ToolRegistry",
160
+ "make_builtin_registry",
161
+ "BUILTIN_REGISTRY",
162
+ # Backends
163
+ "BaseBackend",
164
+ "OllamaBackend",
165
+ "LlamaServerBackend",
166
+ "get_default_backend",
167
+ "get_backend",
168
+ "get_backend_choices",
169
+ # Config
170
+ "Config",
171
+ "get_config",
172
+ "OLLAMA_BASE_URL",
173
+ "BITNET_BASE_URL",
174
+ "ZAI_BASE_URL",
175
+ "OPENROUTER_BASE_URL",
176
+ "OPENROUTER_API_KEY",
177
+ "OPENROUTER_DEFAULT_MODEL",
178
+ "ACP_BASE_URL",
179
+ "ACP_USER",
180
+ "ACP_PASS",
181
+ "DEFAULT_MODEL",
182
+ "AGENTNOVA_BACKEND",
183
+ # Model Discovery
184
+ "get_models",
185
+ "get_available_models",
186
+ "pick_best_model",
187
+ "pick_models_for_benchmark",
188
+ "model_exists",
189
+ "get_client",
190
+ # Shared Args
191
+ "SharedConfig",
192
+ "add_shared_args",
193
+ "parse_shared_args",
194
+ # ACP Plugin
195
+ "ACPPlugin",
196
+ # Soul Spec
197
+ "SoulManifest",
198
+ "SoulLoader",
199
+ "load_soul",
200
+ "build_system_prompt",
201
+ "Environment",
202
+ "InteractionMode",
203
+ "HardwareConstraints",
204
+ ]
agentkthx/__main__.py ADDED
@@ -0,0 +1,12 @@
1
+ """
2
+ ⚛️ AgentKthx — CLI Entry Point
3
+ Allows running the package with: python -m agentkthx
4
+
5
+ Written by VTSTech — https://www.vts-tech.org
6
+ """
7
+
8
+ from .cli import main
9
+ import sys
10
+
11
+ if __name__ == "__main__":
12
+ sys.exit(main())