agentpool 2.1.9__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.

Potentially problematic release.


This version of agentpool might be problematic. Click here for more details.

Files changed (474) hide show
  1. acp/README.md +64 -0
  2. acp/__init__.py +172 -0
  3. acp/__main__.py +10 -0
  4. acp/acp_requests.py +285 -0
  5. acp/agent/__init__.py +6 -0
  6. acp/agent/connection.py +256 -0
  7. acp/agent/implementations/__init__.py +6 -0
  8. acp/agent/implementations/debug_server/__init__.py +1 -0
  9. acp/agent/implementations/debug_server/cli.py +79 -0
  10. acp/agent/implementations/debug_server/debug.html +234 -0
  11. acp/agent/implementations/debug_server/debug_server.py +496 -0
  12. acp/agent/implementations/testing.py +91 -0
  13. acp/agent/protocol.py +65 -0
  14. acp/bridge/README.md +162 -0
  15. acp/bridge/__init__.py +6 -0
  16. acp/bridge/__main__.py +91 -0
  17. acp/bridge/bridge.py +246 -0
  18. acp/bridge/py.typed +0 -0
  19. acp/bridge/settings.py +15 -0
  20. acp/client/__init__.py +7 -0
  21. acp/client/connection.py +251 -0
  22. acp/client/implementations/__init__.py +7 -0
  23. acp/client/implementations/default_client.py +185 -0
  24. acp/client/implementations/headless_client.py +266 -0
  25. acp/client/implementations/noop_client.py +110 -0
  26. acp/client/protocol.py +61 -0
  27. acp/connection.py +280 -0
  28. acp/exceptions.py +46 -0
  29. acp/filesystem.py +524 -0
  30. acp/notifications.py +832 -0
  31. acp/py.typed +0 -0
  32. acp/schema/__init__.py +265 -0
  33. acp/schema/agent_plan.py +30 -0
  34. acp/schema/agent_requests.py +126 -0
  35. acp/schema/agent_responses.py +256 -0
  36. acp/schema/base.py +39 -0
  37. acp/schema/capabilities.py +230 -0
  38. acp/schema/client_requests.py +247 -0
  39. acp/schema/client_responses.py +96 -0
  40. acp/schema/common.py +81 -0
  41. acp/schema/content_blocks.py +188 -0
  42. acp/schema/mcp.py +82 -0
  43. acp/schema/messages.py +171 -0
  44. acp/schema/notifications.py +82 -0
  45. acp/schema/protocol_stuff.md +3 -0
  46. acp/schema/session_state.py +160 -0
  47. acp/schema/session_updates.py +419 -0
  48. acp/schema/slash_commands.py +51 -0
  49. acp/schema/terminal.py +15 -0
  50. acp/schema/tool_call.py +347 -0
  51. acp/stdio.py +250 -0
  52. acp/task/__init__.py +53 -0
  53. acp/task/debug.py +197 -0
  54. acp/task/dispatcher.py +93 -0
  55. acp/task/queue.py +69 -0
  56. acp/task/sender.py +82 -0
  57. acp/task/state.py +87 -0
  58. acp/task/supervisor.py +93 -0
  59. acp/terminal_handle.py +30 -0
  60. acp/tool_call_reporter.py +199 -0
  61. acp/tool_call_state.py +178 -0
  62. acp/transports.py +104 -0
  63. acp/utils.py +240 -0
  64. agentpool/__init__.py +63 -0
  65. agentpool/__main__.py +7 -0
  66. agentpool/agents/__init__.py +30 -0
  67. agentpool/agents/acp_agent/__init__.py +5 -0
  68. agentpool/agents/acp_agent/acp_agent.py +837 -0
  69. agentpool/agents/acp_agent/acp_converters.py +294 -0
  70. agentpool/agents/acp_agent/client_handler.py +317 -0
  71. agentpool/agents/acp_agent/session_state.py +44 -0
  72. agentpool/agents/agent.py +1264 -0
  73. agentpool/agents/agui_agent/__init__.py +19 -0
  74. agentpool/agents/agui_agent/agui_agent.py +677 -0
  75. agentpool/agents/agui_agent/agui_converters.py +423 -0
  76. agentpool/agents/agui_agent/chunk_transformer.py +204 -0
  77. agentpool/agents/agui_agent/event_types.py +83 -0
  78. agentpool/agents/agui_agent/helpers.py +192 -0
  79. agentpool/agents/architect.py +71 -0
  80. agentpool/agents/base_agent.py +177 -0
  81. agentpool/agents/claude_code_agent/__init__.py +11 -0
  82. agentpool/agents/claude_code_agent/claude_code_agent.py +1021 -0
  83. agentpool/agents/claude_code_agent/converters.py +243 -0
  84. agentpool/agents/context.py +105 -0
  85. agentpool/agents/events/__init__.py +61 -0
  86. agentpool/agents/events/builtin_handlers.py +129 -0
  87. agentpool/agents/events/event_emitter.py +320 -0
  88. agentpool/agents/events/events.py +561 -0
  89. agentpool/agents/events/tts_handlers.py +186 -0
  90. agentpool/agents/interactions.py +419 -0
  91. agentpool/agents/slashed_agent.py +244 -0
  92. agentpool/agents/sys_prompts.py +178 -0
  93. agentpool/agents/tool_wrapping.py +184 -0
  94. agentpool/base_provider.py +28 -0
  95. agentpool/common_types.py +226 -0
  96. agentpool/config_resources/__init__.py +16 -0
  97. agentpool/config_resources/acp_assistant.yml +24 -0
  98. agentpool/config_resources/agents.yml +109 -0
  99. agentpool/config_resources/agents_template.yml +18 -0
  100. agentpool/config_resources/agui_test.yml +18 -0
  101. agentpool/config_resources/claude_code_agent.yml +16 -0
  102. agentpool/config_resources/claude_style_subagent.md +30 -0
  103. agentpool/config_resources/external_acp_agents.yml +77 -0
  104. agentpool/config_resources/opencode_style_subagent.md +19 -0
  105. agentpool/config_resources/tts_test_agents.yml +78 -0
  106. agentpool/delegation/__init__.py +8 -0
  107. agentpool/delegation/base_team.py +504 -0
  108. agentpool/delegation/message_flow_tracker.py +39 -0
  109. agentpool/delegation/pool.py +1129 -0
  110. agentpool/delegation/team.py +325 -0
  111. agentpool/delegation/teamrun.py +343 -0
  112. agentpool/docs/__init__.py +5 -0
  113. agentpool/docs/gen_examples.py +42 -0
  114. agentpool/docs/utils.py +370 -0
  115. agentpool/functional/__init__.py +20 -0
  116. agentpool/functional/py.typed +0 -0
  117. agentpool/functional/run.py +80 -0
  118. agentpool/functional/structure.py +136 -0
  119. agentpool/hooks/__init__.py +20 -0
  120. agentpool/hooks/agent_hooks.py +247 -0
  121. agentpool/hooks/base.py +119 -0
  122. agentpool/hooks/callable.py +140 -0
  123. agentpool/hooks/command.py +180 -0
  124. agentpool/hooks/prompt.py +122 -0
  125. agentpool/jinja_filters.py +132 -0
  126. agentpool/log.py +224 -0
  127. agentpool/mcp_server/__init__.py +17 -0
  128. agentpool/mcp_server/client.py +429 -0
  129. agentpool/mcp_server/constants.py +32 -0
  130. agentpool/mcp_server/conversions.py +172 -0
  131. agentpool/mcp_server/helpers.py +47 -0
  132. agentpool/mcp_server/manager.py +232 -0
  133. agentpool/mcp_server/message_handler.py +164 -0
  134. agentpool/mcp_server/registries/__init__.py +1 -0
  135. agentpool/mcp_server/registries/official_registry_client.py +345 -0
  136. agentpool/mcp_server/registries/pulsemcp_client.py +88 -0
  137. agentpool/mcp_server/tool_bridge.py +548 -0
  138. agentpool/messaging/__init__.py +58 -0
  139. agentpool/messaging/compaction.py +928 -0
  140. agentpool/messaging/connection_manager.py +319 -0
  141. agentpool/messaging/context.py +66 -0
  142. agentpool/messaging/event_manager.py +426 -0
  143. agentpool/messaging/events.py +39 -0
  144. agentpool/messaging/message_container.py +209 -0
  145. agentpool/messaging/message_history.py +491 -0
  146. agentpool/messaging/messagenode.py +377 -0
  147. agentpool/messaging/messages.py +655 -0
  148. agentpool/messaging/processing.py +76 -0
  149. agentpool/mime_utils.py +95 -0
  150. agentpool/models/__init__.py +21 -0
  151. agentpool/models/acp_agents/__init__.py +22 -0
  152. agentpool/models/acp_agents/base.py +308 -0
  153. agentpool/models/acp_agents/mcp_capable.py +790 -0
  154. agentpool/models/acp_agents/non_mcp.py +842 -0
  155. agentpool/models/agents.py +450 -0
  156. agentpool/models/agui_agents.py +89 -0
  157. agentpool/models/claude_code_agents.py +238 -0
  158. agentpool/models/file_agents.py +116 -0
  159. agentpool/models/file_parsing.py +367 -0
  160. agentpool/models/manifest.py +658 -0
  161. agentpool/observability/__init__.py +9 -0
  162. agentpool/observability/observability_registry.py +97 -0
  163. agentpool/prompts/__init__.py +1 -0
  164. agentpool/prompts/base.py +27 -0
  165. agentpool/prompts/builtin_provider.py +75 -0
  166. agentpool/prompts/conversion_manager.py +95 -0
  167. agentpool/prompts/convert.py +96 -0
  168. agentpool/prompts/manager.py +204 -0
  169. agentpool/prompts/parts/zed.md +33 -0
  170. agentpool/prompts/prompts.py +581 -0
  171. agentpool/py.typed +0 -0
  172. agentpool/queries/tree-sitter-language-pack/README.md +7 -0
  173. agentpool/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
  174. agentpool/queries/tree-sitter-language-pack/c-tags.scm +9 -0
  175. agentpool/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
  176. agentpool/queries/tree-sitter-language-pack/clojure-tags.scm +7 -0
  177. agentpool/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
  178. agentpool/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
  179. agentpool/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
  180. agentpool/queries/tree-sitter-language-pack/d-tags.scm +26 -0
  181. agentpool/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
  182. agentpool/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
  183. agentpool/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
  184. agentpool/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
  185. agentpool/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
  186. agentpool/queries/tree-sitter-language-pack/go-tags.scm +42 -0
  187. agentpool/queries/tree-sitter-language-pack/java-tags.scm +20 -0
  188. agentpool/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
  189. agentpool/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
  190. agentpool/queries/tree-sitter-language-pack/matlab-tags.scm +10 -0
  191. agentpool/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
  192. agentpool/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
  193. agentpool/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
  194. agentpool/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
  195. agentpool/queries/tree-sitter-language-pack/python-tags.scm +14 -0
  196. agentpool/queries/tree-sitter-language-pack/r-tags.scm +21 -0
  197. agentpool/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
  198. agentpool/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
  199. agentpool/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
  200. agentpool/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
  201. agentpool/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
  202. agentpool/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
  203. agentpool/queries/tree-sitter-languages/README.md +24 -0
  204. agentpool/queries/tree-sitter-languages/c-tags.scm +9 -0
  205. agentpool/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
  206. agentpool/queries/tree-sitter-languages/cpp-tags.scm +15 -0
  207. agentpool/queries/tree-sitter-languages/dart-tags.scm +91 -0
  208. agentpool/queries/tree-sitter-languages/elisp-tags.scm +8 -0
  209. agentpool/queries/tree-sitter-languages/elixir-tags.scm +54 -0
  210. agentpool/queries/tree-sitter-languages/elm-tags.scm +19 -0
  211. agentpool/queries/tree-sitter-languages/fortran-tags.scm +15 -0
  212. agentpool/queries/tree-sitter-languages/go-tags.scm +30 -0
  213. agentpool/queries/tree-sitter-languages/haskell-tags.scm +3 -0
  214. agentpool/queries/tree-sitter-languages/hcl-tags.scm +77 -0
  215. agentpool/queries/tree-sitter-languages/java-tags.scm +20 -0
  216. agentpool/queries/tree-sitter-languages/javascript-tags.scm +88 -0
  217. agentpool/queries/tree-sitter-languages/julia-tags.scm +60 -0
  218. agentpool/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
  219. agentpool/queries/tree-sitter-languages/matlab-tags.scm +10 -0
  220. agentpool/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
  221. agentpool/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
  222. agentpool/queries/tree-sitter-languages/php-tags.scm +26 -0
  223. agentpool/queries/tree-sitter-languages/python-tags.scm +12 -0
  224. agentpool/queries/tree-sitter-languages/ql-tags.scm +26 -0
  225. agentpool/queries/tree-sitter-languages/ruby-tags.scm +64 -0
  226. agentpool/queries/tree-sitter-languages/rust-tags.scm +60 -0
  227. agentpool/queries/tree-sitter-languages/scala-tags.scm +65 -0
  228. agentpool/queries/tree-sitter-languages/typescript-tags.scm +41 -0
  229. agentpool/queries/tree-sitter-languages/zig-tags.scm +3 -0
  230. agentpool/repomap.py +1231 -0
  231. agentpool/resource_providers/__init__.py +17 -0
  232. agentpool/resource_providers/aggregating.py +54 -0
  233. agentpool/resource_providers/base.py +172 -0
  234. agentpool/resource_providers/codemode/__init__.py +9 -0
  235. agentpool/resource_providers/codemode/code_executor.py +215 -0
  236. agentpool/resource_providers/codemode/default_prompt.py +19 -0
  237. agentpool/resource_providers/codemode/helpers.py +83 -0
  238. agentpool/resource_providers/codemode/progress_executor.py +212 -0
  239. agentpool/resource_providers/codemode/provider.py +150 -0
  240. agentpool/resource_providers/codemode/remote_mcp_execution.py +143 -0
  241. agentpool/resource_providers/codemode/remote_provider.py +171 -0
  242. agentpool/resource_providers/filtering.py +42 -0
  243. agentpool/resource_providers/mcp_provider.py +246 -0
  244. agentpool/resource_providers/plan_provider.py +196 -0
  245. agentpool/resource_providers/pool.py +69 -0
  246. agentpool/resource_providers/static.py +289 -0
  247. agentpool/running/__init__.py +20 -0
  248. agentpool/running/decorators.py +56 -0
  249. agentpool/running/discovery.py +101 -0
  250. agentpool/running/executor.py +284 -0
  251. agentpool/running/injection.py +111 -0
  252. agentpool/running/py.typed +0 -0
  253. agentpool/running/run_nodes.py +87 -0
  254. agentpool/server.py +122 -0
  255. agentpool/sessions/__init__.py +13 -0
  256. agentpool/sessions/manager.py +302 -0
  257. agentpool/sessions/models.py +71 -0
  258. agentpool/sessions/session.py +239 -0
  259. agentpool/sessions/store.py +163 -0
  260. agentpool/skills/__init__.py +5 -0
  261. agentpool/skills/manager.py +120 -0
  262. agentpool/skills/registry.py +210 -0
  263. agentpool/skills/skill.py +36 -0
  264. agentpool/storage/__init__.py +17 -0
  265. agentpool/storage/manager.py +419 -0
  266. agentpool/storage/serialization.py +136 -0
  267. agentpool/talk/__init__.py +13 -0
  268. agentpool/talk/registry.py +128 -0
  269. agentpool/talk/stats.py +159 -0
  270. agentpool/talk/talk.py +604 -0
  271. agentpool/tasks/__init__.py +20 -0
  272. agentpool/tasks/exceptions.py +25 -0
  273. agentpool/tasks/registry.py +33 -0
  274. agentpool/testing.py +129 -0
  275. agentpool/text_templates/__init__.py +39 -0
  276. agentpool/text_templates/system_prompt.jinja +30 -0
  277. agentpool/text_templates/tool_call_default.jinja +13 -0
  278. agentpool/text_templates/tool_call_markdown.jinja +25 -0
  279. agentpool/text_templates/tool_call_simple.jinja +5 -0
  280. agentpool/tools/__init__.py +16 -0
  281. agentpool/tools/base.py +269 -0
  282. agentpool/tools/exceptions.py +9 -0
  283. agentpool/tools/manager.py +255 -0
  284. agentpool/tools/tool_call_info.py +87 -0
  285. agentpool/ui/__init__.py +2 -0
  286. agentpool/ui/base.py +89 -0
  287. agentpool/ui/mock_provider.py +81 -0
  288. agentpool/ui/stdlib_provider.py +150 -0
  289. agentpool/utils/__init__.py +44 -0
  290. agentpool/utils/baseregistry.py +185 -0
  291. agentpool/utils/count_tokens.py +62 -0
  292. agentpool/utils/dag.py +184 -0
  293. agentpool/utils/importing.py +206 -0
  294. agentpool/utils/inspection.py +334 -0
  295. agentpool/utils/model_capabilities.py +25 -0
  296. agentpool/utils/network.py +28 -0
  297. agentpool/utils/now.py +22 -0
  298. agentpool/utils/parse_time.py +87 -0
  299. agentpool/utils/result_utils.py +35 -0
  300. agentpool/utils/signatures.py +305 -0
  301. agentpool/utils/streams.py +112 -0
  302. agentpool/utils/tasks.py +186 -0
  303. agentpool/vfs_registry.py +250 -0
  304. agentpool-2.1.9.dist-info/METADATA +336 -0
  305. agentpool-2.1.9.dist-info/RECORD +474 -0
  306. agentpool-2.1.9.dist-info/WHEEL +4 -0
  307. agentpool-2.1.9.dist-info/entry_points.txt +14 -0
  308. agentpool-2.1.9.dist-info/licenses/LICENSE +22 -0
  309. agentpool_cli/__init__.py +34 -0
  310. agentpool_cli/__main__.py +66 -0
  311. agentpool_cli/agent.py +175 -0
  312. agentpool_cli/cli_types.py +23 -0
  313. agentpool_cli/common.py +163 -0
  314. agentpool_cli/create.py +175 -0
  315. agentpool_cli/history.py +217 -0
  316. agentpool_cli/log.py +78 -0
  317. agentpool_cli/py.typed +0 -0
  318. agentpool_cli/run.py +84 -0
  319. agentpool_cli/serve_acp.py +177 -0
  320. agentpool_cli/serve_api.py +69 -0
  321. agentpool_cli/serve_mcp.py +74 -0
  322. agentpool_cli/serve_vercel.py +233 -0
  323. agentpool_cli/store.py +171 -0
  324. agentpool_cli/task.py +84 -0
  325. agentpool_cli/utils.py +104 -0
  326. agentpool_cli/watch.py +54 -0
  327. agentpool_commands/__init__.py +180 -0
  328. agentpool_commands/agents.py +199 -0
  329. agentpool_commands/base.py +45 -0
  330. agentpool_commands/commands.py +58 -0
  331. agentpool_commands/completers.py +110 -0
  332. agentpool_commands/connections.py +175 -0
  333. agentpool_commands/markdown_utils.py +31 -0
  334. agentpool_commands/models.py +62 -0
  335. agentpool_commands/prompts.py +78 -0
  336. agentpool_commands/py.typed +0 -0
  337. agentpool_commands/read.py +77 -0
  338. agentpool_commands/resources.py +210 -0
  339. agentpool_commands/session.py +48 -0
  340. agentpool_commands/tools.py +269 -0
  341. agentpool_commands/utils.py +189 -0
  342. agentpool_commands/workers.py +163 -0
  343. agentpool_config/__init__.py +53 -0
  344. agentpool_config/builtin_tools.py +265 -0
  345. agentpool_config/commands.py +237 -0
  346. agentpool_config/conditions.py +301 -0
  347. agentpool_config/converters.py +30 -0
  348. agentpool_config/durable.py +331 -0
  349. agentpool_config/event_handlers.py +600 -0
  350. agentpool_config/events.py +153 -0
  351. agentpool_config/forward_targets.py +251 -0
  352. agentpool_config/hook_conditions.py +331 -0
  353. agentpool_config/hooks.py +241 -0
  354. agentpool_config/jinja.py +206 -0
  355. agentpool_config/knowledge.py +41 -0
  356. agentpool_config/loaders.py +350 -0
  357. agentpool_config/mcp_server.py +243 -0
  358. agentpool_config/nodes.py +202 -0
  359. agentpool_config/observability.py +191 -0
  360. agentpool_config/output_types.py +55 -0
  361. agentpool_config/pool_server.py +267 -0
  362. agentpool_config/prompt_hubs.py +105 -0
  363. agentpool_config/prompts.py +185 -0
  364. agentpool_config/py.typed +0 -0
  365. agentpool_config/resources.py +33 -0
  366. agentpool_config/session.py +119 -0
  367. agentpool_config/skills.py +17 -0
  368. agentpool_config/storage.py +288 -0
  369. agentpool_config/system_prompts.py +190 -0
  370. agentpool_config/task.py +162 -0
  371. agentpool_config/teams.py +52 -0
  372. agentpool_config/tools.py +112 -0
  373. agentpool_config/toolsets.py +1033 -0
  374. agentpool_config/workers.py +86 -0
  375. agentpool_prompts/__init__.py +1 -0
  376. agentpool_prompts/braintrust_hub.py +235 -0
  377. agentpool_prompts/fabric.py +75 -0
  378. agentpool_prompts/langfuse_hub.py +79 -0
  379. agentpool_prompts/promptlayer_provider.py +59 -0
  380. agentpool_prompts/py.typed +0 -0
  381. agentpool_server/__init__.py +9 -0
  382. agentpool_server/a2a_server/__init__.py +5 -0
  383. agentpool_server/a2a_server/a2a_types.py +41 -0
  384. agentpool_server/a2a_server/server.py +190 -0
  385. agentpool_server/a2a_server/storage.py +81 -0
  386. agentpool_server/acp_server/__init__.py +22 -0
  387. agentpool_server/acp_server/acp_agent.py +786 -0
  388. agentpool_server/acp_server/acp_tools.py +43 -0
  389. agentpool_server/acp_server/commands/__init__.py +18 -0
  390. agentpool_server/acp_server/commands/acp_commands.py +594 -0
  391. agentpool_server/acp_server/commands/debug_commands.py +376 -0
  392. agentpool_server/acp_server/commands/docs_commands/__init__.py +39 -0
  393. agentpool_server/acp_server/commands/docs_commands/fetch_repo.py +169 -0
  394. agentpool_server/acp_server/commands/docs_commands/get_schema.py +176 -0
  395. agentpool_server/acp_server/commands/docs_commands/get_source.py +110 -0
  396. agentpool_server/acp_server/commands/docs_commands/git_diff.py +111 -0
  397. agentpool_server/acp_server/commands/docs_commands/helpers.py +33 -0
  398. agentpool_server/acp_server/commands/docs_commands/url_to_markdown.py +90 -0
  399. agentpool_server/acp_server/commands/spawn.py +210 -0
  400. agentpool_server/acp_server/converters.py +235 -0
  401. agentpool_server/acp_server/input_provider.py +338 -0
  402. agentpool_server/acp_server/server.py +288 -0
  403. agentpool_server/acp_server/session.py +969 -0
  404. agentpool_server/acp_server/session_manager.py +313 -0
  405. agentpool_server/acp_server/syntax_detection.py +250 -0
  406. agentpool_server/acp_server/zed_tools.md +90 -0
  407. agentpool_server/aggregating_server.py +309 -0
  408. agentpool_server/agui_server/__init__.py +11 -0
  409. agentpool_server/agui_server/server.py +128 -0
  410. agentpool_server/base.py +189 -0
  411. agentpool_server/http_server.py +164 -0
  412. agentpool_server/mcp_server/__init__.py +6 -0
  413. agentpool_server/mcp_server/server.py +314 -0
  414. agentpool_server/mcp_server/zed_wrapper.py +110 -0
  415. agentpool_server/openai_api_server/__init__.py +5 -0
  416. agentpool_server/openai_api_server/completions/__init__.py +1 -0
  417. agentpool_server/openai_api_server/completions/helpers.py +81 -0
  418. agentpool_server/openai_api_server/completions/models.py +98 -0
  419. agentpool_server/openai_api_server/responses/__init__.py +1 -0
  420. agentpool_server/openai_api_server/responses/helpers.py +74 -0
  421. agentpool_server/openai_api_server/responses/models.py +96 -0
  422. agentpool_server/openai_api_server/server.py +242 -0
  423. agentpool_server/py.typed +0 -0
  424. agentpool_storage/__init__.py +9 -0
  425. agentpool_storage/base.py +310 -0
  426. agentpool_storage/file_provider.py +378 -0
  427. agentpool_storage/formatters.py +129 -0
  428. agentpool_storage/memory_provider.py +396 -0
  429. agentpool_storage/models.py +108 -0
  430. agentpool_storage/py.typed +0 -0
  431. agentpool_storage/session_store.py +262 -0
  432. agentpool_storage/sql_provider/__init__.py +21 -0
  433. agentpool_storage/sql_provider/cli.py +146 -0
  434. agentpool_storage/sql_provider/models.py +249 -0
  435. agentpool_storage/sql_provider/queries.py +15 -0
  436. agentpool_storage/sql_provider/sql_provider.py +444 -0
  437. agentpool_storage/sql_provider/utils.py +234 -0
  438. agentpool_storage/text_log_provider.py +275 -0
  439. agentpool_toolsets/__init__.py +15 -0
  440. agentpool_toolsets/builtin/__init__.py +33 -0
  441. agentpool_toolsets/builtin/agent_management.py +239 -0
  442. agentpool_toolsets/builtin/chain.py +288 -0
  443. agentpool_toolsets/builtin/code.py +398 -0
  444. agentpool_toolsets/builtin/debug.py +291 -0
  445. agentpool_toolsets/builtin/execution_environment.py +381 -0
  446. agentpool_toolsets/builtin/file_edit/__init__.py +11 -0
  447. agentpool_toolsets/builtin/file_edit/file_edit.py +747 -0
  448. agentpool_toolsets/builtin/file_edit/fuzzy_matcher/__init__.py +5 -0
  449. agentpool_toolsets/builtin/file_edit/fuzzy_matcher/example_usage.py +311 -0
  450. agentpool_toolsets/builtin/file_edit/fuzzy_matcher/streaming_fuzzy_matcher.py +443 -0
  451. agentpool_toolsets/builtin/history.py +36 -0
  452. agentpool_toolsets/builtin/integration.py +85 -0
  453. agentpool_toolsets/builtin/skills.py +77 -0
  454. agentpool_toolsets/builtin/subagent_tools.py +324 -0
  455. agentpool_toolsets/builtin/tool_management.py +90 -0
  456. agentpool_toolsets/builtin/user_interaction.py +52 -0
  457. agentpool_toolsets/builtin/workers.py +128 -0
  458. agentpool_toolsets/composio_toolset.py +96 -0
  459. agentpool_toolsets/config_creation.py +192 -0
  460. agentpool_toolsets/entry_points.py +47 -0
  461. agentpool_toolsets/fsspec_toolset/__init__.py +7 -0
  462. agentpool_toolsets/fsspec_toolset/diagnostics.py +115 -0
  463. agentpool_toolsets/fsspec_toolset/grep.py +450 -0
  464. agentpool_toolsets/fsspec_toolset/helpers.py +631 -0
  465. agentpool_toolsets/fsspec_toolset/streaming_diff_parser.py +249 -0
  466. agentpool_toolsets/fsspec_toolset/toolset.py +1384 -0
  467. agentpool_toolsets/mcp_run_toolset.py +61 -0
  468. agentpool_toolsets/notifications.py +146 -0
  469. agentpool_toolsets/openapi.py +118 -0
  470. agentpool_toolsets/py.typed +0 -0
  471. agentpool_toolsets/search_toolset.py +202 -0
  472. agentpool_toolsets/semantic_memory_toolset.py +536 -0
  473. agentpool_toolsets/streaming_tools.py +265 -0
  474. agentpool_toolsets/vfs_toolset.py +124 -0
@@ -0,0 +1,658 @@
1
+ """Models for agent configuration."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from functools import cached_property
6
+ from typing import TYPE_CHECKING, Annotated, Any, Self
7
+
8
+ from pydantic import ConfigDict, Field, model_validator
9
+ from schemez import Schema
10
+ from upathtools.configs import FilesystemConfigType
11
+ from upathtools.configs.base import URIFileSystemConfig
12
+
13
+ from agentpool import log
14
+ from agentpool.models.acp_agents import ACPAgentConfigTypes
15
+ from agentpool.models.agents import NativeAgentConfig
16
+ from agentpool.models.agui_agents import AGUIAgentConfig
17
+ from agentpool.models.claude_code_agents import ClaudeCodeAgentConfig
18
+ from agentpool.models.file_agents import FileAgentConfig
19
+ from agentpool_config.commands import CommandConfig, StaticCommandConfig
20
+ from agentpool_config.converters import ConversionConfig
21
+ from agentpool_config.mcp_server import BaseMCPServerConfig, MCPServerConfig
22
+ from agentpool_config.observability import ObservabilityConfig
23
+ from agentpool_config.output_types import StructuredResponseConfig
24
+ from agentpool_config.pool_server import MCPPoolServerConfig
25
+ from agentpool_config.storage import StorageConfig
26
+ from agentpool_config.system_prompts import PromptLibraryConfig
27
+ from agentpool_config.task import Job
28
+ from agentpool_config.teams import TeamConfig
29
+ from agentpool_config.workers import (
30
+ ACPAgentWorkerConfig,
31
+ AgentWorkerConfig,
32
+ AGUIAgentWorkerConfig,
33
+ BaseWorkerConfig,
34
+ TeamWorkerConfig,
35
+ )
36
+
37
+
38
+ if TYPE_CHECKING:
39
+ from upathtools import JoinablePathLike
40
+
41
+ from agentpool.models.acp_agents import BaseACPAgentConfig
42
+ from agentpool.prompts.manager import PromptManager
43
+ from agentpool.vfs_registry import VFSRegistry
44
+
45
+ logger = log.get_logger(__name__)
46
+
47
+
48
+ # Model union with discriminator for typed configs
49
+ _FileSystemConfigUnion = Annotated[
50
+ FilesystemConfigType | URIFileSystemConfig,
51
+ Field(discriminator="type"),
52
+ ]
53
+
54
+ # Final type allowing models or URI shorthand string
55
+ ResourceConfig = _FileSystemConfigUnion | str
56
+
57
+ # Unified agent config type with top-level discriminator
58
+ AnyAgentConfig = Annotated[
59
+ NativeAgentConfig | AGUIAgentConfig | ClaudeCodeAgentConfig | ACPAgentConfigTypes,
60
+ Field(discriminator="type"),
61
+ ]
62
+
63
+
64
+ class AgentsManifest(Schema):
65
+ """Complete agent configuration manifest defining all available agents.
66
+
67
+ This is the root configuration that:
68
+ - Defines available response types (both inline and imported)
69
+ - Configures all agent instances and their settings
70
+ - Sets up custom role definitions and capabilities
71
+ - Manages environment configurations
72
+
73
+ A single manifest can define multiple agents that can work independently
74
+ or collaborate through the orchestrator.
75
+ """
76
+
77
+ INHERIT: str | list[str] | None = None
78
+ """Inheritance references."""
79
+
80
+ resources: dict[str, ResourceConfig] = Field(
81
+ default_factory=dict,
82
+ examples=[
83
+ {"docs": "file://./docs", "data": "s3://bucket/data"},
84
+ {
85
+ "api": {
86
+ "type": "uri",
87
+ "uri": "https://api.example.com",
88
+ "cached": True,
89
+ }
90
+ },
91
+ ],
92
+ )
93
+ """Resource configurations defining available filesystems.
94
+
95
+ Supports both full config and URI shorthand:
96
+ resources:
97
+ docs: "file://./docs" # shorthand
98
+ data: # full config
99
+ type: "uri"
100
+ uri: "s3://bucket/data"
101
+ cached: true
102
+ """
103
+
104
+ agents: dict[str, AnyAgentConfig] = Field(
105
+ default_factory=dict,
106
+ json_schema_extra={
107
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/agent_configuration/"
108
+ },
109
+ )
110
+ """Mapping of agent IDs to their configurations.
111
+
112
+ All agent types are unified under this single dict, discriminated by the 'type' field:
113
+ - type: "native" (default) - pydantic-ai based agents
114
+ - type: "agui" - AG-UI protocol agents
115
+ - type: "claude_code" - Claude Agent SDK agents
116
+ - type: "acp" - ACP protocol agents (further discriminated by 'provider')
117
+
118
+ Example:
119
+ ```yaml
120
+ agents:
121
+ assistant:
122
+ type: native
123
+ model: openai:gpt-4
124
+ system_prompt: "You are a helpful assistant."
125
+
126
+ coder:
127
+ type: claude_code
128
+ cwd: /path/to/project
129
+ model: claude-sonnet-4-5
130
+
131
+ orchestrator:
132
+ type: acp
133
+ provider: claude
134
+ model: sonnet
135
+
136
+ remote:
137
+ type: agui
138
+ endpoint: http://localhost:8000/agent/run
139
+ ```
140
+
141
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/agent_configuration/
142
+ """
143
+
144
+ file_agents: dict[str, str | FileAgentConfig] = Field(
145
+ default_factory=dict,
146
+ examples=[
147
+ {
148
+ "code_reviewer": ".claude/agents/reviewer.md",
149
+ "debugger": "https://example.com/agents/debugger.md",
150
+ "custom": {"type": "opencode", "path": "./agents/custom.md"},
151
+ }
152
+ ],
153
+ )
154
+ """Mapping of agent IDs to file-based agent definitions.
155
+
156
+ Supports both simple path strings (auto-detect format) and explicit config
157
+ with type discriminator.
158
+ Files must have YAML frontmatter in Claude Code, OpenCode, or AgentPool format.
159
+ The markdown body becomes the system prompt.
160
+
161
+ Formats:
162
+ - claude: name, description, tools (comma-separated), model, permissionMode
163
+ - opencode: description, mode, model, temperature, maxSteps, tools (dict)
164
+ - native: Full NativeAgentConfig fields in frontmatter
165
+
166
+ Example:
167
+ ```yaml
168
+ file_agents:
169
+ reviewer: .claude/agents/reviewer.md # auto-detect
170
+ debugger:
171
+ type: opencode # explicit type
172
+ path: ./agents/debugger.md
173
+ ```
174
+ """
175
+
176
+ teams: dict[str, TeamConfig] = Field(
177
+ default_factory=dict,
178
+ json_schema_extra={
179
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/team_configuration/"
180
+ },
181
+ )
182
+ """Mapping of team IDs to their configurations.
183
+
184
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/team_configuration/
185
+ """
186
+
187
+ storage: StorageConfig = Field(
188
+ default_factory=StorageConfig,
189
+ json_schema_extra={
190
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/storage_configuration/"
191
+ },
192
+ )
193
+ """Storage provider configuration.
194
+
195
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/storage_configuration/
196
+ """
197
+
198
+ observability: ObservabilityConfig = Field(default_factory=ObservabilityConfig)
199
+ """Observability provider configuration."""
200
+
201
+ conversion: ConversionConfig = Field(default_factory=ConversionConfig)
202
+ """Document conversion configuration."""
203
+
204
+ responses: dict[str, StructuredResponseConfig] = Field(
205
+ default_factory=dict,
206
+ json_schema_extra={
207
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/response_configuration/"
208
+ },
209
+ )
210
+ """Mapping of response names to their definitions.
211
+
212
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/response_configuration/
213
+ """
214
+
215
+ jobs: dict[str, Job[Any]] = Field(default_factory=dict)
216
+ """Pre-defined jobs, ready to be used by nodes."""
217
+
218
+ mcp_servers: list[str | MCPServerConfig] = Field(
219
+ default_factory=list,
220
+ examples=[
221
+ ["uvx some-server"],
222
+ [{"type": "streamable-http", "url": "http://mcp.example.com"}],
223
+ ],
224
+ json_schema_extra={
225
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/mcp_configuration/"
226
+ },
227
+ )
228
+ """List of MCP server configurations:
229
+
230
+ These MCP servers are used to provide tools and other resources to the nodes.
231
+
232
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/mcp_configuration/
233
+ """
234
+ pool_server: MCPPoolServerConfig = Field(default_factory=MCPPoolServerConfig)
235
+ """Pool server configuration.
236
+
237
+ This MCP server configuration is used for the pool MCP server,
238
+ which exposes pool functionality to other applications / clients."""
239
+
240
+ prompts: PromptLibraryConfig = Field(
241
+ default_factory=PromptLibraryConfig,
242
+ json_schema_extra={
243
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/prompt_configuration/"
244
+ },
245
+ )
246
+ """Prompt library configuration.
247
+
248
+ This configuration defines the prompt library, which is used to provide prompts to the nodes.
249
+
250
+ Docs: https://phil65.github.io/agentpool/YAML%20Configuration/prompt_configuration/
251
+ """
252
+
253
+ commands: dict[str, CommandConfig | str] = Field(
254
+ default_factory=dict,
255
+ examples=[
256
+ {"check_disk": "df -h", "analyze": "Analyze the current situation"},
257
+ {
258
+ "status": {
259
+ "type": "static",
260
+ "content": "Show system status",
261
+ }
262
+ },
263
+ ],
264
+ )
265
+ """Global command shortcuts for prompt injection.
266
+
267
+ Supports both shorthand string syntax and full command configurations:
268
+ commands:
269
+ df: "check disk space" # shorthand -> StaticCommandConfig
270
+ analyze: # full config
271
+ type: file
272
+ path: "./prompts/analysis.md"
273
+ """
274
+
275
+ model_config = ConfigDict(
276
+ json_schema_extra={
277
+ "x-icon": "octicon:file-code-16",
278
+ "x-doc-title": "Manifest Overview",
279
+ "documentation_url": "https://phil65.github.io/agentpool/YAML%20Configuration/manifest_configuration/",
280
+ },
281
+ )
282
+
283
+ @model_validator(mode="before")
284
+ @classmethod
285
+ def set_default_agent_type(cls, data: dict[str, Any]) -> dict[str, Any]:
286
+ """Set default type='native' for agents without a type field."""
287
+ agents = data.get("agents", {})
288
+ for config in agents.values():
289
+ if isinstance(config, dict) and "type" not in config:
290
+ config["type"] = "native"
291
+ return data
292
+
293
+ @model_validator(mode="before")
294
+ @classmethod
295
+ def normalize_workers(cls, data: dict[str, Any]) -> dict[str, Any]: # noqa: PLR0915
296
+ """Convert string workers to appropriate WorkerConfig for all agents."""
297
+ teams = data.get("teams", {})
298
+ agents = data.get("agents", {})
299
+
300
+ def get_agent_type(name: str) -> str | None:
301
+ """Get the type of an agent by name from the unified agents dict."""
302
+ if name not in agents:
303
+ return None
304
+ agent_cfg = agents[name]
305
+ if isinstance(agent_cfg, dict):
306
+ return str(agent_cfg.get("type", "native"))
307
+ return str(getattr(agent_cfg, "type", "native"))
308
+
309
+ # Process workers for all agents that have them (only dict configs need processing)
310
+ for agent_name, agent_config in agents.items():
311
+ if not isinstance(agent_config, dict):
312
+ continue # Already a model instance, skip
313
+ workers = agent_config.get("workers", [])
314
+ if workers:
315
+ normalized: list[BaseWorkerConfig] = []
316
+
317
+ for worker in workers:
318
+ match worker:
319
+ case str() as name if name in teams:
320
+ normalized.append(TeamWorkerConfig(name=name))
321
+ case str() as name:
322
+ # Determine worker config based on agent type
323
+ agent_type = get_agent_type(name)
324
+ match agent_type:
325
+ case "acp":
326
+ normalized.append(ACPAgentWorkerConfig(name=name))
327
+ case "agui":
328
+ normalized.append(AGUIAgentWorkerConfig(name=name))
329
+ case _: # native, claude_code, or unknown
330
+ normalized.append(AgentWorkerConfig(name=name))
331
+
332
+ case dict() as config:
333
+ # If type is explicitly specified, use it
334
+ if worker_type := config.get("type"):
335
+ match worker_type:
336
+ case "team":
337
+ normalized.append(TeamWorkerConfig(**config))
338
+ case "agent":
339
+ normalized.append(AgentWorkerConfig(**config))
340
+ case "acp_agent":
341
+ normalized.append(ACPAgentWorkerConfig(**config))
342
+ case "agui_agent":
343
+ normalized.append(AGUIAgentWorkerConfig(**config))
344
+ case _:
345
+ msg = f"Invalid worker type: {worker_type}"
346
+ raise ValueError(msg)
347
+ else:
348
+ # Determine type based on worker name
349
+ worker_name = config.get("name")
350
+ if not worker_name:
351
+ msg = "Worker config missing name"
352
+ raise ValueError(msg)
353
+
354
+ if worker_name in teams:
355
+ normalized.append(TeamWorkerConfig(**config))
356
+ else:
357
+ agent_type = get_agent_type(worker_name)
358
+ match agent_type:
359
+ case "acp":
360
+ normalized.append(ACPAgentWorkerConfig(**config))
361
+ case "agui":
362
+ normalized.append(AGUIAgentWorkerConfig(**config))
363
+ case _:
364
+ normalized.append(AgentWorkerConfig(**config))
365
+
366
+ case BaseWorkerConfig(): # Already normalized
367
+ normalized.append(worker)
368
+
369
+ case _:
370
+ msg = f"Invalid worker configuration: {worker}"
371
+ raise ValueError(msg)
372
+
373
+ if isinstance(agent_config, dict):
374
+ agent_config["workers"] = normalized
375
+ else: # Need to create a new dict with updated workers
376
+ agent_dict = agent_config.model_dump()
377
+ agent_dict["workers"] = normalized
378
+ agents[agent_name] = agent_dict
379
+
380
+ return data
381
+
382
+ @cached_property
383
+ def vfs_registry(self) -> VFSRegistry:
384
+ """Get registry with all configured VFS resources."""
385
+ from agentpool.vfs_registry import VFSRegistry
386
+
387
+ registry = VFSRegistry()
388
+ for name, config in self.resources.items():
389
+ registry.register_from_config(name, config)
390
+ return registry
391
+
392
+ def clone_agent_config(
393
+ self,
394
+ name: str,
395
+ new_name: str | None = None,
396
+ *,
397
+ template_context: dict[str, Any] | None = None,
398
+ **overrides: Any,
399
+ ) -> str:
400
+ """Create a copy of an agent configuration.
401
+
402
+ Args:
403
+ name: Name of agent to clone
404
+ new_name: Optional new name (auto-generated if None)
405
+ template_context: Variables for template rendering
406
+ **overrides: Configuration overrides for the clone
407
+
408
+ Returns:
409
+ Name of the new agent
410
+
411
+ Raises:
412
+ KeyError: If original agent not found
413
+ ValueError: If new name already exists or if overrides invalid
414
+ """
415
+ if name not in self.agents:
416
+ msg = f"Agent {name} not found"
417
+ raise KeyError(msg)
418
+
419
+ actual_name = new_name or f"{name}_copy_{len(self.agents)}"
420
+ if actual_name in self.agents:
421
+ msg = f"Agent {actual_name} already exists"
422
+ raise ValueError(msg)
423
+
424
+ config = self.agents[name].model_copy(deep=True)
425
+ for key, value in overrides.items():
426
+ if not hasattr(config, key):
427
+ msg = f"Invalid override: {key}"
428
+ raise ValueError(msg)
429
+ setattr(config, key, value)
430
+
431
+ # Handle template rendering if context provided
432
+ if template_context and "name" in template_context and "name" not in overrides:
433
+ config.model_copy(update={"name": template_context["name"]})
434
+
435
+ # Note: system_prompts will be rendered during agent creation, not here
436
+ # config.system_prompts remains as PromptConfig objects
437
+ self.agents[actual_name] = config
438
+ return actual_name
439
+
440
+ @model_validator(mode="before")
441
+ @classmethod
442
+ def resolve_inheritance(cls, data: dict[str, Any]) -> dict[str, Any]:
443
+ """Resolve agent inheritance chains."""
444
+ nodes = data.get("agents", {})
445
+ resolved: dict[str, dict[str, Any]] = {}
446
+ seen: set[str] = set()
447
+
448
+ def resolve_node(name: str) -> dict[str, Any] | Any:
449
+ if name in resolved:
450
+ return resolved[name]
451
+
452
+ node = nodes[name]
453
+ # Skip model instances - they're already validated
454
+ if not isinstance(node, dict):
455
+ return node
456
+
457
+ if name in seen:
458
+ msg = f"Circular inheritance detected: {name}"
459
+ raise ValueError(msg)
460
+
461
+ seen.add(name)
462
+ config = node.copy()
463
+ inherit = config.get("inherits")
464
+ if inherit:
465
+ if inherit not in nodes:
466
+ msg = f"Parent agent {inherit} not found"
467
+ raise ValueError(msg)
468
+
469
+ parent = resolve_node(inherit) # Get resolved parent config
470
+ if isinstance(parent, dict):
471
+ merged = parent.copy()
472
+ merged.update(config)
473
+ config = merged
474
+
475
+ seen.remove(name)
476
+ resolved[name] = config
477
+ return config
478
+
479
+ for name in nodes:
480
+ resolved[name] = resolve_node(name)
481
+
482
+ # Update nodes with resolved configs
483
+ data["agents"] = resolved
484
+ return data
485
+
486
+ @cached_property
487
+ def _loaded_file_agents(self) -> dict[str, NativeAgentConfig]:
488
+ """Load and cache file-based agent configurations.
489
+
490
+ Parses markdown files in Claude Code, OpenCode, or AgentPool format
491
+ and converts them to NativeAgentConfig. Results are cached.
492
+ """
493
+ from agentpool.models.file_parsing import parse_file_agent_reference
494
+
495
+ loaded: dict[str, NativeAgentConfig] = {}
496
+ for name, reference in self.file_agents.items():
497
+ try:
498
+ config = parse_file_agent_reference(reference)
499
+ # Ensure name is set from the key
500
+ if config.name is None:
501
+ config = config.model_copy(update={"name": name})
502
+ loaded[name] = config
503
+ except Exception as e:
504
+ path = reference if isinstance(reference, str) else reference.path
505
+ logger.exception("Failed to load file agent %r from %s", name, path)
506
+ msg = f"Failed to load file agent {name!r} from {path}: {e}"
507
+ raise ValueError(msg) from e
508
+ return loaded
509
+
510
+ @property
511
+ def node_names(self) -> list[str]:
512
+ """Get list of all agent and team names."""
513
+ return list(self.agents.keys()) + list(self.file_agents.keys()) + list(self.teams.keys())
514
+
515
+ @property
516
+ def nodes(self) -> dict[str, Any]:
517
+ """Get all agent and team configurations."""
518
+ return {**self.agents, **self._loaded_file_agents, **self.teams}
519
+
520
+ @property
521
+ def acp_agents(self) -> dict[str, BaseACPAgentConfig]:
522
+ """Get ACP agents filtered from unified agents dict."""
523
+ from agentpool.models.acp_agents import BaseACPAgentConfig
524
+
525
+ return {k: v for k, v in self.agents.items() if isinstance(v, BaseACPAgentConfig)}
526
+
527
+ @property
528
+ def agui_agents(self) -> dict[str, AGUIAgentConfig]:
529
+ """Get AG-UI agents filtered from unified agents dict."""
530
+ return {k: v for k, v in self.agents.items() if isinstance(v, AGUIAgentConfig)}
531
+
532
+ @property
533
+ def claude_code_agents(self) -> dict[str, ClaudeCodeAgentConfig]:
534
+ """Get Claude Code agents filtered from unified agents dict."""
535
+ return {k: v for k, v in self.agents.items() if isinstance(v, ClaudeCodeAgentConfig)}
536
+
537
+ @property
538
+ def native_agents(self) -> dict[str, NativeAgentConfig]:
539
+ """Get native agents filtered from unified agents dict."""
540
+ return {k: v for k, v in self.agents.items() if isinstance(v, NativeAgentConfig)}
541
+
542
+ def get_mcp_servers(self) -> list[MCPServerConfig]:
543
+ """Get processed MCP server configurations.
544
+
545
+ Converts string entries to appropriate MCP server configs based on heuristics:
546
+ - URLs ending with "/sse" -> SSE server
547
+ - URLs starting with http(s):// -> HTTP server
548
+ - Everything else -> stdio command
549
+
550
+ Returns:
551
+ List of MCPServerConfig instances
552
+
553
+ Raises:
554
+ ValueError: If string entry is empty
555
+ """
556
+ return [
557
+ BaseMCPServerConfig.from_string(cfg) if isinstance(cfg, str) else cfg
558
+ for cfg in self.mcp_servers
559
+ ]
560
+
561
+ def get_command_configs(self) -> dict[str, CommandConfig]:
562
+ """Get processed command configurations.
563
+
564
+ Converts string entries to StaticCommandConfig instances.
565
+
566
+ Returns:
567
+ Dict mapping command names to CommandConfig instances
568
+ """
569
+ result: dict[str, CommandConfig] = {}
570
+ for name, config in self.commands.items():
571
+ if isinstance(config, str):
572
+ result[name] = StaticCommandConfig(name=name, content=config)
573
+ else:
574
+ if config.name is None: # Set name if not provided
575
+ config.name = name
576
+ result[name] = config
577
+ return result
578
+
579
+ @cached_property
580
+ def prompt_manager(self) -> PromptManager:
581
+ """Get prompt manager for this manifest."""
582
+ from agentpool.prompts.manager import PromptManager
583
+
584
+ return PromptManager(self.prompts)
585
+
586
+ # @model_validator(mode="after")
587
+ # def validate_response_types(self) -> AgentsManifest:
588
+ # """Ensure all agent output_types exist in responses or are inline."""
589
+ # for agent_id, agent in self.agents.items():
590
+ # if (
591
+ # isinstance(agent.output_type, str)
592
+ # and agent.output_type not in self.responses
593
+ # ):
594
+ # msg = f"'{agent.output_type=}' for '{agent_id=}' not found in responses"
595
+ # raise ValueError(msg)
596
+ # return self
597
+
598
+ @classmethod
599
+ def from_file(cls, path: JoinablePathLike) -> Self:
600
+ """Load agent configuration from YAML file.
601
+
602
+ Args:
603
+ path: Path to the configuration file
604
+
605
+ Returns:
606
+ Loaded agent definition
607
+
608
+ Raises:
609
+ ValueError: If loading fails
610
+ """
611
+ import yamling
612
+
613
+ try:
614
+ data = yamling.load_yaml_file(path, resolve_inherit=True)
615
+ agent_def = cls.model_validate(data)
616
+ path_str = str(path)
617
+
618
+ def update_with_path(nodes: dict[str, Any]) -> dict[str, Any]:
619
+ return {
620
+ name: config.model_copy(update={"config_file_path": path_str})
621
+ for name, config in nodes.items()
622
+ }
623
+
624
+ return agent_def.model_copy(
625
+ update={
626
+ "agents": update_with_path(agent_def.agents),
627
+ "teams": update_with_path(agent_def.teams),
628
+ }
629
+ )
630
+ except Exception as exc:
631
+ msg = f"Failed to load agent config from {path}"
632
+ raise ValueError(msg) from exc
633
+
634
+ def get_output_type(self, agent_name: str) -> type[Any] | None:
635
+ """Get the resolved result type for an agent.
636
+
637
+ Returns None if no result type is configured or agent doesn't support output_type.
638
+ """
639
+ agent_config = self.agents[agent_name]
640
+ # Only NativeAgentConfig and ClaudeCodeAgentConfig have output_type
641
+ if not isinstance(agent_config, NativeAgentConfig | ClaudeCodeAgentConfig):
642
+ return None
643
+ if not agent_config.output_type:
644
+ return None
645
+ logger.debug("Building response model", type=agent_config.output_type)
646
+ if isinstance(agent_config.output_type, str):
647
+ response_def = self.responses[agent_config.output_type]
648
+ return response_def.response_schema.get_schema()
649
+ return agent_config.output_type.response_schema.get_schema()
650
+
651
+
652
+ if __name__ == "__main__":
653
+ from llmling_models.configs import InputModelConfig
654
+
655
+ model = InputModelConfig()
656
+ agent_cfg = NativeAgentConfig(name="test_agent", model=model)
657
+ manifest = AgentsManifest(agents=dict(test_agent=agent_cfg))
658
+ print(AgentsManifest.generate_test_data(mode="maximal").model_dump_yaml())
@@ -0,0 +1,9 @@
1
+ """Observability package."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from agentpool.observability.observability_registry import ObservabilityRegistry
6
+
7
+ registry = ObservabilityRegistry()
8
+
9
+ __all__ = ["ObservabilityRegistry", "registry"]