pal-code 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 (282) hide show
  1. pal/__init__.py +29 -0
  2. pal/__main__.py +3 -0
  3. pal/access_manager/__init__.py +16 -0
  4. pal/access_manager/components/__init__.py +14 -0
  5. pal/access_manager/components/access_control.py +41 -0
  6. pal/access_manager/components/base.py +39 -0
  7. pal/access_manager/components/intervention.py +31 -0
  8. pal/access_manager/components/privilege_registry.py +30 -0
  9. pal/access_manager/pipeline.py +68 -0
  10. pal/access_manager/utils/__init__.py +2 -0
  11. pal/agent_constraints/__init__.py +3 -0
  12. pal/agent_constraints/components/AGENT_OUTPUT.md +13 -0
  13. pal/agent_constraints/components/__init__.py +3 -0
  14. pal/agent_constraints/components/constraints.py +22 -0
  15. pal/agent_constraints/pipeline.py +22 -0
  16. pal/agent_constraints/utils/__init__.py +2 -0
  17. pal/agents/__init__.py +12 -0
  18. pal/agents/coding.py +14 -0
  19. pal/agents/docs.py +15 -0
  20. pal/chat/__init__.py +4 -0
  21. pal/chat/demo.py +231 -0
  22. pal/chat/providers.py +23 -0
  23. pal/chat/service.py +591 -0
  24. pal/chat/services/__init__.py +26 -0
  25. pal/chat/services/base.py +142 -0
  26. pal/chat/services/data.py +142 -0
  27. pal/chat/services/media.py +123 -0
  28. pal/chat/services/web.py +60 -0
  29. pal/chat/sessions.py +108 -0
  30. pal/chat/tools.py +446 -0
  31. pal/chat/uploads.py +81 -0
  32. pal/cli.py +502 -0
  33. pal/compression/__init__.py +12 -0
  34. pal/compression/components/__init__.py +64 -0
  35. pal/compression/components/adverbs.py +20 -0
  36. pal/compression/components/hedges.py +54 -0
  37. pal/compression/components/interjections.py +20 -0
  38. pal/compression/components/minifier.py +56 -0
  39. pal/compression/components/output_compressor.py +13 -0
  40. pal/compression/components/pleonasms.py +54 -0
  41. pal/compression/components/punctuations.py +36 -0
  42. pal/compression/components/stopwords.py +62 -0
  43. pal/compression/history.py +346 -0
  44. pal/compression/pipeline.py +58 -0
  45. pal/compression/utils/__init__.py +30 -0
  46. pal/compression/utils/negations.py +18 -0
  47. pal/compression/utils/nltk_setup.py +20 -0
  48. pal/compression/utils/pronouns.py +27 -0
  49. pal/compression/utils/proselint_setup.py +9 -0
  50. pal/compression/utils/spacy_setup.py +22 -0
  51. pal/config/default.yaml +163 -0
  52. pal/config.py +504 -0
  53. pal/context_manager/__init__.py +7 -0
  54. pal/context_manager/chat_context.py +117 -0
  55. pal/context_manager/components/__init__.py +5 -0
  56. pal/context_manager/components/assembler.py +75 -0
  57. pal/context_manager/components/context_cache.py +45 -0
  58. pal/context_manager/components/kv_bridge.py +16 -0
  59. pal/context_manager/components/pager.py +48 -0
  60. pal/context_manager/components/simple_context_manager.py +56 -0
  61. pal/context_manager/components/turns.py +88 -0
  62. pal/context_manager/pipeline.py +27 -0
  63. pal/context_manager/utils/__init__.py +18 -0
  64. pal/context_manager/utils/hashing.py +5 -0
  65. pal/context_manager/utils/relevance.py +59 -0
  66. pal/context_manager/utils/storage.py +37 -0
  67. pal/documents/__init__.py +4 -0
  68. pal/documents/components/__init__.py +0 -0
  69. pal/documents/components/chunker.py +79 -0
  70. pal/documents/components/index.py +155 -0
  71. pal/documents/utils/__init__.py +1 -0
  72. pal/errors.py +40 -0
  73. pal/input_converters/__init__.py +8 -0
  74. pal/input_converters/components/__init__.py +0 -0
  75. pal/input_converters/components/base.py +38 -0
  76. pal/input_converters/components/pandoc_converter.py +87 -0
  77. pal/input_converters/components/pdf_converter.py +46 -0
  78. pal/input_converters/components/pptx_converter.py +52 -0
  79. pal/input_converters/components/xlsx_converter.py +38 -0
  80. pal/input_converters/pipeline.py +72 -0
  81. pal/input_converters/utils/__init__.py +1 -0
  82. pal/input_converters/workspace.py +56 -0
  83. pal/input_savers/INPUT_RULES.md +2 -0
  84. pal/input_savers/__init__.py +5 -0
  85. pal/input_savers/components/__init__.py +0 -0
  86. pal/input_savers/components/base.py +40 -0
  87. pal/input_savers/components/methods.py +41 -0
  88. pal/input_savers/components/verifier.py +39 -0
  89. pal/input_savers/pipeline.py +154 -0
  90. pal/input_savers/utils/__init__.py +0 -0
  91. pal/input_savers/utils/guards.py +94 -0
  92. pal/knowledge_graph/__init__.py +10 -0
  93. pal/knowledge_graph/components/__init__.py +0 -0
  94. pal/knowledge_graph/components/base.py +50 -0
  95. pal/knowledge_graph/components/builder.py +54 -0
  96. pal/knowledge_graph/components/retriever.py +100 -0
  97. pal/knowledge_graph/components/workspace.py +116 -0
  98. pal/knowledge_graph/pipeline.py +215 -0
  99. pal/knowledge_graph/utils/__init__.py +1 -0
  100. pal/latency_tracker/__init__.py +3 -0
  101. pal/latency_tracker/pipeline.py +86 -0
  102. pal/llm_scheduler/__init__.py +11 -0
  103. pal/llm_scheduler/api.py +137 -0
  104. pal/llm_scheduler/code.py +28 -0
  105. pal/llm_scheduler/core.py +92 -0
  106. pal/llm_scheduler/local.py +215 -0
  107. pal/llm_scheduler/pipeline.py +42 -0
  108. pal/llm_scheduler/types.py +92 -0
  109. pal/llm_wrapper/__init__.py +34 -0
  110. pal/llm_wrapper/adapter.py +316 -0
  111. pal/llm_wrapper/components/__init__.py +23 -0
  112. pal/llm_wrapper/components/adapter_types.py +90 -0
  113. pal/llm_wrapper/components/base.py +195 -0
  114. pal/llm_wrapper/components/features.py +104 -0
  115. pal/llm_wrapper/components/litellm_wrapper.py +215 -0
  116. pal/llm_wrapper/components/openrouter_wrapper.py +114 -0
  117. pal/llm_wrapper/modes.py +73 -0
  118. pal/llm_wrapper/pipeline.py +61 -0
  119. pal/llm_wrapper/utils/__init__.py +4 -0
  120. pal/llm_wrapper/utils/registry.py +49 -0
  121. pal/llm_wrapper/utils/token_counting.py +10 -0
  122. pal/local_llm/__init__.py +5 -0
  123. pal/local_llm/components/__init__.py +0 -0
  124. pal/local_llm/components/huggingface_local.py +217 -0
  125. pal/local_llm/components/local_llm.py +60 -0
  126. pal/logging_setup.py +18 -0
  127. pal/memory/__init__.py +7 -0
  128. pal/memory/components/__init__.py +6 -0
  129. pal/memory/components/lru_k.py +56 -0
  130. pal/memory/components/manager.py +98 -0
  131. pal/memory/components/note.py +54 -0
  132. pal/memory/components/storage_manager.py +60 -0
  133. pal/memory/pipeline.py +122 -0
  134. pal/memory/utils/__init__.py +3 -0
  135. pal/memory/utils/keyword_overlap.py +3 -0
  136. pal/memory_tracker/__init__.py +3 -0
  137. pal/memory_tracker/components/__init__.py +0 -0
  138. pal/memory_tracker/components/process.py +56 -0
  139. pal/memory_tracker/pipeline.py +44 -0
  140. pal/metrics/__init__.py +4 -0
  141. pal/metrics/components/__init__.py +4 -0
  142. pal/metrics/components/collector.py +140 -0
  143. pal/metrics/components/exporter.py +28 -0
  144. pal/metrics/pipeline.py +49 -0
  145. pal/metrics/utils/__init__.py +2 -0
  146. pal/notes_manager/__init__.py +5 -0
  147. pal/notes_manager/components/__init__.py +0 -0
  148. pal/notes_manager/components/privacy.py +14 -0
  149. pal/notes_manager/components/recall.py +31 -0
  150. pal/notes_manager/components/tidy.py +28 -0
  151. pal/notes_manager/pipeline.py +138 -0
  152. pal/orchestrator/__init__.py +26 -0
  153. pal/orchestrator/components/__init__.py +26 -0
  154. pal/orchestrator/components/agent.py +105 -0
  155. pal/orchestrator/components/cgroup_manager.py +209 -0
  156. pal/orchestrator/components/context_interrupt.py +220 -0
  157. pal/orchestrator/components/limits.py +9 -0
  158. pal/orchestrator/components/scheduler.py +69 -0
  159. pal/orchestrator/components/syscall_scheduler.py +200 -0
  160. pal/orchestrator/pipeline.py +228 -0
  161. pal/orchestrator/utils/__init__.py +4 -0
  162. pal/orchestrator/utils/device.py +164 -0
  163. pal/orchestrator/utils/protocol.py +32 -0
  164. pal/os_kernel/__init__.py +5 -0
  165. pal/os_kernel/filesystem.py +80 -0
  166. pal/os_kernel/network.py +146 -0
  167. pal/os_kernel/pipeline.py +175 -0
  168. pal/os_kernel/sysinfo.py +36 -0
  169. pal/paths.py +59 -0
  170. pal/pipeline.py +177 -0
  171. pal/py.typed +0 -0
  172. pal/redact.py +19 -0
  173. pal/sdk/__init__.py +33 -0
  174. pal/sdk/adapters.py +43 -0
  175. pal/sdk/agent.py +99 -0
  176. pal/sdk/components/__init__.py +14 -0
  177. pal/sdk/components/autogen_adapter.py +65 -0
  178. pal/sdk/components/autogen_client.py +98 -0
  179. pal/sdk/components/framework_adapter_base.py +69 -0
  180. pal/sdk/components/metagpt_adapter.py +46 -0
  181. pal/sdk/components/open_interpreter_adapter.py +47 -0
  182. pal/sdk/components/tool_catalog.py +44 -0
  183. pal/sdk/os_api.py +84 -0
  184. pal/sdk/patterns.py +129 -0
  185. pal/sdk/pipeline.py +240 -0
  186. pal/sdk/queries.py +68 -0
  187. pal/sdk/savers.py +88 -0
  188. pal/sdk/utils/__init__.py +2 -0
  189. pal/storage_manager/__init__.py +17 -0
  190. pal/storage_manager/components/__init__.py +19 -0
  191. pal/storage_manager/components/base.py +50 -0
  192. pal/storage_manager/components/local_file_backend.py +84 -0
  193. pal/storage_manager/components/storage_queue.py +91 -0
  194. pal/storage_manager/components/vector_store_backend.py +122 -0
  195. pal/storage_manager/pipeline.py +153 -0
  196. pal/storage_manager/utils/__init__.py +4 -0
  197. pal/storage_manager/utils/memory_adapter.py +60 -0
  198. pal/storage_manager/utils/sdk.py +93 -0
  199. pal/studio/__init__.py +0 -0
  200. pal/studio/builder.py +166 -0
  201. pal/studio/catalog.py +90 -0
  202. pal/studio/checks.py +129 -0
  203. pal/studio/clients.py +6 -0
  204. pal/studio/editor.py +137 -0
  205. pal/studio/files.py +6 -0
  206. pal/studio/models.py +6 -0
  207. pal/studio/plan.py +149 -0
  208. pal/studio/planner.py +205 -0
  209. pal/studio/policy.py +69 -0
  210. pal/studio/routes.py +254 -0
  211. pal/studio/runs.py +210 -0
  212. pal/task_router/__init__.py +11 -0
  213. pal/task_router/components/__init__.py +0 -0
  214. pal/task_router/components/answerer.py +37 -0
  215. pal/task_router/components/base.py +34 -0
  216. pal/task_router/components/classifier.py +40 -0
  217. pal/task_router/components/gates.py +23 -0
  218. pal/task_router/pipeline.py +61 -0
  219. pal/task_router/utils/__init__.py +1 -0
  220. pal/terminal/__init__.py +1 -0
  221. pal/terminal/backend.py +141 -0
  222. pal/terminal/bench.py +173 -0
  223. pal/terminal/cli.py +826 -0
  224. pal/terminal/clients.py +170 -0
  225. pal/terminal/commands.py +401 -0
  226. pal/terminal/decide.py +242 -0
  227. pal/terminal/files.py +55 -0
  228. pal/terminal/flow_cli.py +439 -0
  229. pal/terminal/hardware.py +199 -0
  230. pal/terminal/history.py +88 -0
  231. pal/terminal/keys.py +83 -0
  232. pal/terminal/local_models.py +261 -0
  233. pal/terminal/logo.py +117 -0
  234. pal/terminal/models.py +99 -0
  235. pal/terminal/policy.py +54 -0
  236. pal/terminal/project.py +413 -0
  237. pal/terminal/review.py +65 -0
  238. pal/terminal/security.py +239 -0
  239. pal/terminal/session.py +503 -0
  240. pal/terminal/setup.py +354 -0
  241. pal/terminal/syntax.py +98 -0
  242. pal/terminal/theme.py +37 -0
  243. pal/terminal/ui.py +647 -0
  244. pal/terminal/voice.py +137 -0
  245. pal/terminal/workflow.py +624 -0
  246. pal/token_tracker/__init__.py +3 -0
  247. pal/token_tracker/pipeline.py +54 -0
  248. pal/tokens.py +21 -0
  249. pal/tool_catalog.py +107 -0
  250. pal/tool_manager/__init__.py +17 -0
  251. pal/tool_manager/builtin.py +82 -0
  252. pal/tool_manager/components/__init__.py +19 -0
  253. pal/tool_manager/components/base.py +53 -0
  254. pal/tool_manager/components/conflict_resolver.py +27 -0
  255. pal/tool_manager/components/param_validator.py +41 -0
  256. pal/tool_manager/components/tool_call_queue.py +111 -0
  257. pal/tool_manager/components/tool_registry.py +60 -0
  258. pal/tool_manager/pipeline.py +80 -0
  259. pal/tool_manager/utils/__init__.py +3 -0
  260. pal/web/__init__.py +3 -0
  261. pal/web/app.py +276 -0
  262. pal/web/static/editor.js +219 -0
  263. pal/web/static/fonts/LICENSE-Inter.txt +3 -0
  264. pal/web/static/fonts/inter-400.woff2 +0 -0
  265. pal/web/static/fonts/inter-500.woff2 +0 -0
  266. pal/web/static/fonts/inter-600.woff2 +0 -0
  267. pal/web/static/fonts/inter-700.woff2 +0 -0
  268. pal/web/static/inter.css +5 -0
  269. pal/web/static/pal-logo-256.png +0 -0
  270. pal/web/static/pal-logo-32.png +0 -0
  271. pal/web/static/pal-logo-64.png +0 -0
  272. pal/web/static/studio.css +306 -0
  273. pal/web/static/studio.js +533 -0
  274. pal/web/static/voice.js +76 -0
  275. pal/web/templates/index.html +368 -0
  276. pal/web/templates/studio.html +120 -0
  277. pal_code-0.1.0.dist-info/METADATA +379 -0
  278. pal_code-0.1.0.dist-info/RECORD +282 -0
  279. pal_code-0.1.0.dist-info/WHEEL +5 -0
  280. pal_code-0.1.0.dist-info/entry_points.txt +2 -0
  281. pal_code-0.1.0.dist-info/licenses/LICENSE +21 -0
  282. pal_code-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,20 @@
1
+ from __future__ import annotations
2
+
3
+ import nltk
4
+
5
+
6
+ class NltkSetup:
7
+ REQUIRED_PACKAGES: tuple[str, ...] = (
8
+ "punkt",
9
+ "punkt_tab",
10
+ "averaged_perceptron_tagger",
11
+ "averaged_perceptron_tagger_eng",
12
+ "stopwords",
13
+ )
14
+
15
+ def _download_package(self, package: str) -> None:
16
+ nltk.download(package, quiet=True)
17
+
18
+ def download_all(self) -> None:
19
+ for package in self.REQUIRED_PACKAGES:
20
+ self._download_package(package)
@@ -0,0 +1,27 @@
1
+ from __future__ import annotations
2
+
3
+
4
+ class Pronouns:
5
+ TAGS: set[str] = {"PRP", "PRP$", "WP", "WP$"}
6
+
7
+ WORDS: set[str] = {
8
+ "i", "me", "my", "mine", "myself",
9
+ "you", "your", "yours", "yourself", "yourselves",
10
+ "he", "him", "his", "himself",
11
+ "she", "her", "hers", "herself",
12
+ "it", "its", "itself",
13
+ "we", "us", "our", "ours", "ourselves",
14
+ "they", "them", "their", "theirs", "themselves",
15
+ "who", "whom", "whose", "which", "that",
16
+ }
17
+
18
+ def _matches_tag(self, tag: str | None) -> bool:
19
+ return tag is not None and tag in self.TAGS
20
+
21
+ def _matches_word(self, word: str) -> bool:
22
+ return word.lower() in self.WORDS
23
+
24
+ def is_pronoun(self, word: str, tag: str | None = None) -> bool:
25
+ if self._matches_tag(tag):
26
+ return True
27
+ return self._matches_word(word)
@@ -0,0 +1,9 @@
1
+ from __future__ import annotations
2
+
3
+ from proselint.checks import __register__
4
+ from proselint.registry import CheckRegistry
5
+
6
+
7
+ class ProselintSetup:
8
+ def register_checks(self) -> None:
9
+ CheckRegistry().register_many(__register__)
@@ -0,0 +1,22 @@
1
+ from __future__ import annotations
2
+
3
+ import spacy
4
+ from spacy.cli import download
5
+
6
+
7
+ class SpacySetup:
8
+ MODEL: str = "en_core_web_sm"
9
+
10
+ def _is_model_available(self) -> bool:
11
+ return spacy.util.is_package(self.MODEL)
12
+
13
+ def _download_model(self) -> None:
14
+ download(self.MODEL)
15
+
16
+ def ensure_model(self) -> None:
17
+ if not self._is_model_available():
18
+ self._download_model()
19
+
20
+ def load_model(self):
21
+ self.ensure_model()
22
+ return spacy.load(self.MODEL)
@@ -0,0 +1,163 @@
1
+ # Pal defaults. Override any key with your own file (pal serve --config my.yaml, or the
2
+ # PAL_CONFIG env var) or with env vars: PAL__SERVER__PORT=8080, PAL__MEMORY__ENABLED=false.
3
+
4
+ # Local LLM: never shown to the user as a chat model. It routes tasks, applies the input savers and
5
+ # verifies them, and answers easy tasks itself.
6
+ local_llm:
7
+ enabled: true # false on a computer without a GPU: no local model; routing, input trimming and checking are off
8
+ backend: ollama
9
+ model: llama3
10
+ host: http://localhost:11434
11
+
12
+ # Optional separate model for the verification step. null = reuse local_llm.
13
+ verifier_llm: null
14
+
15
+ # "rules": one local-LLM pass driven by input_rules. "steps": the five methods below, one at a time.
16
+ input_mode: rules
17
+ input_rules: input_savers/INPUT_RULES.md
18
+ input_methods:
19
+ - remove_articles
20
+ - remove_punctuation
21
+ - remove_fillers
22
+ - abbreviate
23
+ - collapse_whitespace
24
+
25
+ # Output saver: sent to the API model in the system prompt on every request.
26
+ output_config: agent_constraints/components/AGENT_OUTPUT.md
27
+ base_system_prompt: "You are a helpful assistant."
28
+
29
+ # heuristic = estimate tokens locally (no network). provider = ask the model's tokenizer endpoint:
30
+ # exact, but adds a network round trip for every count.
31
+ token_counter: heuristic
32
+
33
+ # Where memory, documents and indexed projects live. null = ~/.pal (or PAL_HOME).
34
+ storage_dir: null
35
+
36
+ # Easy tasks are answered by the local LLM itself. Attachments, code and long text always go to the API.
37
+ task_routing:
38
+ enabled: true
39
+ default: auto # auto | local | api
40
+ max_local_chars: 400
41
+ max_local_lines: 6
42
+ history_messages: 6
43
+
44
+ # Attach a zip of source code: indexed once, locally (graphify, AST only). Each request then carries
45
+ # only the graph excerpts relevant to the question.
46
+ knowledge_graph:
47
+ enabled: true
48
+ dir: null
49
+ budget_tokens: 1500
50
+ max_slice_lines: 40
51
+ min_code_file_chars: 8000
52
+ max_zip_files: 3000
53
+ max_zip_mb: 50
54
+
55
+ # Context paging: the last hot_turns turns are always sent; older turns come back only if relevant.
56
+ context:
57
+ enabled: true
58
+ hot_turns: 6
59
+ recall_turns: 2
60
+ recall_threshold: 0.35
61
+ max_history_tokens: 6000
62
+
63
+ # Cross-session memory: your messages are stored on this machine and relevant ones from earlier
64
+ # sessions are added to a request. Turn off to store nothing.
65
+ memory:
66
+ enabled: true
67
+ dir: null
68
+ profile: default
69
+ recall_notes: 3
70
+ min_score: 0.3
71
+ budget_tokens: 300
72
+ min_chars: 25
73
+ block_limit: 200
74
+
75
+ # The Studio (a bot plans a product and builds it). Ollama's own default context window is small and it silently cuts a longer prompt, so these
76
+ # are sent with every local model call. A bigger window needs more memory.
77
+ studio:
78
+ num_ctx: 16384
79
+ planner_num_ctx: 8192
80
+ max_runs: 6
81
+
82
+ # Attached documents (PDF, Word, ...) are indexed once. Small ones are sent in full on the upload
83
+ # turn; big ones as a preview plus an outline. Later turns get only the relevant chunks.
84
+ documents:
85
+ enabled: true
86
+ inline_max_tokens: 2500
87
+ preview_tokens: 800
88
+ chunk_tokens: 350
89
+ retrieve_chunks: 3
90
+ budget_tokens: 1200
91
+ min_score: 0.15
92
+ max_file_chars: 500000 # bigger attachments are rejected (after conversion to markdown)
93
+
94
+ # Tools the API model may call (calculator, document and source lookup). Read-only.
95
+ tools:
96
+ network: false # allow wikipedia and arxiv lookups (the query text is sent to those sites)
97
+ # Third-party service tools from the AIOS paper. Off by default: your query leaves this machine, most need a key, some cost money.
98
+ # Names: google_search (through SerpApi: SERPAPI_API_KEY), wolfram_alpha (WOLFRAM_APP_ID), currency_convert and moon_phase (no key),
99
+ # words_api (RAPIDAPI_KEY), image_caption, visual_question_answering, text_to_image, text_to_audio, speech_to_text (HF_TOKEN).
100
+ # Or: [all]. See docs/TOOLS.md.
101
+ services: []
102
+ hf_models: {} # e.g. {text_to_image: "owner/model"}: which Hugging Face model a media tool uses
103
+ rapidapi_hosts: {} # e.g. {words_api: "your-listing.p.rapidapi.com"}: if your RapidAPI subscription shows another host
104
+ save_files: true # let an agent that has save_file write new files to its workspace
105
+ enabled: true
106
+ max_rounds: 3
107
+ max_result_tokens: 800
108
+ direct_answers: true # pure arithmetic and "what time is it" are answered with no model call
109
+
110
+ # Agent application layer: coding and documentation agents. Each reads its own key from the environment
111
+ # (GEMINI_API_KEY_CODING, GEMINI_API_KEY_DOCS, or a shared GEMINI_API_KEY). All token savers still apply.
112
+ agents:
113
+ enabled: true
114
+ model: gemini-3.5-flash
115
+
116
+ # Scheduling. API model: strictly first come, first served, one line per API key (with one key, chat and every agent share
117
+ # one line). Local model: preemptive priority: agent preparation first, then chat, then other (background) work; first
118
+ # come first served inside each class. File conversion and code-graph building run in code, a few at a time.
119
+ scheduler:
120
+ enabled: true
121
+ local_max_pauses: 2 # a local job is paused at most this often, then it runs to the end
122
+ other_stale_seconds: 600 # a background job that waited this long is dropped
123
+ code_workers: 2
124
+ max_queue: 100
125
+ api_min_interval: # seconds between API call starts, per provider (free tiers allow few per minute)
126
+ gemini: 4.0
127
+ api_retry_429: 2 # on a rate-limit error: wait, then retry this many times
128
+ api_backoff_seconds: 5.0
129
+ free_model_interval: 3.0 # seconds between calls to an OpenRouter ":free" model
130
+
131
+ # Fallback: if your own provider is rate-limited or down, answer with a second model instead. Needs the fallback provider's key
132
+ # in the environment (OPENROUTER_API_KEY) and a model name; leave model empty to keep it off.
133
+ fallback:
134
+ enabled: false
135
+ provider: openrouter
136
+ model: "" # e.g. an OpenRouter model whose name ends in :free (check openrouter.ai/models)
137
+ for_agents: true
138
+
139
+ # Non-LLM queries (file operations, network requests, system facts) go to the OS kernel (Ubuntu/Linux), never to a
140
+ # model. Files stay inside a per-agent workspace; private network addresses are blocked.
141
+ os_kernel:
142
+ enabled: true
143
+ workspace_dir: null # null = ~/.pal/workspaces
144
+ max_read_bytes: 1000000
145
+ max_write_bytes: 5000000
146
+ max_binary_bytes: 20000000 # largest image or audio file, uploaded or downloaded
147
+ allow_private_network: false
148
+ net_timeout_seconds: 10.0
149
+ net_max_bytes: 1000000
150
+ allowed_hosts: [] # empty = any public host
151
+
152
+ metrics:
153
+ enabled: true
154
+ max_records: 1000
155
+
156
+ server:
157
+ host: 127.0.0.1 # keep on localhost unless you put authentication in front
158
+ port: 5000
159
+ threads: 8
160
+ max_upload_mb: 20
161
+ max_sessions: 200
162
+ session_ttl_minutes: 240
163
+ log_level: INFO