connectonion 0.6.2__py3-none-any.whl → 0.6.3__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.
- connectonion/__init__.py +46 -9
- connectonion/cli/__init__.py +11 -1
- connectonion/cli/browser_agent/__init__.py +11 -1
- connectonion/cli/browser_agent/browser.py +13 -3
- connectonion/cli/browser_agent/element_finder.py +8 -0
- connectonion/cli/browser_agent/highlight_screenshot.py +9 -1
- connectonion/cli/browser_agent/scroll.py +8 -0
- connectonion/cli/co_ai/__init__.py +6 -0
- connectonion/cli/co_ai/agent.py +87 -0
- connectonion/cli/co_ai/agents/__init__.py +5 -0
- connectonion/cli/co_ai/agents/registry.py +57 -0
- connectonion/cli/co_ai/commands/__init__.py +45 -0
- connectonion/cli/co_ai/commands/compact.py +173 -0
- connectonion/cli/co_ai/commands/cost.py +77 -0
- connectonion/cli/co_ai/commands/export.py +60 -0
- connectonion/cli/co_ai/commands/help.py +80 -0
- connectonion/cli/co_ai/commands/init.py +101 -0
- connectonion/cli/co_ai/commands/sessions.py +55 -0
- connectonion/cli/co_ai/commands/tasks.py +63 -0
- connectonion/cli/co_ai/commands/undo.py +103 -0
- connectonion/cli/co_ai/context.py +127 -0
- connectonion/cli/co_ai/main.py +52 -0
- connectonion/cli/co_ai/plugins/__init__.py +6 -0
- connectonion/cli/co_ai/plugins/reminder.py +76 -0
- connectonion/cli/co_ai/plugins/shell_approval.py +105 -0
- connectonion/cli/co_ai/prompts/agents/explore.md +79 -0
- connectonion/cli/co_ai/prompts/agents/plan.md +60 -0
- connectonion/cli/co_ai/prompts/assembler.py +303 -0
- connectonion/cli/{docs/co-vibecoding-principles-docs-contexts-all-in-one.md → co_ai/prompts/connectonion/README.md} +26 -0
- connectonion/cli/co_ai/prompts/connectonion/api.md +457 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/README.md +805 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/auth.md +46 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/browser.md +235 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/copy.md +184 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/create.md +335 -0
- connectonion/cli/co_ai/prompts/connectonion/cli/init.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/co-directory-structure.md +214 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/agent.md +1078 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/events.md +816 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/llm_do.md +256 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/max_iterations.md +362 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/models.md +641 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/plugins.md +100 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/prompts.md +122 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/tools.md +512 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/transcribe.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/concepts/trust.md +291 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/README.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/auto_debug.md +1026 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/console.md +129 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval-format.md +178 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/eval.md +230 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/exceptions.md +307 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/log.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/debug/xray.md +215 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/006-agent-address-format.md +305 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/009-why-connect-function.md +167 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/014-hook-system-design.md +510 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/018-event-api-naming.md +274 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/cli/co_ai/prompts/connectonion/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/agent_reasoning.md +62 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/atomic_tools.md +24 -0
- connectonion/cli/co_ai/prompts/connectonion/examples/load_guide.md +18 -0
- connectonion/cli/co_ai/prompts/connectonion/examples.md +0 -0
- connectonion/cli/co_ai/prompts/connectonion/hook-system-options.md +364 -0
- connectonion/cli/co_ai/prompts/connectonion/index.md +162 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/README.md +12 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/auth.md +450 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/google.md +431 -0
- connectonion/cli/co_ai/prompts/connectonion/integrations/microsoft.md +370 -0
- connectonion/cli/co_ai/prompts/connectonion/network/README.md +14 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connect.md +543 -0
- connectonion/cli/co_ai/prompts/connectonion/network/connection.md +538 -0
- connectonion/cli/co_ai/prompts/connectonion/network/deploy.md +123 -0
- connectonion/cli/co_ai/prompts/connectonion/network/host.md +1049 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/cli/co_ai/prompts/connectonion/network/protocol/announce-message.md +115 -0
- connectonion/cli/co_ai/prompts/connectonion/principles.md +124 -0
- connectonion/cli/co_ai/prompts/connectonion/quickstart.md +261 -0
- connectonion/cli/co_ai/prompts/connectonion/roadmap.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/README.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/meta-agent.md +152 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/minimal.md +105 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/playwright.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/templates/web-research.md +144 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/README.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/chat.md +181 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/divider.md +63 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/dropdown.md +83 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/footer.md +44 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/fuzzy.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/input.md +84 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/keys.md +77 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/pick.md +71 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/providers.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/tui/status_bar.md +67 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/README.md +156 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/calendar_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/eval.md +89 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/gmail_plugin.md +68 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/image_result_formatter.md +74 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/re_act.md +86 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_plugins/shell_approval.md +69 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/README.md +81 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/diff_writer.md +138 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/get_emails.md +499 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/gmail.md +135 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/google_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/memory.md +486 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/microsoft_calendar.md +106 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/outlook.md +120 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/send_email.md +403 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/shell.md +95 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/slash_command.md +96 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/terminal.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/todo_list.md +252 -0
- connectonion/cli/co_ai/prompts/connectonion/useful_tools/web_fetch.md +130 -0
- connectonion/cli/co_ai/prompts/connectonion/vibe-coding-guide.md +97 -0
- connectonion/cli/co_ai/prompts/connectonion/windows-support.md +258 -0
- connectonion/cli/co_ai/prompts/main.md +247 -0
- connectonion/cli/co_ai/prompts/reminders/plan_mode.md +34 -0
- connectonion/cli/co_ai/prompts/summarization.md +55 -0
- connectonion/cli/co_ai/prompts/tools/ask_user.md +61 -0
- connectonion/cli/co_ai/prompts/tools/background.md +57 -0
- connectonion/cli/co_ai/prompts/tools/edit.md +90 -0
- connectonion/cli/co_ai/prompts/tools/glob.md +52 -0
- connectonion/cli/co_ai/prompts/tools/grep.md +55 -0
- connectonion/cli/co_ai/prompts/tools/plan_mode.md +80 -0
- connectonion/cli/co_ai/prompts/tools/read.md +40 -0
- connectonion/cli/co_ai/prompts/tools/shell.md +67 -0
- connectonion/cli/co_ai/prompts/tools/task.md +51 -0
- connectonion/cli/co_ai/prompts/tools/todo.md +139 -0
- connectonion/cli/co_ai/prompts/tools/write.md +47 -0
- connectonion/cli/co_ai/prompts/workflow.md +89 -0
- connectonion/cli/co_ai/reminders.py +159 -0
- connectonion/cli/co_ai/sessions.py +110 -0
- connectonion/cli/co_ai/skills/__init__.py +37 -0
- connectonion/cli/co_ai/skills/builtin/commit/SKILL.md +63 -0
- connectonion/cli/co_ai/skills/builtin/review-pr/SKILL.md +76 -0
- connectonion/cli/co_ai/skills/loader.py +166 -0
- connectonion/cli/co_ai/skills/tool.py +46 -0
- connectonion/cli/co_ai/tools/__init__.py +92 -0
- connectonion/cli/co_ai/tools/ask_user.py +35 -0
- connectonion/cli/co_ai/tools/background.py +201 -0
- connectonion/cli/co_ai/tools/diff_writer.py +291 -0
- connectonion/cli/co_ai/tools/edit.py +89 -0
- connectonion/cli/co_ai/tools/glob.py +84 -0
- connectonion/cli/co_ai/tools/grep.py +158 -0
- connectonion/cli/co_ai/tools/load_guide.py +23 -0
- connectonion/cli/co_ai/tools/multi_edit.py +116 -0
- connectonion/cli/co_ai/tools/plan_mode.py +172 -0
- connectonion/cli/co_ai/tools/read.py +67 -0
- connectonion/cli/co_ai/tools/task.py +59 -0
- connectonion/cli/co_ai/tools/todo_list.py +159 -0
- connectonion/cli/co_ai/tools/write.py +126 -0
- connectonion/cli/commands/__init__.py +11 -1
- connectonion/cli/commands/ai_commands.py +34 -0
- connectonion/cli/commands/copy_commands.py +55 -6
- connectonion/cli/commands/create.py +20 -17
- connectonion/cli/commands/init.py +19 -22
- connectonion/cli/commands/project_cmd_lib.py +15 -0
- connectonion/cli/main.py +11 -0
- connectonion/console.py +15 -1
- connectonion/core/__init__.py +10 -1
- connectonion/core/agent.py +37 -16
- connectonion/core/exceptions.py +74 -0
- connectonion/core/llm.py +54 -6
- connectonion/core/tool_executor.py +32 -31
- connectonion/core/tool_factory.py +47 -10
- connectonion/debug/__init__.py +10 -1
- connectonion/debug/debug_explainer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/__init__.py +10 -1
- connectonion/debug/execution_analyzer/execution_analysis.py +5 -2
- connectonion/debug/runtime_inspector/__init__.py +10 -1
- connectonion/docs/.package-ignore +6 -0
- connectonion/docs/README.md +2036 -0
- connectonion/docs/api.md +457 -0
- connectonion/docs/archive/001-ai-agent-is-just-prompt-plus-function.md +249 -0
- connectonion/docs/archive/README.md +53 -0
- connectonion/docs/archive/archive/consolidation-plan.md +72 -0
- connectonion/docs/archive/archive/core-principles-extracted.md +239 -0
- connectonion/docs/archive/archive/master-principles.md +222 -0
- connectonion/docs/archive/archive/principles.md +293 -0
- connectonion/docs/archive/archive/simplicity-principles.md +221 -0
- connectonion/docs/archive/attack-defense-insights.md +410 -0
- connectonion/docs/archive/business-model.md +305 -0
- connectonion/docs/archive/core-principles-unified.md +190 -0
- connectonion/docs/archive/discussion-journey.md +178 -0
- connectonion/docs/archive/economic-analysis.md +323 -0
- connectonion/docs/archive/features/01-share-and-find.md +256 -0
- connectonion/docs/archive/features/02-agent-authentication.md +93 -0
- connectonion/docs/archive/features/03-test-before-trust.md +71 -0
- connectonion/docs/archive/features/06-reliability-and-offline.md +197 -0
- connectonion/docs/archive/features/README.md +46 -0
- connectonion/docs/archive/features-roadmap.md +247 -0
- connectonion/docs/archive/mcp-comparison-insights.md +215 -0
- connectonion/docs/archive/migration-strategy.md +571 -0
- connectonion/docs/archive/mini-whitepaper.md +293 -0
- connectonion/docs/archive/network-protocol.md +394 -0
- connectonion/docs/archive/semantic-revolution.md +367 -0
- connectonion/docs/archive/technical-architecture.md +453 -0
- connectonion/docs/archive/the-semantic-insight.md +207 -0
- connectonion/docs/archive/threat-model.md +164 -0
- connectonion/docs/cli/README.md +805 -0
- connectonion/docs/cli/auth.md +46 -0
- connectonion/docs/cli/browser.md +235 -0
- connectonion/docs/cli/copy.md +232 -0
- connectonion/docs/cli/create.md +335 -0
- connectonion/docs/cli/init.md +431 -0
- connectonion/docs/co-directory-structure.md +214 -0
- connectonion/docs/concepts/agent.md +1078 -0
- connectonion/docs/concepts/events.md +699 -0
- connectonion/docs/concepts/llm_do.md +256 -0
- connectonion/docs/concepts/max_iterations.md +362 -0
- connectonion/docs/concepts/models.md +641 -0
- connectonion/docs/concepts/plugins.md +100 -0
- connectonion/docs/concepts/prompts.md +122 -0
- connectonion/docs/concepts/session.md +428 -0
- connectonion/docs/concepts/tools.md +512 -0
- connectonion/docs/concepts/transcribe.md +156 -0
- connectonion/docs/concepts/trust.md +291 -0
- connectonion/docs/connectonion.md +1256 -0
- connectonion/docs/debug/README.md +18 -0
- connectonion/docs/debug/auto_debug.md +1026 -0
- connectonion/docs/debug/console.md +129 -0
- connectonion/docs/debug/eval-format.md +178 -0
- connectonion/docs/debug/eval.md +230 -0
- connectonion/docs/debug/exceptions.md +307 -0
- connectonion/docs/debug/log.md +117 -0
- connectonion/docs/debug/xray.md +215 -0
- connectonion/docs/design-decisions/001-choosing-input-method.md +202 -0
- connectonion/docs/design-decisions/002-choosing-llm-function-name.md +202 -0
- connectonion/docs/design-decisions/003-choosing-trust-keyword.md +141 -0
- connectonion/docs/design-decisions/004-cli-create-flow.md +117 -0
- connectonion/docs/design-decisions/005-designing-agent-network-protocol.md +503 -0
- connectonion/docs/design-decisions/006-agent-address-format.md +305 -0
- connectonion/docs/design-decisions/007-authentication-backend-design.md +240 -0
- connectonion/docs/design-decisions/008-naming-is-hard.md +228 -0
- connectonion/docs/design-decisions/009-why-connect-function.md +167 -0
- connectonion/docs/design-decisions/010-cli-ux-progressive-disclosure.md +176 -0
- connectonion/docs/design-decisions/011-global-config-identity-management.md +357 -0
- connectonion/docs/design-decisions/012-tool-execution-separation.md +259 -0
- connectonion/docs/design-decisions/013-debug-and-logging-design.md +253 -0
- connectonion/docs/design-decisions/014-hook-system-design.md +510 -0
- connectonion/docs/design-decisions/015-interactive-auto-debug-design.md +837 -0
- connectonion/docs/design-decisions/016-why-no-zero-knowledge-proofs.md +358 -0
- connectonion/docs/design-decisions/017-session-logging-and-eval-format.md +120 -0
- connectonion/docs/design-decisions/018-event-api-naming.md +274 -0
- connectonion/docs/design-decisions/019-agent-lifecycle-design.md +655 -0
- connectonion/docs/design-decisions/020-trust-system-and-network-architecture.md +503 -0
- connectonion/docs/design-decisions/021-task-storage-jsonl-design.md +496 -0
- connectonion/docs/design-decisions/022-raw-asgi-implementation.md +273 -0
- connectonion/docs/examples.md +0 -0
- connectonion/docs/hook-system-options.md +364 -0
- connectonion/docs/integrations/README.md +12 -0
- connectonion/docs/integrations/auth.md +450 -0
- connectonion/docs/integrations/google.md +431 -0
- connectonion/docs/integrations/microsoft.md +370 -0
- connectonion/docs/network/README.md +14 -0
- connectonion/docs/network/connect.md +629 -0
- connectonion/docs/network/deploy.md +124 -0
- connectonion/docs/network/host.md +1087 -0
- connectonion/docs/network/io.md +538 -0
- connectonion/docs/network/protocol/agent-relay-protocol.md +495 -0
- connectonion/docs/network/protocol/announce-message.md +115 -0
- connectonion/docs/principles.md +124 -0
- connectonion/docs/quickstart.md +261 -0
- connectonion/docs/roadmap.md +81 -0
- connectonion/docs/templates/README.md +77 -0
- connectonion/docs/templates/meta-agent.md +152 -0
- connectonion/docs/templates/minimal.md +105 -0
- connectonion/docs/templates/playwright.md +130 -0
- connectonion/docs/templates/web-research.md +144 -0
- connectonion/docs/tui/README.md +95 -0
- connectonion/docs/tui/chat.md +181 -0
- connectonion/docs/tui/divider.md +63 -0
- connectonion/docs/tui/dropdown.md +83 -0
- connectonion/docs/tui/footer.md +44 -0
- connectonion/docs/tui/fuzzy.md +68 -0
- connectonion/docs/tui/input.md +84 -0
- connectonion/docs/tui/keys.md +77 -0
- connectonion/docs/tui/pick.md +71 -0
- connectonion/docs/tui/providers.md +89 -0
- connectonion/docs/tui/status_bar.md +67 -0
- connectonion/docs/useful_plugins/README.md +160 -0
- connectonion/docs/useful_plugins/calendar_plugin.md +68 -0
- connectonion/docs/useful_plugins/eval.md +89 -0
- connectonion/docs/useful_plugins/gmail_plugin.md +68 -0
- connectonion/docs/useful_plugins/image_result_formatter.md +74 -0
- connectonion/docs/useful_plugins/re_act.md +86 -0
- connectonion/docs/useful_plugins/shell_approval.md +69 -0
- connectonion/docs/useful_plugins/system_reminder.md +210 -0
- connectonion/docs/useful_prompts/README.md +127 -0
- connectonion/docs/useful_prompts/coding_agent.md +214 -0
- connectonion/docs/useful_tools/README.md +81 -0
- connectonion/docs/useful_tools/ask_user.md +103 -0
- connectonion/docs/useful_tools/diff_writer.md +158 -0
- connectonion/docs/useful_tools/get_emails.md +519 -0
- connectonion/docs/useful_tools/gmail.md +155 -0
- connectonion/docs/useful_tools/google_calendar.md +126 -0
- connectonion/docs/useful_tools/memory.md +506 -0
- connectonion/docs/useful_tools/microsoft_calendar.md +126 -0
- connectonion/docs/useful_tools/outlook.md +140 -0
- connectonion/docs/useful_tools/send_email.md +423 -0
- connectonion/docs/useful_tools/shell.md +115 -0
- connectonion/docs/useful_tools/slash_command.md +116 -0
- connectonion/docs/useful_tools/terminal.md +115 -0
- connectonion/docs/useful_tools/todo_list.md +272 -0
- connectonion/docs/useful_tools/web_fetch.md +150 -0
- connectonion/docs/vibe-coding-guide.md +97 -0
- connectonion/docs/windows-support.md +258 -0
- connectonion/logger.py +3 -3
- connectonion/network/__init__.py +19 -6
- connectonion/network/asgi/__init__.py +81 -0
- connectonion/network/asgi/http.py +205 -0
- connectonion/network/asgi/websocket.py +217 -0
- connectonion/network/connect.py +232 -185
- connectonion/network/host/__init__.py +59 -0
- connectonion/network/host/auth.py +191 -0
- connectonion/network/host/routes.py +135 -0
- connectonion/network/host/server.py +289 -0
- connectonion/network/host/session.py +78 -0
- connectonion/network/io/__init__.py +21 -0
- connectonion/network/{connection.py → io/base.py} +17 -42
- connectonion/network/io/websocket.py +55 -0
- connectonion/network/relay.py +37 -16
- connectonion/network/trust/__init__.py +30 -0
- connectonion/network/trust/factory.py +138 -0
- connectonion/network/{trust_agents.py → trust/prompts.py} +3 -3
- connectonion/network/{trust_functions.py → trust/tools.py} +2 -2
- connectonion/prompt_files/__init__.py +11 -1
- connectonion/prompt_files/react_acknowledge.md +26 -0
- connectonion/prompts.py +10 -1
- connectonion/tui/chat.py +10 -1
- connectonion/tui/divider.py +10 -1
- connectonion/tui/dropdown.py +10 -1
- connectonion/tui/footer.py +8 -0
- connectonion/tui/fuzzy.py +11 -1
- connectonion/tui/input.py +118 -70
- connectonion/tui/keys.py +133 -6
- connectonion/tui/providers.py +11 -1
- connectonion/tui/status_bar.py +10 -1
- connectonion/useful_events_handlers/__init__.py +8 -0
- connectonion/useful_events_handlers/reflect.py +19 -4
- connectonion/useful_plugins/__init__.py +2 -1
- connectonion/useful_plugins/eval.py +2 -2
- connectonion/useful_plugins/gmail_plugin.py +3 -3
- connectonion/useful_plugins/image_result_formatter.py +3 -3
- connectonion/useful_plugins/re_act.py +114 -28
- connectonion/useful_plugins/shell_approval.py +2 -2
- connectonion/useful_plugins/system_reminder.py +103 -0
- connectonion/useful_plugins/ui_stream.py +18 -133
- connectonion/useful_prompts/README.md +61 -0
- connectonion/useful_prompts/__init__.py +45 -0
- connectonion/useful_prompts/coding_agent/README.md +106 -0
- connectonion/useful_prompts/coding_agent/assembler.py +123 -0
- connectonion/useful_prompts/coding_agent/prompts/main.md +227 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/ask_user.md +61 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/background.md +57 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/edit.md +90 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/glob.md +52 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/grep.md +55 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/plan_mode.md +80 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/read.md +40 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/shell.md +67 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/task.md +51 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/todo.md +139 -0
- connectonion/useful_prompts/coding_agent/prompts/tools/write.md +48 -0
- connectonion/useful_prompts/system-reminders/security-warning.md +14 -0
- connectonion/useful_prompts/system-reminders/test-reminder.md +11 -0
- connectonion/useful_tools/__init__.py +31 -4
- connectonion/useful_tools/ask_user.py +35 -0
- connectonion/useful_tools/bash.py +69 -0
- connectonion/useful_tools/diff_writer.py +186 -94
- connectonion/useful_tools/edit.py +102 -0
- connectonion/useful_tools/glob_files.py +97 -0
- connectonion/useful_tools/grep_files.py +171 -0
- connectonion/useful_tools/multi_edit.py +116 -0
- connectonion/useful_tools/read_file.py +73 -0
- connectonion/useful_tools/shell.py +50 -45
- connectonion/useful_tools/write_file.py +129 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/METADATA +10 -3
- connectonion-0.6.3.dist-info/RECORD +469 -0
- connectonion/network/asgi.py +0 -407
- connectonion/network/host.py +0 -616
- connectonion/network/trust.py +0 -166
- connectonion-0.6.2.dist-info/RECORD +0 -129
- /connectonion/cli/{docs → co_ai/prompts/connectonion}/connectonion.md +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/WHEEL +0 -0
- {connectonion-0.6.2.dist-info → connectonion-0.6.3.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
# Connect to Remote Agents
|
|
2
|
+
|
|
3
|
+
> Use any agent, anywhere, as if it were local.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Quick Start (60 Seconds)
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
from connectonion import connect
|
|
11
|
+
|
|
12
|
+
# Connect to a remote agent
|
|
13
|
+
remote_agent = connect("0x3d4017c3e843895a92b70aa74d1b7ebc9c982ccf2ec4968cc0cd55f12af4660c")
|
|
14
|
+
|
|
15
|
+
# Use it like a local agent
|
|
16
|
+
result = remote_agent.input("Search for Python documentation")
|
|
17
|
+
print(result)
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
**Output:**
|
|
21
|
+
```
|
|
22
|
+
I found extensive Python documentation at docs.python.org covering tutorials,
|
|
23
|
+
library reference, and language specifications.
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
**That's it.** Use remote agents with one function call.
|
|
27
|
+
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
## What Just Happened?
|
|
31
|
+
|
|
32
|
+
When you called `connect(address)`:
|
|
33
|
+
|
|
34
|
+
1. **Created proxy agent** → Acts like a local Agent instance
|
|
35
|
+
2. **Connected to relay** → WebSocket at `wss://oo.openonion.ai/ws/announce`
|
|
36
|
+
3. **Sent INPUT message** → Routed to the remote agent
|
|
37
|
+
4. **Received OUTPUT** → Got the result back
|
|
38
|
+
|
|
39
|
+
All of this happens transparently. The remote agent looks and acts like a local one.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Complete Example
|
|
44
|
+
|
|
45
|
+
### Terminal 1: Start a Serving Agent
|
|
46
|
+
|
|
47
|
+
```python
|
|
48
|
+
# serve_agent.py
|
|
49
|
+
from connectonion import Agent, host
|
|
50
|
+
|
|
51
|
+
def calculate(expression: str) -> str:
|
|
52
|
+
"""Perform calculations."""
|
|
53
|
+
return str(eval(expression))
|
|
54
|
+
|
|
55
|
+
def get_weather(city: str) -> str:
|
|
56
|
+
"""Get weather information."""
|
|
57
|
+
return f"Weather in {city}: Sunny, 72°F"
|
|
58
|
+
|
|
59
|
+
agent = Agent(
|
|
60
|
+
"assistant",
|
|
61
|
+
tools=[calculate, get_weather],
|
|
62
|
+
system_prompt="You are a helpful assistant."
|
|
63
|
+
)
|
|
64
|
+
|
|
65
|
+
print("Starting agent...")
|
|
66
|
+
host(agent) # HTTP server + P2P relay
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
**Output:**
|
|
70
|
+
```
|
|
71
|
+
Starting agent...
|
|
72
|
+
╭──────────── Agent 'assistant' ────────────╮
|
|
73
|
+
│ POST http://localhost:8000/input │
|
|
74
|
+
│ Address: 0x7a8f9d4c... │
|
|
75
|
+
│ Relay: wss://oo.openonion.ai/ws/announce│
|
|
76
|
+
╰───────────────────────────────────────────╯
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Terminal 2: Connect and Use
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# use_agent.py
|
|
83
|
+
from connectonion import connect
|
|
84
|
+
|
|
85
|
+
# Connect using the agent's address
|
|
86
|
+
assistant = connect("0x7a8f9d4c2b1e3f5a6c8d9e0f1a2b3c4d5e6f7a8b9c0d1e2f3a4b5c6d7e8f9a0b")
|
|
87
|
+
|
|
88
|
+
# Use it
|
|
89
|
+
result1 = assistant.input("What is 42 * 17?")
|
|
90
|
+
print(result1)
|
|
91
|
+
# Output: The result of 42 * 17 is 714.
|
|
92
|
+
|
|
93
|
+
result2 = assistant.input("What's the weather in Seattle?")
|
|
94
|
+
print(result2)
|
|
95
|
+
# Output: Weather in Seattle: Sunny, 72°F
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## API Reference
|
|
101
|
+
|
|
102
|
+
### connect(agent_address, keys, relay_url)
|
|
103
|
+
|
|
104
|
+
Connect to a remote serving agent.
|
|
105
|
+
|
|
106
|
+
**Parameters:**
|
|
107
|
+
- `agent_address` (str, required): Ed25519 public key of the remote agent (hex format with 0x prefix)
|
|
108
|
+
- `keys` (dict, optional): Signing keys from `address.load()` - required for `trust="strict"` agents
|
|
109
|
+
- `relay_url` (str, optional): Relay server URL. Defaults to `"wss://oo.openonion.ai/ws/announce"`
|
|
110
|
+
|
|
111
|
+
**Returns:**
|
|
112
|
+
- `RemoteAgent`: Proxy object that behaves like a local Agent
|
|
113
|
+
|
|
114
|
+
**Example:**
|
|
115
|
+
```python
|
|
116
|
+
from connectonion import connect, address
|
|
117
|
+
|
|
118
|
+
# Connect with default relay
|
|
119
|
+
agent = connect("0x7a8f...")
|
|
120
|
+
|
|
121
|
+
# Connect with signing (for strict trust agents)
|
|
122
|
+
keys = address.load(Path(".co"))
|
|
123
|
+
agent = connect("0x7a8f...", keys=keys)
|
|
124
|
+
|
|
125
|
+
# Connect with custom relay
|
|
126
|
+
agent = connect("0x7a8f...", relay_url="ws://localhost:8000/ws/announce")
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
### RemoteAgent Methods
|
|
130
|
+
|
|
131
|
+
**`input(prompt, timeout=30.0)`** - Sync version (standard Python scripts)
|
|
132
|
+
```python
|
|
133
|
+
result = agent.input("Hello")
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**`input_async(prompt, timeout=30.0)`** - Async version (Jupyter notebooks, async code)
|
|
137
|
+
```python
|
|
138
|
+
result = await agent.input_async("Hello")
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
**`reset_conversation()`** - Clear session and start fresh
|
|
142
|
+
```python
|
|
143
|
+
agent.reset_conversation()
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
> **Note:** `input()` cannot be used inside async contexts (Jupyter notebooks, async functions).
|
|
147
|
+
> Use `await agent.input_async()` instead. You'll get a clear error message if you try.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Using Remote Agents
|
|
152
|
+
|
|
153
|
+
Once connected, remote agents work exactly like local ones:
|
|
154
|
+
|
|
155
|
+
### Single Task
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
remote = connect("0x7a8f...")
|
|
159
|
+
|
|
160
|
+
result = remote.input("Translate 'hello' to Spanish")
|
|
161
|
+
print(result)
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Multi-Turn Conversation
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
remote = connect("0x7a8f...")
|
|
168
|
+
|
|
169
|
+
# Turn 1
|
|
170
|
+
response1 = remote.input("Calculate 100 + 50")
|
|
171
|
+
# "The result is 150"
|
|
172
|
+
|
|
173
|
+
# Turn 2 - remembers context
|
|
174
|
+
response2 = remote.input("Multiply that by 2")
|
|
175
|
+
# "The result is 300"
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
The remote agent maintains conversation state across multiple `input()` calls.
|
|
179
|
+
|
|
180
|
+
---
|
|
181
|
+
|
|
182
|
+
## How It Works
|
|
183
|
+
|
|
184
|
+
### Message Flow
|
|
185
|
+
|
|
186
|
+
```
|
|
187
|
+
Your Code Relay Server Remote Agent
|
|
188
|
+
| | |
|
|
189
|
+
|-- INPUT ----------->| |
|
|
190
|
+
| |-- INPUT ------------>|
|
|
191
|
+
| | |
|
|
192
|
+
| | [Process task]
|
|
193
|
+
| | |
|
|
194
|
+
| |<-- OUTPUT -----------|
|
|
195
|
+
|<-- OUTPUT ----------| |
|
|
196
|
+
| | |
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
### Under the Hood
|
|
200
|
+
|
|
201
|
+
```python
|
|
202
|
+
# What connect() does internally
|
|
203
|
+
def connect(agent_address, relay_url=DEFAULT_RELAY):
|
|
204
|
+
# 1. Create WebSocket connection to relay
|
|
205
|
+
ws = websocket.create_connection(relay_url)
|
|
206
|
+
|
|
207
|
+
# 2. Return proxy that forwards input() calls
|
|
208
|
+
class RemoteAgent:
|
|
209
|
+
def input(self, prompt):
|
|
210
|
+
# Send INPUT message
|
|
211
|
+
msg = {
|
|
212
|
+
"type": "INPUT",
|
|
213
|
+
"to": agent_address,
|
|
214
|
+
"task": prompt
|
|
215
|
+
}
|
|
216
|
+
ws.send(json.dumps(msg))
|
|
217
|
+
|
|
218
|
+
# Wait for OUTPUT response
|
|
219
|
+
response = ws.recv()
|
|
220
|
+
return json.loads(response)["result"]
|
|
221
|
+
|
|
222
|
+
return RemoteAgent()
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
---
|
|
226
|
+
|
|
227
|
+
## Configuration
|
|
228
|
+
|
|
229
|
+
### Default Relay (Production)
|
|
230
|
+
|
|
231
|
+
```python
|
|
232
|
+
# Uses wss://oo.openonion.ai/ws/announce by default
|
|
233
|
+
agent = connect("0x7a8f...")
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
### Local Relay (Development)
|
|
237
|
+
|
|
238
|
+
```python
|
|
239
|
+
# Connect to local relay server
|
|
240
|
+
agent = connect("0x7a8f...", relay_url="ws://localhost:8000/ws/announce")
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Environment-Based
|
|
244
|
+
|
|
245
|
+
```python
|
|
246
|
+
import os
|
|
247
|
+
|
|
248
|
+
relay_url = os.getenv(
|
|
249
|
+
"RELAY_URL",
|
|
250
|
+
"wss://oo.openonion.ai/ws/announce"
|
|
251
|
+
)
|
|
252
|
+
|
|
253
|
+
agent = connect("0x7a8f...", relay_url=relay_url)
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
---
|
|
257
|
+
|
|
258
|
+
## Common Patterns
|
|
259
|
+
|
|
260
|
+
### 1. Connect to Multiple Agents
|
|
261
|
+
|
|
262
|
+
```python
|
|
263
|
+
from connectonion import connect
|
|
264
|
+
|
|
265
|
+
# Connect to specialized agents
|
|
266
|
+
searcher = connect("0xaaa...")
|
|
267
|
+
writer = connect("0xbbb...")
|
|
268
|
+
reviewer = connect("0xccc...")
|
|
269
|
+
|
|
270
|
+
# Use them together
|
|
271
|
+
research = searcher.input("Research AI trends")
|
|
272
|
+
draft = writer.input(f"Write article about: {research}")
|
|
273
|
+
final = reviewer.input(f"Review and improve: {draft}")
|
|
274
|
+
|
|
275
|
+
print(final)
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### 2. Retry on Connection Failure
|
|
279
|
+
|
|
280
|
+
```python
|
|
281
|
+
import time
|
|
282
|
+
from connectonion import connect
|
|
283
|
+
|
|
284
|
+
def connect_with_retry(address, max_retries=3):
|
|
285
|
+
for attempt in range(max_retries):
|
|
286
|
+
try:
|
|
287
|
+
return connect(address)
|
|
288
|
+
except Exception as e:
|
|
289
|
+
if attempt < max_retries - 1:
|
|
290
|
+
print(f"Connection failed, retrying... ({attempt + 1}/{max_retries})")
|
|
291
|
+
time.sleep(2)
|
|
292
|
+
else:
|
|
293
|
+
raise
|
|
294
|
+
|
|
295
|
+
agent = connect_with_retry("0x7a8f...")
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
### 3. Agent Pool
|
|
299
|
+
|
|
300
|
+
```python
|
|
301
|
+
from connectonion import connect
|
|
302
|
+
|
|
303
|
+
# Pool of identical agents for load balancing
|
|
304
|
+
agent_addresses = [
|
|
305
|
+
"0xaaa...",
|
|
306
|
+
"0xbbb...",
|
|
307
|
+
"0xccc..."
|
|
308
|
+
]
|
|
309
|
+
|
|
310
|
+
agents = [connect(addr) for addr in agent_addresses]
|
|
311
|
+
|
|
312
|
+
# Simple round-robin
|
|
313
|
+
def get_agent():
|
|
314
|
+
agent = agents.pop(0)
|
|
315
|
+
agents.append(agent)
|
|
316
|
+
return agent
|
|
317
|
+
|
|
318
|
+
# Use different agent each time
|
|
319
|
+
result1 = get_agent().input("Task 1")
|
|
320
|
+
result2 = get_agent().input("Task 2")
|
|
321
|
+
result3 = get_agent().input("Task 3")
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
---
|
|
325
|
+
|
|
326
|
+
## Real-World Example: Distributed Workflow
|
|
327
|
+
|
|
328
|
+
```python
|
|
329
|
+
from connectonion import Agent, connect
|
|
330
|
+
|
|
331
|
+
# Local orchestrator agent
|
|
332
|
+
def run_workflow(task: str) -> str:
|
|
333
|
+
"""Run distributed workflow."""
|
|
334
|
+
|
|
335
|
+
# Connect to remote specialized agents
|
|
336
|
+
researcher = connect("0xaaa...")
|
|
337
|
+
analyst = connect("0xbbb...")
|
|
338
|
+
writer = connect("0xccc...")
|
|
339
|
+
|
|
340
|
+
# Step 1: Research
|
|
341
|
+
research = researcher.input(f"Research: {task}")
|
|
342
|
+
|
|
343
|
+
# Step 2: Analyze
|
|
344
|
+
analysis = analyst.input(f"Analyze this data: {research}")
|
|
345
|
+
|
|
346
|
+
# Step 3: Write report
|
|
347
|
+
report = writer.input(f"Write report based on: {analysis}")
|
|
348
|
+
|
|
349
|
+
return report
|
|
350
|
+
|
|
351
|
+
# Local agent with access to remote agents via tool
|
|
352
|
+
orchestrator = Agent("orchestrator", tools=[run_workflow])
|
|
353
|
+
|
|
354
|
+
# User just talks to local agent, it uses remote ones automatically
|
|
355
|
+
result = orchestrator.input("Create a report on AI market trends")
|
|
356
|
+
print(result)
|
|
357
|
+
```
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## Testing
|
|
362
|
+
|
|
363
|
+
### Test Remote Connection
|
|
364
|
+
|
|
365
|
+
```python
|
|
366
|
+
from connectonion import connect
|
|
367
|
+
|
|
368
|
+
def test_connection(address):
|
|
369
|
+
"""Test if remote agent is reachable."""
|
|
370
|
+
try:
|
|
371
|
+
agent = connect(address)
|
|
372
|
+
response = agent.input("ping")
|
|
373
|
+
print(f"✓ Connected to {address}")
|
|
374
|
+
print(f"Response: {response}")
|
|
375
|
+
return True
|
|
376
|
+
except Exception as e:
|
|
377
|
+
print(f"✗ Failed to connect to {address}")
|
|
378
|
+
print(f"Error: {e}")
|
|
379
|
+
return False
|
|
380
|
+
|
|
381
|
+
# Test
|
|
382
|
+
test_connection("0x7a8f...")
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
### Integration Test
|
|
386
|
+
|
|
387
|
+
```python
|
|
388
|
+
import pytest
|
|
389
|
+
from connectonion import Agent, connect, host
|
|
390
|
+
import threading
|
|
391
|
+
import time
|
|
392
|
+
|
|
393
|
+
def test_network_connection():
|
|
394
|
+
"""Test serving and connecting to an agent."""
|
|
395
|
+
|
|
396
|
+
# Create and serve agent in background
|
|
397
|
+
def serve():
|
|
398
|
+
agent = Agent("test", tools=[lambda x: f"Echo: {x}"])
|
|
399
|
+
host(agent, relay_url="ws://localhost:8000/ws/announce")
|
|
400
|
+
|
|
401
|
+
thread = threading.Thread(target=serve, daemon=True)
|
|
402
|
+
thread.start()
|
|
403
|
+
|
|
404
|
+
# Wait for agent to start
|
|
405
|
+
time.sleep(2)
|
|
406
|
+
|
|
407
|
+
# Connect and test
|
|
408
|
+
remote = connect(
|
|
409
|
+
"0x...", # Agent's public key
|
|
410
|
+
relay_url="ws://localhost:8000/ws/announce"
|
|
411
|
+
)
|
|
412
|
+
|
|
413
|
+
result = remote.input("test message")
|
|
414
|
+
assert "Echo: test message" in result
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## Error Handling
|
|
420
|
+
|
|
421
|
+
### Agent Not Found
|
|
422
|
+
|
|
423
|
+
```python
|
|
424
|
+
from connectonion import connect
|
|
425
|
+
|
|
426
|
+
try:
|
|
427
|
+
agent = connect("0xinvalid...")
|
|
428
|
+
except Exception as e:
|
|
429
|
+
print(f"Agent not found: {e}")
|
|
430
|
+
# Handle: maybe agent is offline, try later
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
### Connection Timeout
|
|
434
|
+
|
|
435
|
+
```python
|
|
436
|
+
import socket
|
|
437
|
+
|
|
438
|
+
try:
|
|
439
|
+
agent = connect("0x7a8f...", relay_url="ws://unreachable:8000/ws/announce")
|
|
440
|
+
except socket.timeout:
|
|
441
|
+
print("Connection timed out")
|
|
442
|
+
# Handle: use backup relay or local fallback
|
|
443
|
+
```
|
|
444
|
+
|
|
445
|
+
### Network Errors
|
|
446
|
+
|
|
447
|
+
```python
|
|
448
|
+
from connectonion import connect
|
|
449
|
+
|
|
450
|
+
def safe_connect(address):
|
|
451
|
+
"""Connect with error handling."""
|
|
452
|
+
try:
|
|
453
|
+
return connect(address)
|
|
454
|
+
except ConnectionError:
|
|
455
|
+
print("Network error, using local agent instead")
|
|
456
|
+
from connectonion import Agent
|
|
457
|
+
return Agent("fallback", tools=[...])
|
|
458
|
+
|
|
459
|
+
agent = safe_connect("0x7a8f...")
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
---
|
|
463
|
+
|
|
464
|
+
## Comparison: Local vs Remote
|
|
465
|
+
|
|
466
|
+
### Local Agent
|
|
467
|
+
|
|
468
|
+
```python
|
|
469
|
+
from connectonion import Agent
|
|
470
|
+
|
|
471
|
+
# Create local agent
|
|
472
|
+
agent = Agent("local", tools=[search, calculate])
|
|
473
|
+
|
|
474
|
+
# Use it
|
|
475
|
+
result = agent.input("Search and calculate")
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
**Pros:**
|
|
479
|
+
- No network latency
|
|
480
|
+
- Works offline
|
|
481
|
+
- Full control
|
|
482
|
+
|
|
483
|
+
**Cons:**
|
|
484
|
+
- Limited to one machine
|
|
485
|
+
- No sharing
|
|
486
|
+
- Scales vertically only
|
|
487
|
+
|
|
488
|
+
### Remote Agent
|
|
489
|
+
|
|
490
|
+
```python
|
|
491
|
+
from connectonion import connect
|
|
492
|
+
|
|
493
|
+
# Connect to remote agent
|
|
494
|
+
agent = connect("0x7a8f...")
|
|
495
|
+
|
|
496
|
+
# Use it
|
|
497
|
+
result = agent.input("Search and calculate")
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
**Pros:**
|
|
501
|
+
- Access from anywhere
|
|
502
|
+
- Share across team
|
|
503
|
+
- Scales horizontally
|
|
504
|
+
- Specialized agents
|
|
505
|
+
|
|
506
|
+
**Cons:**
|
|
507
|
+
- Network latency
|
|
508
|
+
- Requires connectivity
|
|
509
|
+
- Depends on remote availability
|
|
510
|
+
|
|
511
|
+
---
|
|
512
|
+
|
|
513
|
+
## Learn More
|
|
514
|
+
|
|
515
|
+
- **[host.md](host.md)** - Make your agents network-accessible with `host()`
|
|
516
|
+
- **[Agent](concepts/agent.md)** - Core Agent documentation
|
|
517
|
+
- **[protocol/agent-relay-protocol.md](protocol/agent-relay-protocol.md)** - Protocol specification
|
|
518
|
+
|
|
519
|
+
---
|
|
520
|
+
|
|
521
|
+
## Summary
|
|
522
|
+
|
|
523
|
+
`connect(address)` creates a proxy to a remote agent:
|
|
524
|
+
|
|
525
|
+
- **One function call** - `connect("0x7a8f...")`
|
|
526
|
+
- **Works like local agents** - Same `.input()` interface
|
|
527
|
+
- **Automatic relay connection** - Defaults to `wss://oo.openonion.ai/ws/announce`
|
|
528
|
+
- **Multi-turn conversations** - Remote agent maintains state
|
|
529
|
+
- **Zero configuration** - Just provide the address
|
|
530
|
+
|
|
531
|
+
**Simple case:**
|
|
532
|
+
```python
|
|
533
|
+
agent = connect("0x7a8f...")
|
|
534
|
+
result = agent.input("task")
|
|
535
|
+
```
|
|
536
|
+
|
|
537
|
+
**Custom relay:**
|
|
538
|
+
```python
|
|
539
|
+
agent = connect("0x7a8f...", relay_url="ws://localhost:8000/ws/announce")
|
|
540
|
+
result = agent.input("task")
|
|
541
|
+
```
|
|
542
|
+
|
|
543
|
+
That's it. Now go use remote agents as if they were local.
|