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.
- acp/README.md +64 -0
- acp/__init__.py +172 -0
- acp/__main__.py +10 -0
- acp/acp_requests.py +285 -0
- acp/agent/__init__.py +6 -0
- acp/agent/connection.py +256 -0
- acp/agent/implementations/__init__.py +6 -0
- acp/agent/implementations/debug_server/__init__.py +1 -0
- acp/agent/implementations/debug_server/cli.py +79 -0
- acp/agent/implementations/debug_server/debug.html +234 -0
- acp/agent/implementations/debug_server/debug_server.py +496 -0
- acp/agent/implementations/testing.py +91 -0
- acp/agent/protocol.py +65 -0
- acp/bridge/README.md +162 -0
- acp/bridge/__init__.py +6 -0
- acp/bridge/__main__.py +91 -0
- acp/bridge/bridge.py +246 -0
- acp/bridge/py.typed +0 -0
- acp/bridge/settings.py +15 -0
- acp/client/__init__.py +7 -0
- acp/client/connection.py +251 -0
- acp/client/implementations/__init__.py +7 -0
- acp/client/implementations/default_client.py +185 -0
- acp/client/implementations/headless_client.py +266 -0
- acp/client/implementations/noop_client.py +110 -0
- acp/client/protocol.py +61 -0
- acp/connection.py +280 -0
- acp/exceptions.py +46 -0
- acp/filesystem.py +524 -0
- acp/notifications.py +832 -0
- acp/py.typed +0 -0
- acp/schema/__init__.py +265 -0
- acp/schema/agent_plan.py +30 -0
- acp/schema/agent_requests.py +126 -0
- acp/schema/agent_responses.py +256 -0
- acp/schema/base.py +39 -0
- acp/schema/capabilities.py +230 -0
- acp/schema/client_requests.py +247 -0
- acp/schema/client_responses.py +96 -0
- acp/schema/common.py +81 -0
- acp/schema/content_blocks.py +188 -0
- acp/schema/mcp.py +82 -0
- acp/schema/messages.py +171 -0
- acp/schema/notifications.py +82 -0
- acp/schema/protocol_stuff.md +3 -0
- acp/schema/session_state.py +160 -0
- acp/schema/session_updates.py +419 -0
- acp/schema/slash_commands.py +51 -0
- acp/schema/terminal.py +15 -0
- acp/schema/tool_call.py +347 -0
- acp/stdio.py +250 -0
- acp/task/__init__.py +53 -0
- acp/task/debug.py +197 -0
- acp/task/dispatcher.py +93 -0
- acp/task/queue.py +69 -0
- acp/task/sender.py +82 -0
- acp/task/state.py +87 -0
- acp/task/supervisor.py +93 -0
- acp/terminal_handle.py +30 -0
- acp/tool_call_reporter.py +199 -0
- acp/tool_call_state.py +178 -0
- acp/transports.py +104 -0
- acp/utils.py +240 -0
- agentpool/__init__.py +63 -0
- agentpool/__main__.py +7 -0
- agentpool/agents/__init__.py +30 -0
- agentpool/agents/acp_agent/__init__.py +5 -0
- agentpool/agents/acp_agent/acp_agent.py +837 -0
- agentpool/agents/acp_agent/acp_converters.py +294 -0
- agentpool/agents/acp_agent/client_handler.py +317 -0
- agentpool/agents/acp_agent/session_state.py +44 -0
- agentpool/agents/agent.py +1264 -0
- agentpool/agents/agui_agent/__init__.py +19 -0
- agentpool/agents/agui_agent/agui_agent.py +677 -0
- agentpool/agents/agui_agent/agui_converters.py +423 -0
- agentpool/agents/agui_agent/chunk_transformer.py +204 -0
- agentpool/agents/agui_agent/event_types.py +83 -0
- agentpool/agents/agui_agent/helpers.py +192 -0
- agentpool/agents/architect.py +71 -0
- agentpool/agents/base_agent.py +177 -0
- agentpool/agents/claude_code_agent/__init__.py +11 -0
- agentpool/agents/claude_code_agent/claude_code_agent.py +1021 -0
- agentpool/agents/claude_code_agent/converters.py +243 -0
- agentpool/agents/context.py +105 -0
- agentpool/agents/events/__init__.py +61 -0
- agentpool/agents/events/builtin_handlers.py +129 -0
- agentpool/agents/events/event_emitter.py +320 -0
- agentpool/agents/events/events.py +561 -0
- agentpool/agents/events/tts_handlers.py +186 -0
- agentpool/agents/interactions.py +419 -0
- agentpool/agents/slashed_agent.py +244 -0
- agentpool/agents/sys_prompts.py +178 -0
- agentpool/agents/tool_wrapping.py +184 -0
- agentpool/base_provider.py +28 -0
- agentpool/common_types.py +226 -0
- agentpool/config_resources/__init__.py +16 -0
- agentpool/config_resources/acp_assistant.yml +24 -0
- agentpool/config_resources/agents.yml +109 -0
- agentpool/config_resources/agents_template.yml +18 -0
- agentpool/config_resources/agui_test.yml +18 -0
- agentpool/config_resources/claude_code_agent.yml +16 -0
- agentpool/config_resources/claude_style_subagent.md +30 -0
- agentpool/config_resources/external_acp_agents.yml +77 -0
- agentpool/config_resources/opencode_style_subagent.md +19 -0
- agentpool/config_resources/tts_test_agents.yml +78 -0
- agentpool/delegation/__init__.py +8 -0
- agentpool/delegation/base_team.py +504 -0
- agentpool/delegation/message_flow_tracker.py +39 -0
- agentpool/delegation/pool.py +1129 -0
- agentpool/delegation/team.py +325 -0
- agentpool/delegation/teamrun.py +343 -0
- agentpool/docs/__init__.py +5 -0
- agentpool/docs/gen_examples.py +42 -0
- agentpool/docs/utils.py +370 -0
- agentpool/functional/__init__.py +20 -0
- agentpool/functional/py.typed +0 -0
- agentpool/functional/run.py +80 -0
- agentpool/functional/structure.py +136 -0
- agentpool/hooks/__init__.py +20 -0
- agentpool/hooks/agent_hooks.py +247 -0
- agentpool/hooks/base.py +119 -0
- agentpool/hooks/callable.py +140 -0
- agentpool/hooks/command.py +180 -0
- agentpool/hooks/prompt.py +122 -0
- agentpool/jinja_filters.py +132 -0
- agentpool/log.py +224 -0
- agentpool/mcp_server/__init__.py +17 -0
- agentpool/mcp_server/client.py +429 -0
- agentpool/mcp_server/constants.py +32 -0
- agentpool/mcp_server/conversions.py +172 -0
- agentpool/mcp_server/helpers.py +47 -0
- agentpool/mcp_server/manager.py +232 -0
- agentpool/mcp_server/message_handler.py +164 -0
- agentpool/mcp_server/registries/__init__.py +1 -0
- agentpool/mcp_server/registries/official_registry_client.py +345 -0
- agentpool/mcp_server/registries/pulsemcp_client.py +88 -0
- agentpool/mcp_server/tool_bridge.py +548 -0
- agentpool/messaging/__init__.py +58 -0
- agentpool/messaging/compaction.py +928 -0
- agentpool/messaging/connection_manager.py +319 -0
- agentpool/messaging/context.py +66 -0
- agentpool/messaging/event_manager.py +426 -0
- agentpool/messaging/events.py +39 -0
- agentpool/messaging/message_container.py +209 -0
- agentpool/messaging/message_history.py +491 -0
- agentpool/messaging/messagenode.py +377 -0
- agentpool/messaging/messages.py +655 -0
- agentpool/messaging/processing.py +76 -0
- agentpool/mime_utils.py +95 -0
- agentpool/models/__init__.py +21 -0
- agentpool/models/acp_agents/__init__.py +22 -0
- agentpool/models/acp_agents/base.py +308 -0
- agentpool/models/acp_agents/mcp_capable.py +790 -0
- agentpool/models/acp_agents/non_mcp.py +842 -0
- agentpool/models/agents.py +450 -0
- agentpool/models/agui_agents.py +89 -0
- agentpool/models/claude_code_agents.py +238 -0
- agentpool/models/file_agents.py +116 -0
- agentpool/models/file_parsing.py +367 -0
- agentpool/models/manifest.py +658 -0
- agentpool/observability/__init__.py +9 -0
- agentpool/observability/observability_registry.py +97 -0
- agentpool/prompts/__init__.py +1 -0
- agentpool/prompts/base.py +27 -0
- agentpool/prompts/builtin_provider.py +75 -0
- agentpool/prompts/conversion_manager.py +95 -0
- agentpool/prompts/convert.py +96 -0
- agentpool/prompts/manager.py +204 -0
- agentpool/prompts/parts/zed.md +33 -0
- agentpool/prompts/prompts.py +581 -0
- agentpool/py.typed +0 -0
- agentpool/queries/tree-sitter-language-pack/README.md +7 -0
- agentpool/queries/tree-sitter-language-pack/arduino-tags.scm +5 -0
- agentpool/queries/tree-sitter-language-pack/c-tags.scm +9 -0
- agentpool/queries/tree-sitter-language-pack/chatito-tags.scm +16 -0
- agentpool/queries/tree-sitter-language-pack/clojure-tags.scm +7 -0
- agentpool/queries/tree-sitter-language-pack/commonlisp-tags.scm +122 -0
- agentpool/queries/tree-sitter-language-pack/cpp-tags.scm +15 -0
- agentpool/queries/tree-sitter-language-pack/csharp-tags.scm +26 -0
- agentpool/queries/tree-sitter-language-pack/d-tags.scm +26 -0
- agentpool/queries/tree-sitter-language-pack/dart-tags.scm +92 -0
- agentpool/queries/tree-sitter-language-pack/elisp-tags.scm +5 -0
- agentpool/queries/tree-sitter-language-pack/elixir-tags.scm +54 -0
- agentpool/queries/tree-sitter-language-pack/elm-tags.scm +19 -0
- agentpool/queries/tree-sitter-language-pack/gleam-tags.scm +41 -0
- agentpool/queries/tree-sitter-language-pack/go-tags.scm +42 -0
- agentpool/queries/tree-sitter-language-pack/java-tags.scm +20 -0
- agentpool/queries/tree-sitter-language-pack/javascript-tags.scm +88 -0
- agentpool/queries/tree-sitter-language-pack/lua-tags.scm +34 -0
- agentpool/queries/tree-sitter-language-pack/matlab-tags.scm +10 -0
- agentpool/queries/tree-sitter-language-pack/ocaml-tags.scm +115 -0
- agentpool/queries/tree-sitter-language-pack/ocaml_interface-tags.scm +98 -0
- agentpool/queries/tree-sitter-language-pack/pony-tags.scm +39 -0
- agentpool/queries/tree-sitter-language-pack/properties-tags.scm +5 -0
- agentpool/queries/tree-sitter-language-pack/python-tags.scm +14 -0
- agentpool/queries/tree-sitter-language-pack/r-tags.scm +21 -0
- agentpool/queries/tree-sitter-language-pack/racket-tags.scm +12 -0
- agentpool/queries/tree-sitter-language-pack/ruby-tags.scm +64 -0
- agentpool/queries/tree-sitter-language-pack/rust-tags.scm +60 -0
- agentpool/queries/tree-sitter-language-pack/solidity-tags.scm +43 -0
- agentpool/queries/tree-sitter-language-pack/swift-tags.scm +51 -0
- agentpool/queries/tree-sitter-language-pack/udev-tags.scm +20 -0
- agentpool/queries/tree-sitter-languages/README.md +24 -0
- agentpool/queries/tree-sitter-languages/c-tags.scm +9 -0
- agentpool/queries/tree-sitter-languages/c_sharp-tags.scm +46 -0
- agentpool/queries/tree-sitter-languages/cpp-tags.scm +15 -0
- agentpool/queries/tree-sitter-languages/dart-tags.scm +91 -0
- agentpool/queries/tree-sitter-languages/elisp-tags.scm +8 -0
- agentpool/queries/tree-sitter-languages/elixir-tags.scm +54 -0
- agentpool/queries/tree-sitter-languages/elm-tags.scm +19 -0
- agentpool/queries/tree-sitter-languages/fortran-tags.scm +15 -0
- agentpool/queries/tree-sitter-languages/go-tags.scm +30 -0
- agentpool/queries/tree-sitter-languages/haskell-tags.scm +3 -0
- agentpool/queries/tree-sitter-languages/hcl-tags.scm +77 -0
- agentpool/queries/tree-sitter-languages/java-tags.scm +20 -0
- agentpool/queries/tree-sitter-languages/javascript-tags.scm +88 -0
- agentpool/queries/tree-sitter-languages/julia-tags.scm +60 -0
- agentpool/queries/tree-sitter-languages/kotlin-tags.scm +27 -0
- agentpool/queries/tree-sitter-languages/matlab-tags.scm +10 -0
- agentpool/queries/tree-sitter-languages/ocaml-tags.scm +115 -0
- agentpool/queries/tree-sitter-languages/ocaml_interface-tags.scm +98 -0
- agentpool/queries/tree-sitter-languages/php-tags.scm +26 -0
- agentpool/queries/tree-sitter-languages/python-tags.scm +12 -0
- agentpool/queries/tree-sitter-languages/ql-tags.scm +26 -0
- agentpool/queries/tree-sitter-languages/ruby-tags.scm +64 -0
- agentpool/queries/tree-sitter-languages/rust-tags.scm +60 -0
- agentpool/queries/tree-sitter-languages/scala-tags.scm +65 -0
- agentpool/queries/tree-sitter-languages/typescript-tags.scm +41 -0
- agentpool/queries/tree-sitter-languages/zig-tags.scm +3 -0
- agentpool/repomap.py +1231 -0
- agentpool/resource_providers/__init__.py +17 -0
- agentpool/resource_providers/aggregating.py +54 -0
- agentpool/resource_providers/base.py +172 -0
- agentpool/resource_providers/codemode/__init__.py +9 -0
- agentpool/resource_providers/codemode/code_executor.py +215 -0
- agentpool/resource_providers/codemode/default_prompt.py +19 -0
- agentpool/resource_providers/codemode/helpers.py +83 -0
- agentpool/resource_providers/codemode/progress_executor.py +212 -0
- agentpool/resource_providers/codemode/provider.py +150 -0
- agentpool/resource_providers/codemode/remote_mcp_execution.py +143 -0
- agentpool/resource_providers/codemode/remote_provider.py +171 -0
- agentpool/resource_providers/filtering.py +42 -0
- agentpool/resource_providers/mcp_provider.py +246 -0
- agentpool/resource_providers/plan_provider.py +196 -0
- agentpool/resource_providers/pool.py +69 -0
- agentpool/resource_providers/static.py +289 -0
- agentpool/running/__init__.py +20 -0
- agentpool/running/decorators.py +56 -0
- agentpool/running/discovery.py +101 -0
- agentpool/running/executor.py +284 -0
- agentpool/running/injection.py +111 -0
- agentpool/running/py.typed +0 -0
- agentpool/running/run_nodes.py +87 -0
- agentpool/server.py +122 -0
- agentpool/sessions/__init__.py +13 -0
- agentpool/sessions/manager.py +302 -0
- agentpool/sessions/models.py +71 -0
- agentpool/sessions/session.py +239 -0
- agentpool/sessions/store.py +163 -0
- agentpool/skills/__init__.py +5 -0
- agentpool/skills/manager.py +120 -0
- agentpool/skills/registry.py +210 -0
- agentpool/skills/skill.py +36 -0
- agentpool/storage/__init__.py +17 -0
- agentpool/storage/manager.py +419 -0
- agentpool/storage/serialization.py +136 -0
- agentpool/talk/__init__.py +13 -0
- agentpool/talk/registry.py +128 -0
- agentpool/talk/stats.py +159 -0
- agentpool/talk/talk.py +604 -0
- agentpool/tasks/__init__.py +20 -0
- agentpool/tasks/exceptions.py +25 -0
- agentpool/tasks/registry.py +33 -0
- agentpool/testing.py +129 -0
- agentpool/text_templates/__init__.py +39 -0
- agentpool/text_templates/system_prompt.jinja +30 -0
- agentpool/text_templates/tool_call_default.jinja +13 -0
- agentpool/text_templates/tool_call_markdown.jinja +25 -0
- agentpool/text_templates/tool_call_simple.jinja +5 -0
- agentpool/tools/__init__.py +16 -0
- agentpool/tools/base.py +269 -0
- agentpool/tools/exceptions.py +9 -0
- agentpool/tools/manager.py +255 -0
- agentpool/tools/tool_call_info.py +87 -0
- agentpool/ui/__init__.py +2 -0
- agentpool/ui/base.py +89 -0
- agentpool/ui/mock_provider.py +81 -0
- agentpool/ui/stdlib_provider.py +150 -0
- agentpool/utils/__init__.py +44 -0
- agentpool/utils/baseregistry.py +185 -0
- agentpool/utils/count_tokens.py +62 -0
- agentpool/utils/dag.py +184 -0
- agentpool/utils/importing.py +206 -0
- agentpool/utils/inspection.py +334 -0
- agentpool/utils/model_capabilities.py +25 -0
- agentpool/utils/network.py +28 -0
- agentpool/utils/now.py +22 -0
- agentpool/utils/parse_time.py +87 -0
- agentpool/utils/result_utils.py +35 -0
- agentpool/utils/signatures.py +305 -0
- agentpool/utils/streams.py +112 -0
- agentpool/utils/tasks.py +186 -0
- agentpool/vfs_registry.py +250 -0
- agentpool-2.1.9.dist-info/METADATA +336 -0
- agentpool-2.1.9.dist-info/RECORD +474 -0
- agentpool-2.1.9.dist-info/WHEEL +4 -0
- agentpool-2.1.9.dist-info/entry_points.txt +14 -0
- agentpool-2.1.9.dist-info/licenses/LICENSE +22 -0
- agentpool_cli/__init__.py +34 -0
- agentpool_cli/__main__.py +66 -0
- agentpool_cli/agent.py +175 -0
- agentpool_cli/cli_types.py +23 -0
- agentpool_cli/common.py +163 -0
- agentpool_cli/create.py +175 -0
- agentpool_cli/history.py +217 -0
- agentpool_cli/log.py +78 -0
- agentpool_cli/py.typed +0 -0
- agentpool_cli/run.py +84 -0
- agentpool_cli/serve_acp.py +177 -0
- agentpool_cli/serve_api.py +69 -0
- agentpool_cli/serve_mcp.py +74 -0
- agentpool_cli/serve_vercel.py +233 -0
- agentpool_cli/store.py +171 -0
- agentpool_cli/task.py +84 -0
- agentpool_cli/utils.py +104 -0
- agentpool_cli/watch.py +54 -0
- agentpool_commands/__init__.py +180 -0
- agentpool_commands/agents.py +199 -0
- agentpool_commands/base.py +45 -0
- agentpool_commands/commands.py +58 -0
- agentpool_commands/completers.py +110 -0
- agentpool_commands/connections.py +175 -0
- agentpool_commands/markdown_utils.py +31 -0
- agentpool_commands/models.py +62 -0
- agentpool_commands/prompts.py +78 -0
- agentpool_commands/py.typed +0 -0
- agentpool_commands/read.py +77 -0
- agentpool_commands/resources.py +210 -0
- agentpool_commands/session.py +48 -0
- agentpool_commands/tools.py +269 -0
- agentpool_commands/utils.py +189 -0
- agentpool_commands/workers.py +163 -0
- agentpool_config/__init__.py +53 -0
- agentpool_config/builtin_tools.py +265 -0
- agentpool_config/commands.py +237 -0
- agentpool_config/conditions.py +301 -0
- agentpool_config/converters.py +30 -0
- agentpool_config/durable.py +331 -0
- agentpool_config/event_handlers.py +600 -0
- agentpool_config/events.py +153 -0
- agentpool_config/forward_targets.py +251 -0
- agentpool_config/hook_conditions.py +331 -0
- agentpool_config/hooks.py +241 -0
- agentpool_config/jinja.py +206 -0
- agentpool_config/knowledge.py +41 -0
- agentpool_config/loaders.py +350 -0
- agentpool_config/mcp_server.py +243 -0
- agentpool_config/nodes.py +202 -0
- agentpool_config/observability.py +191 -0
- agentpool_config/output_types.py +55 -0
- agentpool_config/pool_server.py +267 -0
- agentpool_config/prompt_hubs.py +105 -0
- agentpool_config/prompts.py +185 -0
- agentpool_config/py.typed +0 -0
- agentpool_config/resources.py +33 -0
- agentpool_config/session.py +119 -0
- agentpool_config/skills.py +17 -0
- agentpool_config/storage.py +288 -0
- agentpool_config/system_prompts.py +190 -0
- agentpool_config/task.py +162 -0
- agentpool_config/teams.py +52 -0
- agentpool_config/tools.py +112 -0
- agentpool_config/toolsets.py +1033 -0
- agentpool_config/workers.py +86 -0
- agentpool_prompts/__init__.py +1 -0
- agentpool_prompts/braintrust_hub.py +235 -0
- agentpool_prompts/fabric.py +75 -0
- agentpool_prompts/langfuse_hub.py +79 -0
- agentpool_prompts/promptlayer_provider.py +59 -0
- agentpool_prompts/py.typed +0 -0
- agentpool_server/__init__.py +9 -0
- agentpool_server/a2a_server/__init__.py +5 -0
- agentpool_server/a2a_server/a2a_types.py +41 -0
- agentpool_server/a2a_server/server.py +190 -0
- agentpool_server/a2a_server/storage.py +81 -0
- agentpool_server/acp_server/__init__.py +22 -0
- agentpool_server/acp_server/acp_agent.py +786 -0
- agentpool_server/acp_server/acp_tools.py +43 -0
- agentpool_server/acp_server/commands/__init__.py +18 -0
- agentpool_server/acp_server/commands/acp_commands.py +594 -0
- agentpool_server/acp_server/commands/debug_commands.py +376 -0
- agentpool_server/acp_server/commands/docs_commands/__init__.py +39 -0
- agentpool_server/acp_server/commands/docs_commands/fetch_repo.py +169 -0
- agentpool_server/acp_server/commands/docs_commands/get_schema.py +176 -0
- agentpool_server/acp_server/commands/docs_commands/get_source.py +110 -0
- agentpool_server/acp_server/commands/docs_commands/git_diff.py +111 -0
- agentpool_server/acp_server/commands/docs_commands/helpers.py +33 -0
- agentpool_server/acp_server/commands/docs_commands/url_to_markdown.py +90 -0
- agentpool_server/acp_server/commands/spawn.py +210 -0
- agentpool_server/acp_server/converters.py +235 -0
- agentpool_server/acp_server/input_provider.py +338 -0
- agentpool_server/acp_server/server.py +288 -0
- agentpool_server/acp_server/session.py +969 -0
- agentpool_server/acp_server/session_manager.py +313 -0
- agentpool_server/acp_server/syntax_detection.py +250 -0
- agentpool_server/acp_server/zed_tools.md +90 -0
- agentpool_server/aggregating_server.py +309 -0
- agentpool_server/agui_server/__init__.py +11 -0
- agentpool_server/agui_server/server.py +128 -0
- agentpool_server/base.py +189 -0
- agentpool_server/http_server.py +164 -0
- agentpool_server/mcp_server/__init__.py +6 -0
- agentpool_server/mcp_server/server.py +314 -0
- agentpool_server/mcp_server/zed_wrapper.py +110 -0
- agentpool_server/openai_api_server/__init__.py +5 -0
- agentpool_server/openai_api_server/completions/__init__.py +1 -0
- agentpool_server/openai_api_server/completions/helpers.py +81 -0
- agentpool_server/openai_api_server/completions/models.py +98 -0
- agentpool_server/openai_api_server/responses/__init__.py +1 -0
- agentpool_server/openai_api_server/responses/helpers.py +74 -0
- agentpool_server/openai_api_server/responses/models.py +96 -0
- agentpool_server/openai_api_server/server.py +242 -0
- agentpool_server/py.typed +0 -0
- agentpool_storage/__init__.py +9 -0
- agentpool_storage/base.py +310 -0
- agentpool_storage/file_provider.py +378 -0
- agentpool_storage/formatters.py +129 -0
- agentpool_storage/memory_provider.py +396 -0
- agentpool_storage/models.py +108 -0
- agentpool_storage/py.typed +0 -0
- agentpool_storage/session_store.py +262 -0
- agentpool_storage/sql_provider/__init__.py +21 -0
- agentpool_storage/sql_provider/cli.py +146 -0
- agentpool_storage/sql_provider/models.py +249 -0
- agentpool_storage/sql_provider/queries.py +15 -0
- agentpool_storage/sql_provider/sql_provider.py +444 -0
- agentpool_storage/sql_provider/utils.py +234 -0
- agentpool_storage/text_log_provider.py +275 -0
- agentpool_toolsets/__init__.py +15 -0
- agentpool_toolsets/builtin/__init__.py +33 -0
- agentpool_toolsets/builtin/agent_management.py +239 -0
- agentpool_toolsets/builtin/chain.py +288 -0
- agentpool_toolsets/builtin/code.py +398 -0
- agentpool_toolsets/builtin/debug.py +291 -0
- agentpool_toolsets/builtin/execution_environment.py +381 -0
- agentpool_toolsets/builtin/file_edit/__init__.py +11 -0
- agentpool_toolsets/builtin/file_edit/file_edit.py +747 -0
- agentpool_toolsets/builtin/file_edit/fuzzy_matcher/__init__.py +5 -0
- agentpool_toolsets/builtin/file_edit/fuzzy_matcher/example_usage.py +311 -0
- agentpool_toolsets/builtin/file_edit/fuzzy_matcher/streaming_fuzzy_matcher.py +443 -0
- agentpool_toolsets/builtin/history.py +36 -0
- agentpool_toolsets/builtin/integration.py +85 -0
- agentpool_toolsets/builtin/skills.py +77 -0
- agentpool_toolsets/builtin/subagent_tools.py +324 -0
- agentpool_toolsets/builtin/tool_management.py +90 -0
- agentpool_toolsets/builtin/user_interaction.py +52 -0
- agentpool_toolsets/builtin/workers.py +128 -0
- agentpool_toolsets/composio_toolset.py +96 -0
- agentpool_toolsets/config_creation.py +192 -0
- agentpool_toolsets/entry_points.py +47 -0
- agentpool_toolsets/fsspec_toolset/__init__.py +7 -0
- agentpool_toolsets/fsspec_toolset/diagnostics.py +115 -0
- agentpool_toolsets/fsspec_toolset/grep.py +450 -0
- agentpool_toolsets/fsspec_toolset/helpers.py +631 -0
- agentpool_toolsets/fsspec_toolset/streaming_diff_parser.py +249 -0
- agentpool_toolsets/fsspec_toolset/toolset.py +1384 -0
- agentpool_toolsets/mcp_run_toolset.py +61 -0
- agentpool_toolsets/notifications.py +146 -0
- agentpool_toolsets/openapi.py +118 -0
- agentpool_toolsets/py.typed +0 -0
- agentpool_toolsets/search_toolset.py +202 -0
- agentpool_toolsets/semantic_memory_toolset.py +536 -0
- agentpool_toolsets/streaming_tools.py +265 -0
- 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())
|