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,301 @@
|
|
|
1
|
+
"""Condition configuration."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from collections.abc import Awaitable, Callable
|
|
6
|
+
from datetime import timedelta
|
|
7
|
+
from typing import TYPE_CHECKING, Annotated, Any, Literal, assert_never
|
|
8
|
+
|
|
9
|
+
from pydantic import ConfigDict, Field, ImportString
|
|
10
|
+
from schemez import Schema
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from agentpool.talk.registry import EventContext
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ConnectionCondition(Schema):
|
|
18
|
+
"""Base class for connection control conditions."""
|
|
19
|
+
|
|
20
|
+
type: str = Field(init=False, title="Condition type")
|
|
21
|
+
"""Discriminator for condition types."""
|
|
22
|
+
|
|
23
|
+
name: str | None = Field(
|
|
24
|
+
default=None,
|
|
25
|
+
examples=["exit_condition", "message_filter", "cost_check"],
|
|
26
|
+
title="Condition name",
|
|
27
|
+
)
|
|
28
|
+
"""Optional name for the condition for referencing."""
|
|
29
|
+
|
|
30
|
+
model_config = ConfigDict(frozen=True)
|
|
31
|
+
|
|
32
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
33
|
+
"""Check if condition is met."""
|
|
34
|
+
raise NotImplementedError
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class Jinja2Condition(ConnectionCondition):
|
|
38
|
+
"""Triggers based on Jinja2 template."""
|
|
39
|
+
|
|
40
|
+
model_config = ConfigDict(json_schema_extra={"title": "Jinja2 Template Condition"})
|
|
41
|
+
|
|
42
|
+
type: Literal["jinja2"] = Field("jinja2", init=False)
|
|
43
|
+
"""Jinja2 template-based condition."""
|
|
44
|
+
|
|
45
|
+
template: str = Field(
|
|
46
|
+
examples=[
|
|
47
|
+
"{{ ctx.stats.message_count > 10 }}",
|
|
48
|
+
"{{ 'error' in ctx.message.content }}",
|
|
49
|
+
"{{ ctx.stats.total_cost > 1.0 }}",
|
|
50
|
+
],
|
|
51
|
+
title="Jinja2 template",
|
|
52
|
+
)
|
|
53
|
+
"""Jinja2 template to evaluate."""
|
|
54
|
+
|
|
55
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
56
|
+
from jinjarope import Environment
|
|
57
|
+
|
|
58
|
+
from agentpool.utils.now import get_now
|
|
59
|
+
|
|
60
|
+
env = Environment(trim_blocks=True, lstrip_blocks=True, enable_async=True)
|
|
61
|
+
template = env.from_string(self.template)
|
|
62
|
+
result = await template.render_async(ctx=context, now=get_now())
|
|
63
|
+
return result.strip().lower() == "true" or bool(result)
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
class WordMatchCondition(ConnectionCondition):
|
|
67
|
+
"""Triggers when word/phrase is found in message."""
|
|
68
|
+
|
|
69
|
+
model_config = ConfigDict(json_schema_extra={"title": "Word Match Condition"})
|
|
70
|
+
|
|
71
|
+
type: Literal["word_match"] = Field("word_match", init=False)
|
|
72
|
+
"""Word-comparison-based condition."""
|
|
73
|
+
|
|
74
|
+
words: list[str] = Field(
|
|
75
|
+
examples=[["error", "failed"], ["complete", "done", "finished"], ["urgent"]],
|
|
76
|
+
title="Words to match",
|
|
77
|
+
)
|
|
78
|
+
"""Words or phrases to match in messages."""
|
|
79
|
+
|
|
80
|
+
case_sensitive: bool = Field(default=False, title="Case sensitive matching")
|
|
81
|
+
"""Whether to match case-sensitively."""
|
|
82
|
+
|
|
83
|
+
mode: Literal["any", "all"] = Field(
|
|
84
|
+
default="any",
|
|
85
|
+
examples=["any", "all"],
|
|
86
|
+
title="Matching mode",
|
|
87
|
+
)
|
|
88
|
+
"""Match mode:
|
|
89
|
+
- any: Trigger if any word matches
|
|
90
|
+
- all: Require all words to match
|
|
91
|
+
"""
|
|
92
|
+
|
|
93
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
94
|
+
"""Triggers if message contains specified words."""
|
|
95
|
+
text = str(context.message.content)
|
|
96
|
+
if not self.case_sensitive:
|
|
97
|
+
text = text.lower()
|
|
98
|
+
words = [w.lower() for w in self.words]
|
|
99
|
+
else:
|
|
100
|
+
words = self.words
|
|
101
|
+
|
|
102
|
+
matches = [w in text for w in words]
|
|
103
|
+
return all(matches) if self.mode == "all" else any(matches)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
class MessageCountCondition(ConnectionCondition):
|
|
107
|
+
"""Triggers after N messages."""
|
|
108
|
+
|
|
109
|
+
model_config = ConfigDict(json_schema_extra={"title": "Message Count Condition"})
|
|
110
|
+
|
|
111
|
+
type: Literal["message_count"] = Field("message_count", init=False)
|
|
112
|
+
"""Message-count-based condition."""
|
|
113
|
+
|
|
114
|
+
max_messages: int = Field(gt=0, examples=[10, 50, 100], title="Maximum message count")
|
|
115
|
+
"""Maximum number of messages before triggering."""
|
|
116
|
+
|
|
117
|
+
count_mode: Literal["total", "per_agent"] = Field(
|
|
118
|
+
default="total",
|
|
119
|
+
examples=["total", "per_agent"],
|
|
120
|
+
title="Message counting mode",
|
|
121
|
+
)
|
|
122
|
+
"""How to count messages:
|
|
123
|
+
- total: All messages in conversation
|
|
124
|
+
- per_agent: Messages from each agent separately
|
|
125
|
+
"""
|
|
126
|
+
|
|
127
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
128
|
+
"""Check if message count threshold is reached."""
|
|
129
|
+
if self.count_mode == "total":
|
|
130
|
+
return context.stats.message_count >= self.max_messages
|
|
131
|
+
|
|
132
|
+
# Count per agent
|
|
133
|
+
messages = [m for m in context.stats.messages if m.name == context.message.name]
|
|
134
|
+
return len(messages) >= self.max_messages
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class TimeCondition(ConnectionCondition):
|
|
138
|
+
"""Triggers after time period."""
|
|
139
|
+
|
|
140
|
+
model_config = ConfigDict(json_schema_extra={"title": "Time-based Condition"})
|
|
141
|
+
|
|
142
|
+
type: Literal["time"] = Field("time", init=False)
|
|
143
|
+
"""Time-based condition."""
|
|
144
|
+
|
|
145
|
+
duration: timedelta = Field(title="Duration threshold")
|
|
146
|
+
"""How long the connection should stay active."""
|
|
147
|
+
|
|
148
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
149
|
+
"""Check if time duration has elapsed."""
|
|
150
|
+
from agentpool.utils.now import get_now
|
|
151
|
+
|
|
152
|
+
elapsed = get_now() - context.stats.start_time
|
|
153
|
+
return elapsed >= self.duration
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class TokenThresholdCondition(ConnectionCondition):
|
|
157
|
+
"""Triggers after token threshold is reached."""
|
|
158
|
+
|
|
159
|
+
model_config = ConfigDict(json_schema_extra={"title": "Token Threshold Condition"})
|
|
160
|
+
|
|
161
|
+
type: Literal["token_threshold"] = Field("token_threshold", init=False)
|
|
162
|
+
"""Type discriminator."""
|
|
163
|
+
|
|
164
|
+
max_tokens: int = Field(gt=0, examples=[1000, 4000, 8000], title="Maximum token count")
|
|
165
|
+
"""Maximum number of tokens allowed."""
|
|
166
|
+
|
|
167
|
+
count_type: Literal["total", "prompt", "completion"] = Field(
|
|
168
|
+
default="total",
|
|
169
|
+
examples=["total", "prompt", "completion"],
|
|
170
|
+
title="Token counting type",
|
|
171
|
+
)
|
|
172
|
+
"""What tokens to count:
|
|
173
|
+
- total: All tokens used
|
|
174
|
+
- prompt: Only prompt tokens
|
|
175
|
+
- completion: Only completion tokens
|
|
176
|
+
"""
|
|
177
|
+
|
|
178
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
179
|
+
"""Check if token threshold is reached."""
|
|
180
|
+
if not context.message.cost_info:
|
|
181
|
+
return False
|
|
182
|
+
|
|
183
|
+
match self.count_type:
|
|
184
|
+
case "total":
|
|
185
|
+
return context.stats.token_count >= self.max_tokens
|
|
186
|
+
case "prompt":
|
|
187
|
+
return context.message.cost_info.token_usage.input_tokens >= self.max_tokens
|
|
188
|
+
case "completion":
|
|
189
|
+
return context.message.cost_info.token_usage.output_tokens >= self.max_tokens
|
|
190
|
+
case _ as unreachable:
|
|
191
|
+
assert_never(unreachable)
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
class CostCondition(ConnectionCondition):
|
|
195
|
+
"""Triggers when cost threshold is reached."""
|
|
196
|
+
|
|
197
|
+
model_config = ConfigDict(json_schema_extra={"title": "Cost Condition"})
|
|
198
|
+
|
|
199
|
+
type: Literal["cost"] = Field("cost", init=False)
|
|
200
|
+
"""Cost-based condition."""
|
|
201
|
+
|
|
202
|
+
max_cost: float = Field(gt=0.0, examples=[1.0, 5.0, 10.0], title="Maximum cost threshold")
|
|
203
|
+
"""Maximum cost in USD."""
|
|
204
|
+
|
|
205
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
206
|
+
"""Check if cost limit is reached."""
|
|
207
|
+
return context.stats.total_cost >= self.max_cost
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
class CostLimitCondition(ConnectionCondition):
|
|
211
|
+
"""Triggers when cost limit is reached."""
|
|
212
|
+
|
|
213
|
+
model_config = ConfigDict(json_schema_extra={"title": "Cost Limit Condition"})
|
|
214
|
+
|
|
215
|
+
type: Literal["cost_limit"] = Field("cost_limit", init=False)
|
|
216
|
+
"""Cost-limit condition."""
|
|
217
|
+
|
|
218
|
+
max_cost: float = Field(gt=0.0, examples=[1.0, 5.0, 10.0], title="Cost limit")
|
|
219
|
+
"""Maximum cost in USD before triggering."""
|
|
220
|
+
|
|
221
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
222
|
+
"""Check if cost limit is reached."""
|
|
223
|
+
if not context.message.cost_info:
|
|
224
|
+
return False
|
|
225
|
+
return float(context.message.cost_info.total_cost) >= self.max_cost
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
class CallableCondition(ConnectionCondition):
|
|
229
|
+
"""Custom predicate function."""
|
|
230
|
+
|
|
231
|
+
model_config = ConfigDict(json_schema_extra={"title": "Callable Condition"})
|
|
232
|
+
|
|
233
|
+
type: Literal["callable"] = Field("callable", init=False)
|
|
234
|
+
"""Condition based on an import path pointing to a predicate."""
|
|
235
|
+
|
|
236
|
+
predicate: ImportString[Callable[..., bool | Awaitable[bool]]] = Field(
|
|
237
|
+
examples=["mymodule.check_condition", "utils.predicates:is_urgent"],
|
|
238
|
+
title="Predicate function",
|
|
239
|
+
)
|
|
240
|
+
"""Function to evaluate condition:
|
|
241
|
+
Args:
|
|
242
|
+
message: Current message being processed
|
|
243
|
+
stats: Current connection statistics
|
|
244
|
+
Returns:
|
|
245
|
+
Whether condition is met
|
|
246
|
+
"""
|
|
247
|
+
|
|
248
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
249
|
+
"""Execute predicate function."""
|
|
250
|
+
from agentpool.utils.inspection import execute
|
|
251
|
+
|
|
252
|
+
return await execute(self.predicate, context.message, context.stats)
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
class AndCondition(ConnectionCondition):
|
|
256
|
+
"""Require all conditions to be met."""
|
|
257
|
+
|
|
258
|
+
model_config = ConfigDict(json_schema_extra={"title": "AND Condition"})
|
|
259
|
+
|
|
260
|
+
type: Literal["and"] = Field("and", init=False)
|
|
261
|
+
"""Condition to AND-combine multiple conditions."""
|
|
262
|
+
|
|
263
|
+
conditions: list[ConnectionCondition] = Field(title="AND conditions")
|
|
264
|
+
"""List of conditions to check."""
|
|
265
|
+
|
|
266
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
267
|
+
"""Check if all conditions are met."""
|
|
268
|
+
results = [await c.check(context) for c in self.conditions]
|
|
269
|
+
return all(results)
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
class OrCondition(ConnectionCondition):
|
|
273
|
+
"""Require any condition to be met."""
|
|
274
|
+
|
|
275
|
+
model_config = ConfigDict(json_schema_extra={"title": "OR Condition"})
|
|
276
|
+
|
|
277
|
+
type: Literal["or"] = Field("or", init=False)
|
|
278
|
+
"""Condition to OR-combine multiple conditions."""
|
|
279
|
+
|
|
280
|
+
conditions: list[ConnectionCondition] = Field(title="OR conditions")
|
|
281
|
+
"""List of conditions to check."""
|
|
282
|
+
|
|
283
|
+
async def check(self, context: EventContext[Any]) -> bool:
|
|
284
|
+
"""Check if any condition is met."""
|
|
285
|
+
results = [await c.check(context) for c in self.conditions]
|
|
286
|
+
return any(results)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
# Union type for condition validation
|
|
290
|
+
Condition = Annotated[
|
|
291
|
+
WordMatchCondition
|
|
292
|
+
| MessageCountCondition
|
|
293
|
+
| TimeCondition
|
|
294
|
+
| TokenThresholdCondition
|
|
295
|
+
| CostLimitCondition
|
|
296
|
+
| CallableCondition
|
|
297
|
+
| Jinja2Condition
|
|
298
|
+
| AndCondition
|
|
299
|
+
| OrCondition,
|
|
300
|
+
Field(discriminator="type"),
|
|
301
|
+
]
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""Converter configuration."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from docler.configs import ConverterConfig
|
|
6
|
+
from pydantic import ConfigDict, Field
|
|
7
|
+
from schemez import Schema
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ConversionConfig(Schema):
|
|
11
|
+
"""Global conversion configuration."""
|
|
12
|
+
|
|
13
|
+
providers: list[ConverterConfig] | None = Field(default=None, title="Converter providers")
|
|
14
|
+
"""List of configured converter providers."""
|
|
15
|
+
|
|
16
|
+
default_provider: str | None = Field(
|
|
17
|
+
default=None,
|
|
18
|
+
examples=["markitdown", "youtube", "whisper_api"],
|
|
19
|
+
title="Default provider",
|
|
20
|
+
)
|
|
21
|
+
"""Name of default provider for conversions."""
|
|
22
|
+
|
|
23
|
+
max_size: int | None = Field(
|
|
24
|
+
default=None,
|
|
25
|
+
examples=[1048576, 10485760, 52428800],
|
|
26
|
+
title="Global size limit",
|
|
27
|
+
)
|
|
28
|
+
"""Global size limit for all converters."""
|
|
29
|
+
|
|
30
|
+
model_config = ConfigDict(frozen=True)
|
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
"""Durable execution configuration models."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from datetime import timedelta
|
|
6
|
+
from typing import Annotated, Literal
|
|
7
|
+
|
|
8
|
+
from pydantic import ConfigDict, Field, field_validator
|
|
9
|
+
from schemez import Schema
|
|
10
|
+
|
|
11
|
+
from agentpool.utils.parse_time import parse_time_period
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
class BaseDurableExecutionConfig(Schema):
|
|
15
|
+
"""Base configuration for durable execution providers."""
|
|
16
|
+
|
|
17
|
+
model_config = ConfigDict(
|
|
18
|
+
json_schema_extra={
|
|
19
|
+
"x-icon": "octicon:sync-16",
|
|
20
|
+
"x-doc-title": "Durable Execution Configuration",
|
|
21
|
+
"title": "Base Durable Execution Configuration",
|
|
22
|
+
}
|
|
23
|
+
)
|
|
24
|
+
|
|
25
|
+
type: str = Field(init=False, title="Provider type")
|
|
26
|
+
"""Durable execution provider type discriminator."""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class TemporalActivityConfig(Schema):
|
|
30
|
+
"""Temporal activity configuration options.
|
|
31
|
+
|
|
32
|
+
Maps to temporalio.workflow.ActivityConfig.
|
|
33
|
+
"""
|
|
34
|
+
|
|
35
|
+
start_to_close_timeout: str | timedelta | None = Field(
|
|
36
|
+
default="60s",
|
|
37
|
+
title="Start to close timeout",
|
|
38
|
+
examples=["60s", "5m", "1h"],
|
|
39
|
+
)
|
|
40
|
+
"""Maximum time for a single activity execution attempt."""
|
|
41
|
+
|
|
42
|
+
schedule_to_close_timeout: str | timedelta | None = Field(
|
|
43
|
+
default=None,
|
|
44
|
+
title="Schedule to close timeout",
|
|
45
|
+
examples=["5m", "1h"],
|
|
46
|
+
)
|
|
47
|
+
"""Total time for all activity attempts including retries."""
|
|
48
|
+
|
|
49
|
+
schedule_to_start_timeout: str | timedelta | None = Field(
|
|
50
|
+
default=None,
|
|
51
|
+
title="Schedule to start timeout",
|
|
52
|
+
examples=["30s", "2m"],
|
|
53
|
+
)
|
|
54
|
+
"""Maximum time activity can wait in task queue."""
|
|
55
|
+
|
|
56
|
+
heartbeat_timeout: str | timedelta | None = Field(
|
|
57
|
+
default=None,
|
|
58
|
+
title="Heartbeat timeout",
|
|
59
|
+
examples=["10s", "30s"],
|
|
60
|
+
)
|
|
61
|
+
"""Maximum time between activity heartbeats."""
|
|
62
|
+
|
|
63
|
+
@field_validator(
|
|
64
|
+
"start_to_close_timeout",
|
|
65
|
+
"schedule_to_close_timeout",
|
|
66
|
+
"schedule_to_start_timeout",
|
|
67
|
+
"heartbeat_timeout",
|
|
68
|
+
mode="before",
|
|
69
|
+
)
|
|
70
|
+
@classmethod
|
|
71
|
+
def parse_duration(cls, v: str | timedelta | None) -> timedelta | None:
|
|
72
|
+
"""Parse string duration to timedelta."""
|
|
73
|
+
if v is None or isinstance(v, timedelta):
|
|
74
|
+
return v
|
|
75
|
+
return parse_time_period(v)
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class TemporalRetryPolicy(Schema):
|
|
79
|
+
"""Temporal retry policy configuration.
|
|
80
|
+
|
|
81
|
+
Maps to temporalio.common.RetryPolicy.
|
|
82
|
+
"""
|
|
83
|
+
|
|
84
|
+
model_config = ConfigDict(json_schema_extra={"title": "Temporal Retry Policy Configuration"})
|
|
85
|
+
|
|
86
|
+
initial_interval: str | timedelta = Field(
|
|
87
|
+
default="1s",
|
|
88
|
+
title="Initial retry interval",
|
|
89
|
+
examples=["1s", "5s", "10s"],
|
|
90
|
+
)
|
|
91
|
+
"""Initial backoff interval."""
|
|
92
|
+
|
|
93
|
+
backoff_coefficient: float = Field(
|
|
94
|
+
default=2.0,
|
|
95
|
+
ge=1.0,
|
|
96
|
+
title="Backoff coefficient",
|
|
97
|
+
)
|
|
98
|
+
"""Coefficient for exponential backoff."""
|
|
99
|
+
|
|
100
|
+
maximum_interval: str | timedelta | None = Field(
|
|
101
|
+
default=None,
|
|
102
|
+
title="Maximum interval",
|
|
103
|
+
examples=["5m", "10m"],
|
|
104
|
+
)
|
|
105
|
+
"""Maximum backoff interval."""
|
|
106
|
+
|
|
107
|
+
maximum_attempts: int = Field(
|
|
108
|
+
default=0,
|
|
109
|
+
ge=0,
|
|
110
|
+
title="Maximum attempts",
|
|
111
|
+
)
|
|
112
|
+
"""Maximum number of attempts (0 = unlimited)."""
|
|
113
|
+
|
|
114
|
+
non_retryable_error_types: list[str] = Field(
|
|
115
|
+
default_factory=list,
|
|
116
|
+
title="Non-retryable error types",
|
|
117
|
+
)
|
|
118
|
+
"""Error type names that should not be retried."""
|
|
119
|
+
|
|
120
|
+
@field_validator("initial_interval", "maximum_interval", mode="before")
|
|
121
|
+
@classmethod
|
|
122
|
+
def parse_duration(cls, v: str | timedelta | None) -> timedelta | None:
|
|
123
|
+
"""Parse string duration to timedelta."""
|
|
124
|
+
if v is None or isinstance(v, timedelta):
|
|
125
|
+
return v
|
|
126
|
+
return parse_time_period(v)
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
class TemporalDurableConfig(BaseDurableExecutionConfig):
|
|
130
|
+
"""Configuration for Temporal durable execution.
|
|
131
|
+
|
|
132
|
+
Wraps agents in TemporalAgent for workflow-based execution with
|
|
133
|
+
automatic retries and state persistence.
|
|
134
|
+
"""
|
|
135
|
+
|
|
136
|
+
model_config = ConfigDict(
|
|
137
|
+
json_schema_extra={
|
|
138
|
+
"x-icon": "simple-icons:temporal",
|
|
139
|
+
"x-doc-title": "Temporal Durable Execution",
|
|
140
|
+
"title": "Temporal Durable Execution Configuration",
|
|
141
|
+
}
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
type: Literal["temporal"] = Field("temporal", init=False)
|
|
145
|
+
"""Temporal durable execution provider."""
|
|
146
|
+
|
|
147
|
+
activity_config: TemporalActivityConfig = Field(
|
|
148
|
+
default_factory=TemporalActivityConfig,
|
|
149
|
+
title="Base activity configuration",
|
|
150
|
+
)
|
|
151
|
+
"""Base Temporal activity config for all activities."""
|
|
152
|
+
|
|
153
|
+
model_activity_config: TemporalActivityConfig | None = Field(
|
|
154
|
+
default=None,
|
|
155
|
+
title="Model activity configuration",
|
|
156
|
+
)
|
|
157
|
+
"""Activity config for model request activities (merged with base)."""
|
|
158
|
+
|
|
159
|
+
retry_policy: TemporalRetryPolicy | None = Field(
|
|
160
|
+
default=None,
|
|
161
|
+
title="Retry policy",
|
|
162
|
+
)
|
|
163
|
+
"""Retry policy for activities."""
|
|
164
|
+
|
|
165
|
+
toolset_activity_config: dict[str, TemporalActivityConfig] | None = Field(
|
|
166
|
+
default=None,
|
|
167
|
+
title="Toolset activity configurations",
|
|
168
|
+
)
|
|
169
|
+
"""Per-toolset activity configs keyed by toolset ID."""
|
|
170
|
+
|
|
171
|
+
tool_activity_config: dict[str, dict[str, TemporalActivityConfig | bool]] | None = Field(
|
|
172
|
+
default=None,
|
|
173
|
+
title="Tool activity configurations",
|
|
174
|
+
)
|
|
175
|
+
"""Per-tool activity configs: {toolset_id: {tool_name: config | False}}."""
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class PrefectTaskConfig(Schema):
|
|
179
|
+
"""Prefect task configuration options.
|
|
180
|
+
|
|
181
|
+
Maps to Prefect task decorator options.
|
|
182
|
+
"""
|
|
183
|
+
|
|
184
|
+
retries: int = Field(
|
|
185
|
+
default=0,
|
|
186
|
+
ge=0,
|
|
187
|
+
title="Maximum retries",
|
|
188
|
+
)
|
|
189
|
+
"""Maximum number of retries for the task."""
|
|
190
|
+
|
|
191
|
+
retry_delay_seconds: float | list[float] = Field(
|
|
192
|
+
default=1.0,
|
|
193
|
+
title="Retry delay",
|
|
194
|
+
)
|
|
195
|
+
"""Delay between retries (single value or list for custom backoff)."""
|
|
196
|
+
|
|
197
|
+
timeout_seconds: float | None = Field(
|
|
198
|
+
default=None,
|
|
199
|
+
title="Task timeout",
|
|
200
|
+
)
|
|
201
|
+
"""Maximum time in seconds for task completion."""
|
|
202
|
+
|
|
203
|
+
persist_result: bool = Field(
|
|
204
|
+
default=True,
|
|
205
|
+
title="Persist result",
|
|
206
|
+
)
|
|
207
|
+
"""Whether to persist task results."""
|
|
208
|
+
|
|
209
|
+
log_prints: bool = Field(
|
|
210
|
+
default=False,
|
|
211
|
+
title="Log prints",
|
|
212
|
+
)
|
|
213
|
+
"""Whether to capture print statements in task logs."""
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
class PrefectDurableConfig(BaseDurableExecutionConfig):
|
|
217
|
+
"""Configuration for Prefect durable execution.
|
|
218
|
+
|
|
219
|
+
Wraps agents in PrefectAgent for flow-based execution with
|
|
220
|
+
automatic task tracking and observability.
|
|
221
|
+
"""
|
|
222
|
+
|
|
223
|
+
model_config = ConfigDict(
|
|
224
|
+
json_schema_extra={
|
|
225
|
+
"x-icon": "simple-icons:prefect",
|
|
226
|
+
"x-doc-title": "Prefect Durable Execution",
|
|
227
|
+
}
|
|
228
|
+
)
|
|
229
|
+
|
|
230
|
+
type: Literal["prefect"] = Field("prefect", init=False)
|
|
231
|
+
"""Prefect durable execution provider."""
|
|
232
|
+
|
|
233
|
+
model_task_config: PrefectTaskConfig | None = Field(
|
|
234
|
+
default=None,
|
|
235
|
+
title="Model task configuration",
|
|
236
|
+
)
|
|
237
|
+
"""Task config for model request tasks."""
|
|
238
|
+
|
|
239
|
+
mcp_task_config: PrefectTaskConfig | None = Field(
|
|
240
|
+
default=None,
|
|
241
|
+
title="MCP task configuration",
|
|
242
|
+
)
|
|
243
|
+
"""Task config for MCP server tasks."""
|
|
244
|
+
|
|
245
|
+
tool_task_config: PrefectTaskConfig | None = Field(
|
|
246
|
+
default=None,
|
|
247
|
+
title="Default tool task configuration",
|
|
248
|
+
)
|
|
249
|
+
"""Default task config for tool calls."""
|
|
250
|
+
|
|
251
|
+
tool_task_config_by_name: dict[str, PrefectTaskConfig | None] | None = Field(
|
|
252
|
+
default=None,
|
|
253
|
+
title="Per-tool task configurations",
|
|
254
|
+
)
|
|
255
|
+
"""Per-tool task configs (None value disables task wrapping)."""
|
|
256
|
+
|
|
257
|
+
event_stream_handler_task_config: PrefectTaskConfig | None = Field(
|
|
258
|
+
default=None,
|
|
259
|
+
title="Event handler task configuration",
|
|
260
|
+
)
|
|
261
|
+
"""Task config for event stream handler."""
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class DBOSStepConfig(Schema):
|
|
265
|
+
"""DBOS step configuration options.
|
|
266
|
+
|
|
267
|
+
Maps to DBOS step decorator options.
|
|
268
|
+
"""
|
|
269
|
+
|
|
270
|
+
retries_allowed: bool = Field(
|
|
271
|
+
default=True,
|
|
272
|
+
title="Retries allowed",
|
|
273
|
+
)
|
|
274
|
+
"""Whether retries are allowed for this step."""
|
|
275
|
+
|
|
276
|
+
interval_seconds: float = Field(
|
|
277
|
+
default=1.0,
|
|
278
|
+
gt=0,
|
|
279
|
+
title="Retry interval",
|
|
280
|
+
)
|
|
281
|
+
"""Base interval between retries in seconds."""
|
|
282
|
+
|
|
283
|
+
max_attempts: int = Field(
|
|
284
|
+
default=3,
|
|
285
|
+
ge=1,
|
|
286
|
+
title="Maximum attempts",
|
|
287
|
+
)
|
|
288
|
+
"""Maximum number of attempts."""
|
|
289
|
+
|
|
290
|
+
backoff_rate: float = Field(
|
|
291
|
+
default=2.0,
|
|
292
|
+
ge=1.0,
|
|
293
|
+
title="Backoff rate",
|
|
294
|
+
)
|
|
295
|
+
"""Multiplier for exponential backoff."""
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
class DBOSDurableConfig(BaseDurableExecutionConfig):
|
|
299
|
+
"""Configuration for DBOS durable execution.
|
|
300
|
+
|
|
301
|
+
Wraps agents in DBOSAgent for step-based execution with
|
|
302
|
+
automatic checkpointing and recovery.
|
|
303
|
+
"""
|
|
304
|
+
|
|
305
|
+
model_config = ConfigDict(
|
|
306
|
+
json_schema_extra={
|
|
307
|
+
"x-icon": "octicon:database-16",
|
|
308
|
+
"x-doc-title": "DBOS Durable Execution",
|
|
309
|
+
}
|
|
310
|
+
)
|
|
311
|
+
|
|
312
|
+
type: Literal["dbos"] = Field("dbos", init=False)
|
|
313
|
+
"""DBOS durable execution provider."""
|
|
314
|
+
|
|
315
|
+
model_step_config: DBOSStepConfig | None = Field(
|
|
316
|
+
default=None,
|
|
317
|
+
title="Model step configuration",
|
|
318
|
+
)
|
|
319
|
+
"""Step config for model request steps."""
|
|
320
|
+
|
|
321
|
+
mcp_step_config: DBOSStepConfig | None = Field(
|
|
322
|
+
default=None,
|
|
323
|
+
title="MCP step configuration",
|
|
324
|
+
)
|
|
325
|
+
"""Step config for MCP server steps."""
|
|
326
|
+
|
|
327
|
+
|
|
328
|
+
DurableExecutionConfig = Annotated[
|
|
329
|
+
TemporalDurableConfig | PrefectDurableConfig | DBOSDurableConfig,
|
|
330
|
+
Field(discriminator="type"),
|
|
331
|
+
]
|