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,269 @@
|
|
|
1
|
+
"""Tool management commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
|
+
|
|
7
|
+
from slashed import CommandContext, CommandError, CompletionContext # noqa: TC002
|
|
8
|
+
from slashed.completers import CallbackCompleter
|
|
9
|
+
|
|
10
|
+
from agentpool.agents.context import AgentContext # noqa: TC001
|
|
11
|
+
from agentpool.log import get_logger
|
|
12
|
+
from agentpool.utils.importing import import_callable
|
|
13
|
+
from agentpool_commands.base import NodeCommand
|
|
14
|
+
from agentpool_commands.markdown_utils import format_table
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
if TYPE_CHECKING:
|
|
18
|
+
from agentpool.messaging import MessageNode
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
logger = get_logger(__name__)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class ListToolsCommand(NodeCommand):
|
|
25
|
+
"""Show all available tools and their current status.
|
|
26
|
+
|
|
27
|
+
Tools are grouped by source (runtime/agent/builtin).
|
|
28
|
+
â indicates enabled, â indicates disabled.
|
|
29
|
+
"""
|
|
30
|
+
|
|
31
|
+
name = "list-tools"
|
|
32
|
+
category = "tools"
|
|
33
|
+
|
|
34
|
+
@classmethod
|
|
35
|
+
def supports_node(cls, node: MessageNode[Any, Any]) -> bool:
|
|
36
|
+
from agentpool import Agent
|
|
37
|
+
|
|
38
|
+
return isinstance(node, Agent)
|
|
39
|
+
|
|
40
|
+
async def execute_command(
|
|
41
|
+
self,
|
|
42
|
+
ctx: CommandContext[AgentContext],
|
|
43
|
+
source: str | None = None,
|
|
44
|
+
) -> None:
|
|
45
|
+
"""List all available tools.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
ctx: Command context
|
|
49
|
+
source: Optional filter by source (runtime/agent/builtin)
|
|
50
|
+
"""
|
|
51
|
+
agent = ctx.context.agent
|
|
52
|
+
|
|
53
|
+
rows = [
|
|
54
|
+
{
|
|
55
|
+
"Status": "â
" if tool_info.enabled else "â",
|
|
56
|
+
"Name": tool_info.name,
|
|
57
|
+
"Source": tool_info.source,
|
|
58
|
+
}
|
|
59
|
+
for tool_info in await agent.tools.get_tools()
|
|
60
|
+
if not source or tool_info.source == source
|
|
61
|
+
]
|
|
62
|
+
|
|
63
|
+
headers = ["Status", "Name", "Source"]
|
|
64
|
+
table = format_table(headers, rows)
|
|
65
|
+
await ctx.print(f"## đ§ Available Tools\n\n{table}")
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
class ShowToolCommand(NodeCommand):
|
|
69
|
+
"""Display detailed information about a specific tool.
|
|
70
|
+
|
|
71
|
+
Shows:
|
|
72
|
+
- Source (runtime/agent/builtin)
|
|
73
|
+
- Current status (enabled/disabled)
|
|
74
|
+
- Parameter descriptions
|
|
75
|
+
- Additional metadata
|
|
76
|
+
|
|
77
|
+
Example: /tool-info open_browser
|
|
78
|
+
"""
|
|
79
|
+
|
|
80
|
+
name = "show-tool"
|
|
81
|
+
category = "tools"
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def supports_node(cls, node: MessageNode[Any, Any]) -> bool:
|
|
85
|
+
from agentpool import Agent
|
|
86
|
+
|
|
87
|
+
return isinstance(node, Agent)
|
|
88
|
+
|
|
89
|
+
async def execute_command(
|
|
90
|
+
self,
|
|
91
|
+
ctx: CommandContext[AgentContext],
|
|
92
|
+
name: str,
|
|
93
|
+
) -> None:
|
|
94
|
+
"""Show detailed information about a tool.
|
|
95
|
+
|
|
96
|
+
Args:
|
|
97
|
+
ctx: Command context
|
|
98
|
+
name: Tool name to show
|
|
99
|
+
"""
|
|
100
|
+
agent = ctx.context.agent
|
|
101
|
+
|
|
102
|
+
try:
|
|
103
|
+
tool_info = await agent.tools.get_tool(name)
|
|
104
|
+
# Start with the standard tool info format
|
|
105
|
+
sections = [tool_info.format_info(indent="")]
|
|
106
|
+
|
|
107
|
+
# Add extra metadata section if we have any additional info
|
|
108
|
+
extra_info = []
|
|
109
|
+
if tool_info.requires_confirmation:
|
|
110
|
+
extra_info.append("Requires Confirmation: Yes")
|
|
111
|
+
if tool_info.source != "dynamic": # Only show if not default
|
|
112
|
+
extra_info.append(f"Source: {tool_info.source}")
|
|
113
|
+
if tool_info.metadata:
|
|
114
|
+
extra_info.append("\nMetadata:")
|
|
115
|
+
extra_info.extend(f"- {k}: {v}" for k, v in tool_info.metadata.items())
|
|
116
|
+
|
|
117
|
+
if extra_info:
|
|
118
|
+
sections.extend(extra_info)
|
|
119
|
+
|
|
120
|
+
await ctx.print("\n".join(sections))
|
|
121
|
+
except KeyError:
|
|
122
|
+
await ctx.print(f"â **Tool** `{name}` **not found**")
|
|
123
|
+
|
|
124
|
+
def get_completer(self) -> CallbackCompleter:
|
|
125
|
+
"""Get completer for tool names."""
|
|
126
|
+
return CallbackCompleter(get_tool_names)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class EnableToolCommand(NodeCommand):
|
|
130
|
+
"""Enable a previously disabled tool.
|
|
131
|
+
|
|
132
|
+
Use /list-tools to see available tools.
|
|
133
|
+
|
|
134
|
+
Example: /enable-tool open_browser
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
name = "enable-tool"
|
|
138
|
+
category = "tools"
|
|
139
|
+
|
|
140
|
+
@classmethod
|
|
141
|
+
def supports_node(cls, node: MessageNode[Any, Any]) -> bool:
|
|
142
|
+
from agentpool import Agent
|
|
143
|
+
|
|
144
|
+
return isinstance(node, Agent)
|
|
145
|
+
|
|
146
|
+
async def execute_command(
|
|
147
|
+
self,
|
|
148
|
+
ctx: CommandContext[AgentContext],
|
|
149
|
+
name: str,
|
|
150
|
+
) -> None:
|
|
151
|
+
"""Enable a tool.
|
|
152
|
+
|
|
153
|
+
Args:
|
|
154
|
+
ctx: Command context
|
|
155
|
+
name: Tool name to enable
|
|
156
|
+
"""
|
|
157
|
+
try:
|
|
158
|
+
await ctx.context.agent.tools.enable_tool(name)
|
|
159
|
+
await ctx.print(f"â
**Tool** `{name}` **enabled**")
|
|
160
|
+
except ValueError as e:
|
|
161
|
+
msg = f"Failed to enable tool: {e}"
|
|
162
|
+
raise CommandError(msg) from e
|
|
163
|
+
|
|
164
|
+
def get_completer(self) -> CallbackCompleter:
|
|
165
|
+
"""Get completer for tool names."""
|
|
166
|
+
return CallbackCompleter(get_tool_names)
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class DisableToolCommand(NodeCommand):
|
|
170
|
+
"""Disable a tool to prevent its use.
|
|
171
|
+
|
|
172
|
+
Use /list-tools to see available tools.
|
|
173
|
+
|
|
174
|
+
Example: /disable-tool open_browser
|
|
175
|
+
"""
|
|
176
|
+
|
|
177
|
+
name = "disable-tool"
|
|
178
|
+
category = "tools"
|
|
179
|
+
|
|
180
|
+
@classmethod
|
|
181
|
+
def supports_node(cls, node: MessageNode[Any, Any]) -> bool:
|
|
182
|
+
from agentpool import Agent
|
|
183
|
+
|
|
184
|
+
return isinstance(node, Agent)
|
|
185
|
+
|
|
186
|
+
async def execute_command(
|
|
187
|
+
self,
|
|
188
|
+
ctx: CommandContext[AgentContext],
|
|
189
|
+
name: str,
|
|
190
|
+
) -> None:
|
|
191
|
+
"""Disable a tool.
|
|
192
|
+
|
|
193
|
+
Args:
|
|
194
|
+
ctx: Command context
|
|
195
|
+
name: Tool name to disable
|
|
196
|
+
"""
|
|
197
|
+
try:
|
|
198
|
+
await ctx.context.agent.tools.disable_tool(name)
|
|
199
|
+
await ctx.print(f"â **Tool** `{name}` **disabled**")
|
|
200
|
+
except ValueError as e:
|
|
201
|
+
msg = f"Failed to disable tool: {e}"
|
|
202
|
+
raise CommandError(msg) from e
|
|
203
|
+
|
|
204
|
+
def get_completer(self) -> CallbackCompleter:
|
|
205
|
+
"""Get completer for tool names."""
|
|
206
|
+
return CallbackCompleter(get_tool_names)
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class RegisterToolCommand(NodeCommand):
|
|
210
|
+
"""Register a new tool from a Python import path.
|
|
211
|
+
|
|
212
|
+
Examples:
|
|
213
|
+
/register-tool webbrowser.open
|
|
214
|
+
/register-tool json.dumps --name format_json
|
|
215
|
+
/register-tool os.getcwd --description 'Get current directory'
|
|
216
|
+
"""
|
|
217
|
+
|
|
218
|
+
name = "register-tool"
|
|
219
|
+
category = "tools"
|
|
220
|
+
|
|
221
|
+
@classmethod
|
|
222
|
+
def supports_node(cls, node: MessageNode[Any, Any]) -> bool:
|
|
223
|
+
from agentpool import Agent
|
|
224
|
+
|
|
225
|
+
return isinstance(node, Agent)
|
|
226
|
+
|
|
227
|
+
async def execute_command(
|
|
228
|
+
self,
|
|
229
|
+
ctx: CommandContext[AgentContext],
|
|
230
|
+
import_path: str,
|
|
231
|
+
*,
|
|
232
|
+
name: str | None = None,
|
|
233
|
+
description: str | None = None,
|
|
234
|
+
) -> None:
|
|
235
|
+
"""Register a new tool from import path or function.
|
|
236
|
+
|
|
237
|
+
Args:
|
|
238
|
+
ctx: Command context
|
|
239
|
+
import_path: Python import path to the function
|
|
240
|
+
name: Optional custom name for the tool
|
|
241
|
+
description: Optional custom description
|
|
242
|
+
"""
|
|
243
|
+
try:
|
|
244
|
+
callable_func = import_callable(import_path)
|
|
245
|
+
# Register with ToolManager
|
|
246
|
+
tool_info = ctx.context.agent.tools.register_tool(
|
|
247
|
+
callable_func,
|
|
248
|
+
name_override=name,
|
|
249
|
+
description_override=description,
|
|
250
|
+
enabled=True,
|
|
251
|
+
source="dynamic",
|
|
252
|
+
metadata={"import_path": import_path, "registered_via": "register-tool"},
|
|
253
|
+
)
|
|
254
|
+
|
|
255
|
+
# Show the registered tool info
|
|
256
|
+
tool_info.format_info()
|
|
257
|
+
await ctx.print(
|
|
258
|
+
f"â
**Tool registered successfully:**\n`{tool_info.name}`"
|
|
259
|
+
f" - {tool_info.description or '*No description*'}"
|
|
260
|
+
)
|
|
261
|
+
|
|
262
|
+
except Exception as e:
|
|
263
|
+
msg = f"Failed to register tool: {e}"
|
|
264
|
+
raise CommandError(msg) from e
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
async def get_tool_names(ctx: CompletionContext[AgentContext]) -> list[str]:
|
|
268
|
+
manager = ctx.command_context.context.agent.tools
|
|
269
|
+
return list({t.name for t in await manager.get_tools()})
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
"""Command utilities."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import importlib.util
|
|
6
|
+
import webbrowser
|
|
7
|
+
|
|
8
|
+
from anyenv.text_sharing import TextSharerStr, Visibility # noqa: TC002
|
|
9
|
+
from slashed import CommandContext, CommandError # noqa: TC002
|
|
10
|
+
|
|
11
|
+
from agentpool.messaging.context import NodeContext # noqa: TC001
|
|
12
|
+
from agentpool_commands.base import NodeCommand
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class CopyClipboardCommand(NodeCommand):
|
|
16
|
+
"""Copy messages from conversation history to system clipboard.
|
|
17
|
+
|
|
18
|
+
Allows copying a configurable number of messages with options for:
|
|
19
|
+
- Number of messages to include
|
|
20
|
+
- Including/excluding system messages
|
|
21
|
+
- Token limit for context size
|
|
22
|
+
- Custom format templates
|
|
23
|
+
|
|
24
|
+
Requires clipman package to be installed.
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
name = "copy-clipboard"
|
|
28
|
+
category = "utils"
|
|
29
|
+
|
|
30
|
+
async def execute_command(
|
|
31
|
+
self,
|
|
32
|
+
ctx: CommandContext[NodeContext],
|
|
33
|
+
*,
|
|
34
|
+
num_messages: int = 1,
|
|
35
|
+
include_system: bool = False,
|
|
36
|
+
max_tokens: int | None = None,
|
|
37
|
+
format_template: str | None = None,
|
|
38
|
+
) -> None:
|
|
39
|
+
"""Copy messages to clipboard.
|
|
40
|
+
|
|
41
|
+
Args:
|
|
42
|
+
ctx: Command context
|
|
43
|
+
num_messages: Number of messages to copy (default: 1)
|
|
44
|
+
include_system: Include system messages
|
|
45
|
+
max_tokens: Only include messages up to token limit
|
|
46
|
+
format_template: Custom format template
|
|
47
|
+
"""
|
|
48
|
+
try:
|
|
49
|
+
import clipman # type: ignore[import-untyped]
|
|
50
|
+
except ImportError as e:
|
|
51
|
+
msg = "clipman package required for clipboard operations"
|
|
52
|
+
raise CommandError(msg) from e
|
|
53
|
+
|
|
54
|
+
content = await ctx.context.agent.conversation.format_history(
|
|
55
|
+
num_messages=num_messages,
|
|
56
|
+
include_system=include_system,
|
|
57
|
+
max_tokens=max_tokens,
|
|
58
|
+
format_template=format_template,
|
|
59
|
+
)
|
|
60
|
+
|
|
61
|
+
if not content.strip():
|
|
62
|
+
await ctx.print("âšī¸ **No messages found to copy**") # noqa: RUF001
|
|
63
|
+
return
|
|
64
|
+
|
|
65
|
+
try:
|
|
66
|
+
clipman.init()
|
|
67
|
+
clipman.copy(content)
|
|
68
|
+
await ctx.print("đ **Messages copied to clipboard**")
|
|
69
|
+
except Exception as e:
|
|
70
|
+
msg = f"Failed to copy to clipboard: {e}"
|
|
71
|
+
raise CommandError(msg) from e
|
|
72
|
+
|
|
73
|
+
@classmethod
|
|
74
|
+
def condition(cls) -> bool:
|
|
75
|
+
"""Check if clipman is available."""
|
|
76
|
+
return importlib.util.find_spec("clipman") is not None
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
class EditAgentFileCommand(NodeCommand):
|
|
80
|
+
"""Open the agent's configuration file in your default editor.
|
|
81
|
+
|
|
82
|
+
This file contains:
|
|
83
|
+
- Agent settings and capabilities
|
|
84
|
+
- System promptss
|
|
85
|
+
- Model configuration
|
|
86
|
+
- Environment references
|
|
87
|
+
- Role definitions
|
|
88
|
+
|
|
89
|
+
Note: Changes to the configuration file require reloading the agent.
|
|
90
|
+
"""
|
|
91
|
+
|
|
92
|
+
name = "open-agent-file"
|
|
93
|
+
category = "utils"
|
|
94
|
+
|
|
95
|
+
async def execute_command(self, ctx: CommandContext[NodeContext]) -> None:
|
|
96
|
+
"""Open agent's configuration file."""
|
|
97
|
+
agent = ctx.context.agent
|
|
98
|
+
agent_ctx = agent.get_context()
|
|
99
|
+
config = agent_ctx.config
|
|
100
|
+
if not config.config_file_path:
|
|
101
|
+
msg = "No configuration file path available"
|
|
102
|
+
raise CommandError(msg)
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
webbrowser.open(config.config_file_path)
|
|
106
|
+
msg = f"đ **Opening agent configuration:** `{config.config_file_path}`"
|
|
107
|
+
await ctx.print(msg)
|
|
108
|
+
except Exception as e:
|
|
109
|
+
msg = f"Failed to open configuration file: {e}"
|
|
110
|
+
raise CommandError(msg) from e
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
class ShareHistoryCommand(NodeCommand):
|
|
114
|
+
"""Share message history using various text sharing providers.
|
|
115
|
+
|
|
116
|
+
Supports multiple providers:
|
|
117
|
+
- gist: GitHub Gist (requires GITHUB_TOKEN or GH_TOKEN)
|
|
118
|
+
- pastebin: Pastebin (requires PASTEBIN_API_KEY)
|
|
119
|
+
- paste_rs: paste.rs (no authentication required)
|
|
120
|
+
- opencode: OpenCode (no authentication required)
|
|
121
|
+
|
|
122
|
+
The shared content can be conversation history or custom text.
|
|
123
|
+
"""
|
|
124
|
+
|
|
125
|
+
name = "share-text"
|
|
126
|
+
category = "utils"
|
|
127
|
+
|
|
128
|
+
async def execute_command(
|
|
129
|
+
self,
|
|
130
|
+
ctx: CommandContext[NodeContext],
|
|
131
|
+
*,
|
|
132
|
+
provider: TextSharerStr = "paste_rs",
|
|
133
|
+
num_messages: int = 1,
|
|
134
|
+
include_system: bool = False,
|
|
135
|
+
max_tokens: int | None = None,
|
|
136
|
+
format_template: str | None = None,
|
|
137
|
+
title: str | None = None,
|
|
138
|
+
syntax: str = "markdown",
|
|
139
|
+
visibility: Visibility = "unlisted",
|
|
140
|
+
) -> None:
|
|
141
|
+
"""Share text content via a text sharing provider.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
ctx: Command context
|
|
145
|
+
provider: Text sharing provider to use
|
|
146
|
+
num_messages: Number of messages from history to share (ignored if custom_content)
|
|
147
|
+
include_system: Include system messages in history
|
|
148
|
+
max_tokens: Token limit for conversation history
|
|
149
|
+
format_template: Custom format template for history
|
|
150
|
+
title: Title/filename for the shared content
|
|
151
|
+
syntax: Syntax highlighting (e.g., "python", "markdown")
|
|
152
|
+
visibility: Visibility level
|
|
153
|
+
"""
|
|
154
|
+
from anyenv.text_sharing import get_sharer
|
|
155
|
+
|
|
156
|
+
content = await ctx.context.agent.conversation.format_history(
|
|
157
|
+
num_messages=num_messages,
|
|
158
|
+
include_system=include_system,
|
|
159
|
+
max_tokens=max_tokens,
|
|
160
|
+
format_template=format_template,
|
|
161
|
+
)
|
|
162
|
+
|
|
163
|
+
if not content.strip():
|
|
164
|
+
await ctx.print("âšī¸ **No content to share**") # noqa: RUF001
|
|
165
|
+
return
|
|
166
|
+
|
|
167
|
+
try:
|
|
168
|
+
# Get the appropriate sharer
|
|
169
|
+
sharer = get_sharer(provider)
|
|
170
|
+
# Share the content
|
|
171
|
+
result = await sharer.share(content, title=title, syntax=syntax, visibility=visibility)
|
|
172
|
+
# Format success message
|
|
173
|
+
provider_name = sharer.name
|
|
174
|
+
msg_parts = [f"đ **Content shared via {provider_name}:**", f"âĸ URL: {result.url}"]
|
|
175
|
+
if result.raw_url:
|
|
176
|
+
msg_parts.append(f"âĸ Raw: {result.raw_url}")
|
|
177
|
+
if result.delete_url:
|
|
178
|
+
msg_parts.append(f"âĸ Delete: {result.delete_url}")
|
|
179
|
+
|
|
180
|
+
await ctx.print("\n".join(msg_parts))
|
|
181
|
+
|
|
182
|
+
except Exception as e:
|
|
183
|
+
msg = f"Failed to share content via {provider}: {e}"
|
|
184
|
+
raise CommandError(msg) from e
|
|
185
|
+
|
|
186
|
+
@classmethod
|
|
187
|
+
def condition(cls) -> bool:
|
|
188
|
+
"""Check if anyenv text_sharing is available."""
|
|
189
|
+
return importlib.util.find_spec("anyenv.text_sharing") is not None
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"""Tool management commands."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from slashed import CommandContext, CommandError # noqa: TC002
|
|
6
|
+
from slashed.completers import CallbackCompleter
|
|
7
|
+
|
|
8
|
+
from agentpool.agents.context import AgentContext # noqa: TC001
|
|
9
|
+
from agentpool.log import get_logger
|
|
10
|
+
from agentpool_commands.base import AgentCommand
|
|
11
|
+
from agentpool_commands.completers import get_available_agents
|
|
12
|
+
from agentpool_commands.markdown_utils import format_table
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
logger = get_logger(__name__)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class AddWorkerCommand(AgentCommand):
|
|
19
|
+
"""Add another agent as a worker tool.
|
|
20
|
+
|
|
21
|
+
Add another agent as a worker tool.
|
|
22
|
+
|
|
23
|
+
Options:
|
|
24
|
+
--reset-history Clear worker's history before each run (default: true)
|
|
25
|
+
--share-history Pass current agent's message history (default: false)
|
|
26
|
+
--share-context Share context data between agents (default: false)
|
|
27
|
+
|
|
28
|
+
Examples:
|
|
29
|
+
/add-worker specialist # Basic worker
|
|
30
|
+
/add-worker analyst --share-history # Pass conversation history
|
|
31
|
+
/add-worker helper --share-context # Share context between agents
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
name = "add-worker"
|
|
35
|
+
category = "tools"
|
|
36
|
+
|
|
37
|
+
async def execute_command(
|
|
38
|
+
self,
|
|
39
|
+
ctx: CommandContext[AgentContext],
|
|
40
|
+
worker_name: str,
|
|
41
|
+
*,
|
|
42
|
+
reset_history: str = "true",
|
|
43
|
+
share_history: str = "false",
|
|
44
|
+
) -> None:
|
|
45
|
+
"""Add another agent as a worker tool.
|
|
46
|
+
|
|
47
|
+
Args:
|
|
48
|
+
ctx: Command context
|
|
49
|
+
worker_name: Name of the agent to add as worker
|
|
50
|
+
reset_history: Clear worker's history before each run
|
|
51
|
+
share_history: Pass current agent's message history
|
|
52
|
+
"""
|
|
53
|
+
try:
|
|
54
|
+
if not ctx.context.pool:
|
|
55
|
+
msg = "No agent pool available"
|
|
56
|
+
raise CommandError(msg) # noqa: TRY301
|
|
57
|
+
|
|
58
|
+
# Get worker agent from pool
|
|
59
|
+
worker = ctx.context.pool.get_agent(worker_name)
|
|
60
|
+
|
|
61
|
+
# Parse boolean flags with defaults
|
|
62
|
+
reset_history_bool = reset_history.lower() != "false"
|
|
63
|
+
share_history_bool = share_history.lower() == "true"
|
|
64
|
+
|
|
65
|
+
# Register worker
|
|
66
|
+
tool_info = ctx.context.agent.tools.register_worker(
|
|
67
|
+
worker,
|
|
68
|
+
reset_history_on_run=reset_history_bool,
|
|
69
|
+
pass_message_history=share_history_bool,
|
|
70
|
+
parent=ctx.context.native_agent,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
await ctx.print(
|
|
74
|
+
f"â
**Added agent** `{worker_name}` **as worker tool:** `{tool_info.name}`\n"
|
|
75
|
+
f"đ§ **Tool enabled:** {tool_info.enabled}"
|
|
76
|
+
)
|
|
77
|
+
|
|
78
|
+
except KeyError as e:
|
|
79
|
+
msg = f"Agent not found: {worker_name}"
|
|
80
|
+
raise CommandError(msg) from e
|
|
81
|
+
except Exception as e:
|
|
82
|
+
msg = f"Failed to add worker: {e}"
|
|
83
|
+
raise CommandError(msg) from e
|
|
84
|
+
|
|
85
|
+
def get_completer(self) -> CallbackCompleter:
|
|
86
|
+
"""Get completer for agent names."""
|
|
87
|
+
return CallbackCompleter(get_available_agents)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
class RemoveWorkerCommand(AgentCommand):
|
|
91
|
+
"""Remove a worker tool from the current agent.
|
|
92
|
+
|
|
93
|
+
Examples:
|
|
94
|
+
/remove-worker specialist # Remove the specialist worker tool
|
|
95
|
+
"""
|
|
96
|
+
|
|
97
|
+
name = "remove-worker"
|
|
98
|
+
category = "tools"
|
|
99
|
+
|
|
100
|
+
async def execute_command(
|
|
101
|
+
self,
|
|
102
|
+
ctx: CommandContext[AgentContext],
|
|
103
|
+
worker_name: str,
|
|
104
|
+
) -> None:
|
|
105
|
+
"""Remove a worker tool.
|
|
106
|
+
|
|
107
|
+
Args:
|
|
108
|
+
ctx: Command context
|
|
109
|
+
worker_name: Name of the worker to remove
|
|
110
|
+
"""
|
|
111
|
+
tool_name = f"ask_{worker_name}" # Match the naming in to_tool
|
|
112
|
+
|
|
113
|
+
try:
|
|
114
|
+
ctx.context.agent.tools.worker_provider.remove_tool(tool_name)
|
|
115
|
+
await ctx.print(f"đī¸ **Removed worker tool:** `{tool_name}`")
|
|
116
|
+
except Exception as e:
|
|
117
|
+
msg = f"Failed to remove worker: {e}"
|
|
118
|
+
raise CommandError(msg) from e
|
|
119
|
+
|
|
120
|
+
def get_completer(self) -> CallbackCompleter:
|
|
121
|
+
"""Get completer for agent names."""
|
|
122
|
+
return CallbackCompleter(get_available_agents)
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class ListWorkersCommand(AgentCommand):
|
|
126
|
+
"""List all registered worker tools and their settings.
|
|
127
|
+
|
|
128
|
+
Shows:
|
|
129
|
+
- Worker agent name
|
|
130
|
+
- Tool name
|
|
131
|
+
- Current settings (history/context sharing)
|
|
132
|
+
- Enabled/disabled status
|
|
133
|
+
|
|
134
|
+
Example: /list-workers
|
|
135
|
+
"""
|
|
136
|
+
|
|
137
|
+
name = "list-workers"
|
|
138
|
+
category = "tools"
|
|
139
|
+
|
|
140
|
+
async def execute_command(self, ctx: CommandContext[AgentContext]) -> None:
|
|
141
|
+
"""List all worker tools.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
ctx: Command context
|
|
145
|
+
"""
|
|
146
|
+
# Filter tools by source="agent"
|
|
147
|
+
worker_tools = await ctx.context.agent.tools.worker_provider.get_tools()
|
|
148
|
+
if not worker_tools:
|
|
149
|
+
await ctx.print("âšī¸ **No worker tools registered**") # noqa: RUF001
|
|
150
|
+
return
|
|
151
|
+
|
|
152
|
+
rows = [
|
|
153
|
+
{
|
|
154
|
+
"Status": "â
" if tool_info.enabled else "â",
|
|
155
|
+
"Agent": tool_info.agent_name,
|
|
156
|
+
"Tool": tool_info.name,
|
|
157
|
+
"Description": tool_info.description or "",
|
|
158
|
+
}
|
|
159
|
+
for tool_info in worker_tools
|
|
160
|
+
]
|
|
161
|
+
headers = ["Status", "Agent", "Tool", "Description"]
|
|
162
|
+
table = format_table(headers, rows)
|
|
163
|
+
await ctx.print(f"## đĨ Registered Workers\n\n{table}")
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"""Core data models for AgentPool."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from agentpool_config.resources import ResourceInfo
|
|
6
|
+
from agentpool_config.forward_targets import ForwardingTarget
|
|
7
|
+
from agentpool_config.session import SessionQuery
|
|
8
|
+
from agentpool_config.teams import TeamConfig
|
|
9
|
+
from agentpool_config.mcp_server import (
|
|
10
|
+
BaseMCPServerConfig,
|
|
11
|
+
StdioMCPServerConfig,
|
|
12
|
+
StreamableHTTPMCPServerConfig,
|
|
13
|
+
MCPServerConfig,
|
|
14
|
+
SSEMCPServerConfig,
|
|
15
|
+
)
|
|
16
|
+
from agentpool_config.event_handlers import (
|
|
17
|
+
BaseEventHandlerConfig,
|
|
18
|
+
StdoutEventHandlerConfig,
|
|
19
|
+
CallbackEventHandlerConfig,
|
|
20
|
+
EventHandlerConfig,
|
|
21
|
+
resolve_handler_configs,
|
|
22
|
+
)
|
|
23
|
+
from agentpool_config.hooks import (
|
|
24
|
+
BaseHookConfig,
|
|
25
|
+
CallableHookConfig,
|
|
26
|
+
CommandHookConfig,
|
|
27
|
+
HookConfig,
|
|
28
|
+
HooksConfig,
|
|
29
|
+
PromptHookConfig,
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
__all__ = [
|
|
33
|
+
"BaseEventHandlerConfig",
|
|
34
|
+
"BaseHookConfig",
|
|
35
|
+
"BaseMCPServerConfig",
|
|
36
|
+
"CallableHookConfig",
|
|
37
|
+
"CallbackEventHandlerConfig",
|
|
38
|
+
"CommandHookConfig",
|
|
39
|
+
"EventHandlerConfig",
|
|
40
|
+
"ForwardingTarget",
|
|
41
|
+
"HookConfig",
|
|
42
|
+
"HooksConfig",
|
|
43
|
+
"MCPServerConfig",
|
|
44
|
+
"PromptHookConfig",
|
|
45
|
+
"ResourceInfo",
|
|
46
|
+
"SSEMCPServerConfig",
|
|
47
|
+
"SessionQuery",
|
|
48
|
+
"StdioMCPServerConfig",
|
|
49
|
+
"StdoutEventHandlerConfig",
|
|
50
|
+
"StreamableHTTPMCPServerConfig",
|
|
51
|
+
"TeamConfig",
|
|
52
|
+
"resolve_handler_configs",
|
|
53
|
+
]
|