connectonion 0.5.10__tar.gz → 0.6.0__tar.gz

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.
Files changed (139) hide show
  1. {connectonion-0.5.10 → connectonion-0.6.0}/PKG-INFO +4 -3
  2. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/__init__.py +16 -16
  3. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/copy_commands.py +24 -1
  4. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/deploy_commands.py +15 -0
  5. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/project_cmd_lib.py +1 -1
  6. connectonion-0.6.0/connectonion/core/__init__.py +53 -0
  7. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/agent.py +5 -5
  8. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/tool_executor.py +3 -2
  9. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/tool_factory.py +3 -1
  10. connectonion-0.6.0/connectonion/debug/__init__.py +51 -0
  11. connectonion-0.5.10/connectonion/interactive_debugger.py → connectonion-0.6.0/connectonion/debug/auto_debug.py +7 -7
  12. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/auto_debug_exception.py +3 -3
  13. connectonion-0.5.10/connectonion/debugger_ui.py → connectonion-0.6.0/connectonion/debug/auto_debug_ui.py +1 -1
  14. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/debug_explainer/explain_agent.py +1 -1
  15. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/debug_explainer/explain_context.py +1 -1
  16. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/execution_analyzer/execution_analysis.py +1 -1
  17. connectonion-0.6.0/connectonion/debug/runtime_inspector/__init__.py +13 -0
  18. {connectonion-0.5.10/connectonion/debug_agent → connectonion-0.6.0/connectonion/debug/runtime_inspector}/agent.py +1 -1
  19. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/xray.py +1 -1
  20. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/llm_do.py +1 -1
  21. connectonion-0.6.0/connectonion/network/__init__.py +34 -0
  22. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/announce.py +1 -1
  23. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/connect.py +1 -1
  24. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/host.py +24 -6
  25. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/trust.py +1 -1
  26. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/__init__.py +22 -0
  27. connectonion-0.6.0/connectonion/tui/chat.py +647 -0
  28. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_events_handlers/reflect.py +2 -2
  29. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/calendar_plugin.py +2 -2
  30. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/eval.py +2 -2
  31. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/gmail_plugin.py +2 -2
  32. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/image_result_formatter.py +2 -2
  33. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/re_act.py +2 -2
  34. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/shell_approval.py +2 -2
  35. connectonion-0.6.0/docs/tui/README.md +95 -0
  36. {connectonion-0.5.10 → connectonion-0.6.0}/pyproject.toml +4 -2
  37. connectonion-0.5.10/connectonion/debug_agent/__init__.py +0 -13
  38. connectonion-0.5.10/docs/tui/README.md +0 -56
  39. {connectonion-0.5.10 → connectonion-0.6.0}/.gitignore +0 -0
  40. {connectonion-0.5.10 → connectonion-0.6.0}/README.md +0 -0
  41. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/address.py +0 -0
  42. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/__init__.py +0 -0
  43. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/browser_agent/__init__.py +0 -0
  44. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/browser_agent/browser.py +0 -0
  45. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/browser_agent/prompt.md +0 -0
  46. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/__init__.py +0 -0
  47. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/auth_commands.py +0 -0
  48. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/browser_commands.py +0 -0
  49. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/create.py +0 -0
  50. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/doctor_commands.py +0 -0
  51. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/init.py +0 -0
  52. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/reset_commands.py +0 -0
  53. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/commands/status_commands.py +0 -0
  54. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/docs/co-vibecoding-principles-docs-contexts-all-in-one.md +0 -0
  55. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/docs/connectonion.md +0 -0
  56. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/docs.md +0 -0
  57. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/main.py +0 -0
  58. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/README.md +0 -0
  59. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/agent.py +0 -0
  60. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/prompts/answer_prompt.md +0 -0
  61. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/prompts/docs_retrieve_prompt.md +0 -0
  62. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/prompts/metagent.md +0 -0
  63. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/meta-agent/prompts/think_prompt.md +0 -0
  64. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/minimal/README.md +0 -0
  65. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/minimal/agent.py +0 -0
  66. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/playwright/README.md +0 -0
  67. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/playwright/agent.py +0 -0
  68. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/playwright/prompt.md +0 -0
  69. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/playwright/requirements.txt +0 -0
  70. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/cli/templates/web-research/agent.py +0 -0
  71. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/console.py +0 -0
  72. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/events.py +0 -0
  73. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/llm.py +0 -0
  74. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/tool_registry.py +0 -0
  75. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/core}/usage.py +0 -0
  76. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/debug_explainer/__init__.py +0 -0
  77. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/debug_explainer/explainer_prompt.md +0 -0
  78. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/debug_explainer/root_cause_analysis_prompt.md +0 -0
  79. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/decorators.py +0 -0
  80. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/execution_analyzer/__init__.py +0 -0
  81. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/debug}/execution_analyzer/execution_analysis_prompt.md +0 -0
  82. {connectonion-0.5.10/connectonion/debug_agent → connectonion-0.6.0/connectonion/debug/runtime_inspector}/prompts/debug_assistant.md +0 -0
  83. {connectonion-0.5.10/connectonion/debug_agent → connectonion-0.6.0/connectonion/debug/runtime_inspector}/runtime_inspector.py +0 -0
  84. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/logger.py +0 -0
  85. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/asgi.py +0 -0
  86. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/relay.py +0 -0
  87. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/trust_agents.py +0 -0
  88. {connectonion-0.5.10/connectonion → connectonion-0.6.0/connectonion/network}/trust_functions.py +0 -0
  89. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/__init__.py +0 -0
  90. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/analyze_contact.md +0 -0
  91. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/eval_expected.md +0 -0
  92. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/react_evaluate.md +0 -0
  93. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/react_plan.md +0 -0
  94. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompt_files/reflect.md +0 -0
  95. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/prompts.py +0 -0
  96. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/static/docs.html +0 -0
  97. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/transcribe.py +0 -0
  98. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/divider.py +0 -0
  99. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/dropdown.py +0 -0
  100. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/footer.py +0 -0
  101. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/fuzzy.py +0 -0
  102. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/input.py +0 -0
  103. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/keys.py +0 -0
  104. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/pick.py +0 -0
  105. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/providers.py +0 -0
  106. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/tui/status_bar.py +0 -0
  107. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_events_handlers/__init__.py +0 -0
  108. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_plugins/__init__.py +0 -0
  109. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/__init__.py +0 -0
  110. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/diff_writer.py +0 -0
  111. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/get_emails.py +0 -0
  112. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/gmail.py +0 -0
  113. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/google_calendar.py +0 -0
  114. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/memory.py +0 -0
  115. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/microsoft_calendar.py +0 -0
  116. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/outlook.py +0 -0
  117. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/send_email.py +0 -0
  118. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/shell.py +0 -0
  119. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/slash_command.py +0 -0
  120. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/terminal.py +0 -0
  121. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/todo_list.py +0 -0
  122. {connectonion-0.5.10 → connectonion-0.6.0}/connectonion/useful_tools/web_fetch.py +0 -0
  123. {connectonion-0.5.10 → connectonion-0.6.0}/docs/README.md +0 -0
  124. {connectonion-0.5.10 → connectonion-0.6.0}/docs/cli/README.md +0 -0
  125. {connectonion-0.5.10 → connectonion-0.6.0}/docs/debug/README.md +0 -0
  126. {connectonion-0.5.10 → connectonion-0.6.0}/docs/integrations/README.md +0 -0
  127. {connectonion-0.5.10 → connectonion-0.6.0}/docs/network/README.md +0 -0
  128. {connectonion-0.5.10 → connectonion-0.6.0}/docs/templates/README.md +0 -0
  129. {connectonion-0.5.10 → connectonion-0.6.0}/docs/useful_plugins/README.md +0 -0
  130. {connectonion-0.5.10 → connectonion-0.6.0}/docs/useful_tools/README.md +0 -0
  131. {connectonion-0.5.10 → connectonion-0.6.0}/examples/README.md +0 -0
  132. {connectonion-0.5.10 → connectonion-0.6.0}/examples/browser-agent/README.md +0 -0
  133. {connectonion-0.5.10 → connectonion-0.6.0}/examples/email-agent/README.md +0 -0
  134. {connectonion-0.5.10 → connectonion-0.6.0}/examples/simple-agent/README.md +0 -0
  135. {connectonion-0.5.10 → connectonion-0.6.0}/prompts/README.md +0 -0
  136. {connectonion-0.5.10 → connectonion-0.6.0}/prompts/formats/README.md +0 -0
  137. {connectonion-0.5.10 → connectonion-0.6.0}/tests/README.md +0 -0
  138. {connectonion-0.5.10 → connectonion-0.6.0}/tests/cli/README.md +0 -0
  139. {connectonion-0.5.10 → connectonion-0.6.0}/tests/cli/aws/README.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: connectonion
3
- Version: 0.5.10
3
+ Version: 0.6.0
4
4
  Summary: A simple Python framework for creating AI agents with behavior tracking
5
5
  Project-URL: Homepage, https://github.com/openonion/connectonion
6
6
  Project-URL: Documentation, https://docs.connectonion.com
@@ -30,6 +30,7 @@ Requires-Dist: httpx>=0.24.0
30
30
  Requires-Dist: litellm>=1.0.0
31
31
  Requires-Dist: mnemonic>=0.20
32
32
  Requires-Dist: openai>=1.0.0
33
+ Requires-Dist: playwright>=1.40.0
33
34
  Requires-Dist: pydantic>=2.0.0
34
35
  Requires-Dist: pyjwt>=2.0.0
35
36
  Requires-Dist: pynacl>=1.5.0
@@ -38,12 +39,12 @@ Requires-Dist: pyyaml>=6.0.0
38
39
  Requires-Dist: questionary>=2.0.0
39
40
  Requires-Dist: requests>=2.25.0
40
41
  Requires-Dist: rich>=13.0.0
42
+ Requires-Dist: textual-autocomplete>=3.0.0
43
+ Requires-Dist: textual>=0.86.0
41
44
  Requires-Dist: toml>=0.10.2
42
45
  Requires-Dist: typer>=0.20.0
43
46
  Requires-Dist: uvicorn>=0.20.0
44
47
  Requires-Dist: websockets>=11.0.0
45
- Provides-Extra: browser
46
- Requires-Dist: playwright>=1.40.0; extra == 'browser'
47
48
  Provides-Extra: dev
48
49
  Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
49
50
  Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
@@ -1,6 +1,6 @@
1
1
  """ConnectOnion - A simple agent framework with behavior tracking."""
2
2
 
3
- __version__ = "0.5.10"
3
+ __version__ = "0.6.0"
4
4
 
5
5
  # Auto-load .env files for the entire framework
6
6
  from dotenv import load_dotenv
@@ -10,20 +10,8 @@ from pathlib import Path as _Path
10
10
  # NOT from the module's location (framework directory)
11
11
  load_dotenv(_Path.cwd() / ".env")
12
12
 
13
- from .agent import Agent
14
- from .tool_factory import create_tool_from_function
15
- from .llm import LLM
16
- from .logger import Logger
17
- from .llm_do import llm_do
18
- from .transcribe import transcribe
19
- from .prompts import load_system_prompt
20
- from .xray import xray
21
- from .decorators import replay, xray_replay
22
- from .useful_tools import send_email, get_emails, mark_read, mark_unread, Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar, WebFetch, Shell, DiffWriter, pick, yes_no, autocomplete, TodoList, SlashCommand
23
- from .auto_debug_exception import auto_debug_exception
24
- from .connect import connect, RemoteAgent
25
- from .host import host, create_app
26
- from .events import (
13
+ from .core import Agent, LLM, create_tool_from_function
14
+ from .core import (
27
15
  after_user_input,
28
16
  before_llm,
29
17
  after_llm,
@@ -32,8 +20,17 @@ from .events import (
32
20
  after_each_tool,
33
21
  after_tools,
34
22
  on_error,
35
- on_complete
23
+ on_complete,
36
24
  )
25
+ from .logger import Logger
26
+ from .llm_do import llm_do
27
+ from .transcribe import transcribe
28
+ from .prompts import load_system_prompt
29
+ from .debug import xray, auto_debug_exception, replay, xray_replay
30
+ from .useful_tools import send_email, get_emails, mark_read, mark_unread, Memory, Gmail, GoogleCalendar, Outlook, MicrosoftCalendar, WebFetch, Shell, DiffWriter, pick, yes_no, autocomplete, TodoList, SlashCommand
31
+ from .network import connect, RemoteAgent, host, create_app
32
+ from .network import relay, announce
33
+ from . import address
37
34
 
38
35
  __all__ = [
39
36
  "Agent",
@@ -68,6 +65,9 @@ __all__ = [
68
65
  "RemoteAgent",
69
66
  "host",
70
67
  "create_app",
68
+ "relay",
69
+ "announce",
70
+ "address",
71
71
  "after_user_input",
72
72
  "before_llm",
73
73
  "after_llm",
@@ -39,6 +39,18 @@ PLUGINS = {
39
39
  "calendar_plugin": "calendar_plugin.py",
40
40
  }
41
41
 
42
+ # Registry of copyable TUI components
43
+ TUI = {
44
+ "chat": "chat.py",
45
+ "fuzzy": "fuzzy.py",
46
+ "divider": "divider.py",
47
+ "footer": "footer.py",
48
+ "status_bar": "status_bar.py",
49
+ "dropdown": "dropdown.py",
50
+ "pick": "pick.py",
51
+ "keys": "keys.py",
52
+ }
53
+
42
54
 
43
55
  def handle_copy(
44
56
  names: List[str],
@@ -56,9 +68,11 @@ def handle_copy(
56
68
  # Get source directories using import system (works for installed packages)
57
69
  import connectonion.useful_tools as tools_module
58
70
  import connectonion.useful_plugins as plugins_module
71
+ import connectonion.tui as tui_module
59
72
 
60
73
  useful_tools_dir = Path(tools_module.__file__).parent
61
74
  useful_plugins_dir = Path(plugins_module.__file__).parent
75
+ tui_dir = Path(tui_module.__file__).parent
62
76
 
63
77
  current_dir = Path.cwd()
64
78
 
@@ -77,6 +91,12 @@ def handle_copy(
77
91
  dest_dir = Path(path) if path else current_dir / "plugins"
78
92
  copy_file(source, dest_dir, force)
79
93
 
94
+ # Check if it's a TUI component
95
+ elif name_lower in TUI:
96
+ source = tui_dir / TUI[name_lower]
97
+ dest_dir = Path(path) if path else current_dir / "tui"
98
+ copy_file(source, dest_dir, force)
99
+
80
100
  else:
81
101
  console.print(f"[red]Unknown: {name}[/red]")
82
102
  console.print("Use [cyan]co copy --list[/cyan] to see available items")
@@ -100,7 +120,7 @@ def copy_file(source: Path, dest_dir: Path, force: bool):
100
120
 
101
121
 
102
122
  def show_available_items():
103
- """Display available tools and plugins."""
123
+ """Display available tools, plugins, and TUI components."""
104
124
  table = Table(title="Available Items to Copy")
105
125
  table.add_column("Name", style="cyan")
106
126
  table.add_column("Type", style="green")
@@ -112,5 +132,8 @@ def show_available_items():
112
132
  for name, file in sorted(PLUGINS.items()):
113
133
  table.add_row(name, "plugin", file)
114
134
 
135
+ for name, file in sorted(TUI.items()):
136
+ table.add_row(name, "tui", file)
137
+
115
138
  console.print(table)
116
139
  console.print("\n[dim]Usage: co copy <name> [--path ./custom/][/dim]")
@@ -217,4 +217,19 @@ def handle_deploy():
217
217
  # Always show URL if we have one
218
218
  if url:
219
219
  console.print(f"Agent URL: {url}")
220
+
221
+ # Always fetch and display container logs
222
+ if deployment_id:
223
+ logs_resp = requests.get(
224
+ f"{API_BASE}/api/v1/deploy/{deployment_id}/logs?tail=20",
225
+ headers={"Authorization": f"Bearer {api_key}"},
226
+ timeout=10,
227
+ )
228
+ if logs_resp.status_code == 200:
229
+ logs = logs_resp.json().get("logs", "")
230
+ if logs:
231
+ console.print()
232
+ console.print("[dim]Container logs:[/dim]")
233
+ console.print(f"[dim]{logs}[/dim]")
234
+
220
235
  console.print()
@@ -622,7 +622,7 @@ def generate_custom_template_with_name(description: str, api_key: str, model: st
622
622
  # Try to use AI to generate name and code
623
623
  if model or api_key:
624
624
  try:
625
- from ...llm import create_llm
625
+ from ...core.llm import create_llm
626
626
 
627
627
  # Use the model specified or default to co/gemini-2.5-pro
628
628
  llm_model = model if model else "co/gemini-2.5-pro"
@@ -0,0 +1,53 @@
1
+ """Core agent execution engine.
2
+
3
+ This module contains the minimal set of components needed to run an agent:
4
+ - Agent: Main orchestrator
5
+ - LLM: Multi-provider LLM abstraction
6
+ - Events: Event system for lifecycle hooks
7
+ - Tools: Tool execution, factory, and registry
8
+ - Usage: Token tracking and cost calculation
9
+ """
10
+
11
+ from .agent import Agent
12
+ from .llm import LLM, create_llm, TokenUsage
13
+ from .events import (
14
+ EventHandler,
15
+ after_user_input,
16
+ before_llm,
17
+ after_llm,
18
+ before_each_tool,
19
+ before_tools,
20
+ after_each_tool,
21
+ after_tools,
22
+ on_error,
23
+ on_complete,
24
+ )
25
+ from .tool_factory import create_tool_from_function, extract_methods_from_instance, is_class_instance
26
+ from .tool_registry import ToolRegistry
27
+ from .tool_executor import execute_and_record_tools, execute_single_tool
28
+ from .usage import TokenUsage, calculate_cost, get_context_limit
29
+
30
+ __all__ = [
31
+ "Agent",
32
+ "LLM",
33
+ "create_llm",
34
+ "TokenUsage",
35
+ "EventHandler",
36
+ "after_user_input",
37
+ "before_llm",
38
+ "after_llm",
39
+ "before_each_tool",
40
+ "before_tools",
41
+ "after_each_tool",
42
+ "after_tools",
43
+ "on_error",
44
+ "on_complete",
45
+ "create_tool_from_function",
46
+ "extract_methods_from_instance",
47
+ "is_class_instance",
48
+ "ToolRegistry",
49
+ "execute_and_record_tools",
50
+ "execute_single_tool",
51
+ "calculate_cost",
52
+ "get_context_limit",
53
+ ]
@@ -18,11 +18,11 @@ from .llm import LLM, create_llm, TokenUsage
18
18
  from .usage import get_context_limit
19
19
  from .tool_factory import create_tool_from_function, extract_methods_from_instance, is_class_instance
20
20
  from .tool_registry import ToolRegistry
21
- from .prompts import load_system_prompt
22
- from .decorators import (
21
+ from ..prompts import load_system_prompt
22
+ from ..debug.decorators import (
23
23
  _is_replay_enabled # Only need this for replay check
24
24
  )
25
- from .logger import Logger
25
+ from ..logger import Logger
26
26
  from .tool_executor import execute_and_record_tools, execute_single_tool
27
27
  from .events import EventHandler
28
28
 
@@ -444,7 +444,7 @@ class Agent:
444
444
  # Single prompt mode
445
445
  agent.auto_debug("Find information about Python")
446
446
  """
447
- from .interactive_debugger import InteractiveDebugger
448
- debugger = InteractiveDebugger(self)
447
+ from .debug import AutoDebugger
448
+ debugger = AutoDebugger(self)
449
449
  debugger.start_debug_session(prompt)
450
450
 
@@ -13,7 +13,7 @@ import time
13
13
  import json
14
14
  from typing import List, Dict, Any, Optional, Callable
15
15
 
16
- from .xray import (
16
+ from ..debug.xray import (
17
17
  inject_xray_context,
18
18
  clear_xray_context,
19
19
  is_xray_enabled
@@ -165,7 +165,8 @@ def execute_single_tool(
165
165
  agent.current_session['pending_tool'] = {
166
166
  'name': tool_name,
167
167
  'arguments': tool_args,
168
- 'id': tool_id
168
+ 'id': tool_id,
169
+ 'description': getattr(tool_func, 'description', '')
169
170
  }
170
171
 
171
172
  # Invoke before_each_tool events
@@ -29,7 +29,9 @@ def create_tool_from_function(func: Callable) -> Callable:
29
29
  by inspecting its signature and docstring.
30
30
  """
31
31
  name = func.__name__
32
- description = inspect.getdoc(func) or f"Execute the {name} tool."
32
+ raw_doc = inspect.getdoc(func)
33
+ # Extract summary only (first paragraph) - Args/Returns sections are not sent to LLM
34
+ description = raw_doc.split('\n\n')[0].strip() if raw_doc else f"Execute the {name} tool."
33
35
 
34
36
  # Build the parameters schema from the function signature
35
37
  sig = inspect.signature(func)
@@ -0,0 +1,51 @@
1
+ """Debug tools for agent development and troubleshooting.
2
+
3
+ This module contains:
4
+ - xray: Runtime context injection for tool inspection
5
+ - decorators: replay, xray_replay for debugging
6
+ - auto_debug: Interactive debugging with breakpoints (AutoDebugger, AutoDebugUI)
7
+ - auto_debug_exception: Exception handling and debugging
8
+ - runtime_inspector: AI-powered runtime state inspection for crash debugging
9
+ - debug_explainer: AI-powered explanation of tool choices
10
+
11
+ Note: Uses lazy imports to avoid circular dependency with agent.py
12
+ """
13
+
14
+ # xray and decorators can be imported eagerly (no circular dependency)
15
+ from .xray import xray
16
+ from .decorators import replay, xray_replay
17
+
18
+ __all__ = [
19
+ "xray",
20
+ "replay",
21
+ "xray_replay",
22
+ "AutoDebugger",
23
+ "AutoDebugUI",
24
+ "BreakpointContext",
25
+ "BreakpointAction",
26
+ "auto_debug_exception",
27
+ "create_debug_agent",
28
+ "RuntimeInspector",
29
+ "explain_tool_choice",
30
+ "RuntimeContext",
31
+ ]
32
+
33
+
34
+ def __getattr__(name):
35
+ """Lazy import to avoid circular dependency with agent.py."""
36
+ if name == "AutoDebugger":
37
+ from .auto_debug import AutoDebugger
38
+ return AutoDebugger
39
+ elif name in ("AutoDebugUI", "BreakpointContext", "BreakpointAction"):
40
+ from .auto_debug_ui import AutoDebugUI, BreakpointContext, BreakpointAction
41
+ return {"AutoDebugUI": AutoDebugUI, "BreakpointContext": BreakpointContext, "BreakpointAction": BreakpointAction}[name]
42
+ elif name == "auto_debug_exception":
43
+ from .auto_debug_exception import auto_debug_exception
44
+ return auto_debug_exception
45
+ elif name in ("create_debug_agent", "RuntimeInspector"):
46
+ from .runtime_inspector import create_debug_agent, RuntimeInspector
47
+ return {"create_debug_agent": create_debug_agent, "RuntimeInspector": RuntimeInspector}[name]
48
+ elif name in ("explain_tool_choice", "RuntimeContext"):
49
+ from .debug_explainer import explain_tool_choice, RuntimeContext
50
+ return {"explain_tool_choice": explain_tool_choice, "RuntimeContext": RuntimeContext}[name]
51
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
@@ -13,25 +13,25 @@ LLM-Note:
13
13
  """
14
14
 
15
15
  from typing import Any, Dict, Optional, List
16
- from .debugger_ui import DebuggerUI, BreakpointContext, BreakpointAction
16
+ from .auto_debug_ui import AutoDebugUI, BreakpointContext, BreakpointAction
17
17
 
18
18
 
19
- class InteractiveDebugger:
19
+ class AutoDebugger:
20
20
  """Orchestrates debugging sessions for AI agents.
21
21
 
22
22
  This class handles the debugging logic and intercepts tool execution,
23
23
  delegating all UI interactions to the DebuggerUI class.
24
24
  """
25
25
 
26
- def __init__(self, agent: Any, ui: Optional[DebuggerUI] = None):
26
+ def __init__(self, agent: Any, ui: Optional[AutoDebugUI] = None):
27
27
  """Initialize debugger with an agent instance and optional UI.
28
28
 
29
29
  Args:
30
30
  agent: The Agent instance to debug
31
- ui: Optional DebuggerUI instance (creates default if None)
31
+ ui: Optional AutoDebugUI instance (creates default if None)
32
32
  """
33
33
  self.agent = agent
34
- self.ui = ui or DebuggerUI()
34
+ self.ui = ui or AutoDebugUI()
35
35
  self.original_execute_single_tool = None
36
36
 
37
37
  def start_debug_session(self, prompt: Optional[str] = None):
@@ -99,7 +99,7 @@ class InteractiveDebugger:
99
99
  - Pause execution and show UI if breakpoint conditions are met
100
100
  - Only affect this specific agent instance
101
101
  """
102
- from . import tool_executor
102
+ from ..core import tool_executor
103
103
  from .xray import is_xray_enabled
104
104
 
105
105
  # Store original function for restoration later
@@ -141,7 +141,7 @@ class InteractiveDebugger:
141
141
  tool execution function.
142
142
  """
143
143
  if self.original_execute_single_tool:
144
- from . import tool_executor
144
+ from ..core import tool_executor
145
145
  tool_executor.execute_single_tool = self.original_execute_single_tool
146
146
 
147
147
  def _show_breakpoint_ui_and_wait_for_continue(self, tool_name: str, tool_args: Dict, trace_entry: Dict):
@@ -57,7 +57,7 @@ def auto_debug_exception(model: str = "o4-mini"):
57
57
  original_hook(exc_type, exc_value, exception_traceback)
58
58
 
59
59
  # Then add our AI analysis
60
- from .console import Console
60
+ from ..console import Console
61
61
  console = Console()
62
62
 
63
63
  # Find the most relevant frame (last user code, not library)
@@ -125,7 +125,7 @@ def auto_debug_exception(model: str = "o4-mini"):
125
125
 
126
126
  try:
127
127
  # Use debug agent with runtime inspection tools
128
- from .debug_agent import create_debug_agent
128
+ from .runtime_inspector import create_debug_agent
129
129
 
130
130
  # Pass the actual frame and traceback for runtime inspection!
131
131
  agent = create_debug_agent(
@@ -176,6 +176,6 @@ You have LIVE ACCESS to the crashed program's state! Use your tools to investiga
176
176
  sys.excepthook = handle_exception
177
177
 
178
178
  # Simple confirmation
179
- from .console import Console
179
+ from ..console import Console
180
180
  console = Console()
181
181
  console.print(f"[green]✅ Exception debugging enabled[/green] - AI will analyze uncaught exceptions with runtime inspection")
@@ -51,7 +51,7 @@ class BreakpointContext:
51
51
  tool_function: Optional[Any] = None # The actual tool function for source inspection
52
52
 
53
53
 
54
- class DebuggerUI:
54
+ class AutoDebugUI:
55
55
  """Handles all user interaction and display for the debugger."""
56
56
 
57
57
  def __init__(self):
@@ -31,7 +31,7 @@ def explain_tool_choice(
31
31
  Returns:
32
32
  Explanation string from the AI agent
33
33
  """
34
- from ..agent import Agent
34
+ from ...core.agent import Agent
35
35
  import inspect
36
36
 
37
37
  # Get all the information we need
@@ -12,7 +12,7 @@ LLM-Note:
12
12
  from typing import Dict, List, Any
13
13
  from pathlib import Path
14
14
  from pydantic import BaseModel
15
- from ..llm_do import llm_do
15
+ from ...llm_do import llm_do
16
16
 
17
17
 
18
18
  class RootCauseAnalysis(BaseModel):
@@ -16,7 +16,7 @@ Analyzes the entire execution trace and provides suggestions for improvement.
16
16
  from pathlib import Path
17
17
  from pydantic import BaseModel
18
18
  from typing import List
19
- from ..llm_do import llm_do
19
+ from ...llm_do import llm_do
20
20
 
21
21
 
22
22
  class ExecutionAnalysis(BaseModel):
@@ -0,0 +1,13 @@
1
+ """Runtime inspector for AI-powered crash debugging.
2
+
3
+ Provides RuntimeInspector class and factory function to create debug agents
4
+ that can experiment, test, and validate fixes using actual crashed program data.
5
+ """
6
+
7
+ from .agent import create_debug_agent
8
+ from .runtime_inspector import RuntimeInspector
9
+
10
+ __all__ = [
11
+ "create_debug_agent",
12
+ "RuntimeInspector"
13
+ ]
@@ -10,7 +10,7 @@ LLM-Note:
10
10
  """
11
11
 
12
12
  from pathlib import Path
13
- from ..agent import Agent
13
+ from ...core.agent import Agent
14
14
  from .runtime_inspector import RuntimeInspector
15
15
 
16
16
 
@@ -14,7 +14,7 @@ This module provides the @xray decorator and xray context for debugging AI agent
14
14
  See everything your agent is thinking during tool execution.
15
15
 
16
16
  Usage:
17
- from connectonion.xray import xray
17
+ from connectonion import xray # or: from connectonion.debug import xray
18
18
 
19
19
  @xray
20
20
  def my_tool(query: str):
@@ -222,7 +222,7 @@ from typing import Union, Type, Optional, TypeVar
222
222
  from pathlib import Path
223
223
  from pydantic import BaseModel
224
224
  from .prompts import load_system_prompt
225
- from .llm import create_llm
225
+ from .core.llm import create_llm
226
226
 
227
227
  T = TypeVar('T', bound=BaseModel)
228
228
 
@@ -0,0 +1,34 @@
1
+ """Network layer for hosting and connecting agents.
2
+
3
+ This module contains:
4
+ - host: Host an agent over HTTP/WebSocket
5
+ - asgi: ASGI app implementation
6
+ - relay: Agent relay server for P2P discovery
7
+ - connect: Multi-agent networking (RemoteAgent)
8
+ - announce: Service announcement protocol
9
+ - trust: Trust verification system
10
+ """
11
+
12
+ from .host import host, create_app, SessionStorage, Session
13
+ from .connect import connect, RemoteAgent
14
+ from .relay import connect as relay_connect, serve_loop
15
+ from .announce import create_announce_message
16
+ from .trust import create_trust_agent, get_default_trust_level, TRUST_LEVELS
17
+ from . import relay, announce
18
+
19
+ __all__ = [
20
+ "host",
21
+ "create_app",
22
+ "SessionStorage",
23
+ "Session",
24
+ "connect",
25
+ "RemoteAgent",
26
+ "relay_connect",
27
+ "serve_loop",
28
+ "create_announce_message",
29
+ "create_trust_agent",
30
+ "get_default_trust_level",
31
+ "TRUST_LEVELS",
32
+ "relay",
33
+ "announce",
34
+ ]
@@ -72,7 +72,7 @@ def create_announce_message(
72
72
  message_bytes = message_json.encode('utf-8')
73
73
 
74
74
  # Sign with Ed25519
75
- from . import address
75
+ from .. import address
76
76
  signature_bytes = address.sign(address_data, message_bytes)
77
77
 
78
78
  # Convert to hex string (NO 0x prefix - matches auth system convention)
@@ -19,7 +19,7 @@ import time
19
19
  import uuid
20
20
  from typing import Any, Dict, List, Optional
21
21
 
22
- from . import address as addr
22
+ from .. import address as addr
23
23
 
24
24
 
25
25
  class RemoteAgent:
@@ -177,7 +177,7 @@ def health_handler(agent, start_time: float) -> dict:
177
177
 
178
178
  def info_handler(agent, trust: str) -> dict:
179
179
  """GET /info"""
180
- from . import __version__
180
+ from .. import __version__
181
181
  tools = agent.tools.list_names() if hasattr(agent.tools, "list_names") else []
182
182
  return {
183
183
  "name": agent.name,
@@ -338,7 +338,7 @@ def evaluate_with_trust_agent(trust_agent, prompt: str, identity: str, sig_valid
338
338
  (accepted, reason) tuple
339
339
  """
340
340
  from pydantic import BaseModel
341
- from .llm_do import llm_do
341
+ from ..llm_do import llm_do
342
342
 
343
343
  class TrustDecision(BaseModel):
344
344
  accept: bool
@@ -401,7 +401,12 @@ def admin_sessions_handler() -> dict:
401
401
  # === Entry Point ===
402
402
 
403
403
  def _create_handlers(agent_template, result_ttl: int):
404
- """Create handler dict for ASGI app."""
404
+ """Create handler dict for ASGI app.
405
+
406
+ Args:
407
+ agent_template: Agent used as template (deep-copied per request for isolation)
408
+ result_ttl: How long to keep results on server in seconds
409
+ """
405
410
  def ws_input(prompt: str) -> str:
406
411
  agent = copy.deepcopy(agent_template)
407
412
  return agent.input(prompt)
@@ -425,6 +430,11 @@ def _start_relay_background(agent_template, relay_url: str, addr_data: dict):
425
430
 
426
431
  The relay connection runs alongside the HTTP server, allowing the agent
427
432
  to be discovered via P2P network while also serving HTTP requests.
433
+
434
+ Args:
435
+ agent_template: Agent used as template (deep-copied per request for isolation)
436
+ relay_url: WebSocket URL for P2P relay
437
+ addr_data: Agent address data (public key, address)
428
438
  """
429
439
  import asyncio
430
440
  import threading
@@ -466,8 +476,12 @@ def host(
466
476
  """
467
477
  Host an agent over HTTP/WebSocket with optional P2P relay discovery.
468
478
 
479
+ The agent is used as a template - each request gets a fresh deep copy
480
+ for complete isolation. This ensures tools with state (like BrowserTool)
481
+ don't interfere between concurrent requests.
482
+
469
483
  Args:
470
- agent: Agent to host
484
+ agent: Agent template (deep-copied per request for isolation)
471
485
  port: HTTP port (default: PORT env var or 8000)
472
486
  trust: Trust level, policy, or Agent:
473
487
  - Level: "open", "careful", "strict"
@@ -492,7 +506,7 @@ def host(
492
506
  GET /logs/sessions - Activity sessions (requires OPENONION_API_KEY)
493
507
  """
494
508
  import uvicorn
495
- from . import address
509
+ from .. import address
496
510
 
497
511
  # Use PORT env var if port not specified (for container deployments)
498
512
  if port is None:
@@ -543,8 +557,11 @@ def host(
543
557
  def _make_app(agent, trust: Union[str, "Agent"] = "careful", result_ttl=86400, *, blacklist=None, whitelist=None):
544
558
  """Create ASGI app for external uvicorn/gunicorn usage.
545
559
 
560
+ The agent is used as a template - each request gets a fresh deep copy
561
+ for complete isolation.
562
+
546
563
  Args:
547
- agent: Agent to host
564
+ agent: Agent template (deep-copied per request for isolation)
548
565
  trust: Trust level, policy, or Agent
549
566
  result_ttl: How long to keep results on server in seconds
550
567
  blacklist: Blocked identities
@@ -579,6 +596,7 @@ host.app = _make_app
579
596
  def create_app_compat(agent, storage, trust="careful", result_ttl=86400, *, blacklist=None, whitelist=None):
580
597
  """Create ASGI app (backward-compatible wrapper).
581
598
 
599
+ The agent is used as a template (deep-copied per request for isolation).
582
600
  Prefer using host.app(agent) for new code.
583
601
  """
584
602
  handlers = _create_handlers(agent, result_ttl)
@@ -59,7 +59,7 @@ def create_trust_agent(trust: Union[str, Path, 'Agent', None], api_key: Optional
59
59
  ValueError: If trust level is invalid
60
60
  FileNotFoundError: If trust policy file doesn't exist
61
61
  """
62
- from .agent import Agent # Import here to avoid circular dependency
62
+ from ..core.agent import Agent # Import here to avoid circular dependency
63
63
 
64
64
  # If None, check for environment default
65
65
  if trust is None: