connectonion 0.5.8__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 +78 -0
- connectonion/address.py +320 -0
- connectonion/agent.py +450 -0
- connectonion/announce.py +84 -0
- connectonion/asgi.py +287 -0
- connectonion/auto_debug_exception.py +181 -0
- connectonion/cli/__init__.py +3 -0
- connectonion/cli/browser_agent/__init__.py +5 -0
- connectonion/cli/browser_agent/browser.py +243 -0
- connectonion/cli/browser_agent/prompt.md +107 -0
- connectonion/cli/commands/__init__.py +1 -0
- connectonion/cli/commands/auth_commands.py +527 -0
- connectonion/cli/commands/browser_commands.py +27 -0
- connectonion/cli/commands/create.py +511 -0
- connectonion/cli/commands/deploy_commands.py +220 -0
- connectonion/cli/commands/doctor_commands.py +173 -0
- connectonion/cli/commands/init.py +469 -0
- connectonion/cli/commands/project_cmd_lib.py +828 -0
- connectonion/cli/commands/reset_commands.py +149 -0
- connectonion/cli/commands/status_commands.py +168 -0
- connectonion/cli/docs/co-vibecoding-principles-docs-contexts-all-in-one.md +2010 -0
- connectonion/cli/docs/connectonion.md +1256 -0
- connectonion/cli/docs.md +123 -0
- connectonion/cli/main.py +148 -0
- connectonion/cli/templates/meta-agent/README.md +287 -0
- connectonion/cli/templates/meta-agent/agent.py +196 -0
- connectonion/cli/templates/meta-agent/prompts/answer_prompt.md +9 -0
- connectonion/cli/templates/meta-agent/prompts/docs_retrieve_prompt.md +15 -0
- connectonion/cli/templates/meta-agent/prompts/metagent.md +71 -0
- connectonion/cli/templates/meta-agent/prompts/think_prompt.md +18 -0
- connectonion/cli/templates/minimal/README.md +56 -0
- connectonion/cli/templates/minimal/agent.py +40 -0
- connectonion/cli/templates/playwright/README.md +118 -0
- connectonion/cli/templates/playwright/agent.py +336 -0
- connectonion/cli/templates/playwright/prompt.md +102 -0
- connectonion/cli/templates/playwright/requirements.txt +3 -0
- connectonion/cli/templates/web-research/agent.py +122 -0
- connectonion/connect.py +128 -0
- connectonion/console.py +539 -0
- connectonion/debug_agent/__init__.py +13 -0
- connectonion/debug_agent/agent.py +45 -0
- connectonion/debug_agent/prompts/debug_assistant.md +72 -0
- connectonion/debug_agent/runtime_inspector.py +406 -0
- connectonion/debug_explainer/__init__.py +10 -0
- connectonion/debug_explainer/explain_agent.py +114 -0
- connectonion/debug_explainer/explain_context.py +263 -0
- connectonion/debug_explainer/explainer_prompt.md +29 -0
- connectonion/debug_explainer/root_cause_analysis_prompt.md +43 -0
- connectonion/debugger_ui.py +1039 -0
- connectonion/decorators.py +208 -0
- connectonion/events.py +248 -0
- connectonion/execution_analyzer/__init__.py +9 -0
- connectonion/execution_analyzer/execution_analysis.py +93 -0
- connectonion/execution_analyzer/execution_analysis_prompt.md +47 -0
- connectonion/host.py +579 -0
- connectonion/interactive_debugger.py +342 -0
- connectonion/llm.py +801 -0
- connectonion/llm_do.py +307 -0
- connectonion/logger.py +300 -0
- connectonion/prompt_files/__init__.py +1 -0
- connectonion/prompt_files/analyze_contact.md +62 -0
- connectonion/prompt_files/eval_expected.md +12 -0
- connectonion/prompt_files/react_evaluate.md +11 -0
- connectonion/prompt_files/react_plan.md +16 -0
- connectonion/prompt_files/reflect.md +22 -0
- connectonion/prompts.py +144 -0
- connectonion/relay.py +200 -0
- connectonion/static/docs.html +688 -0
- connectonion/tool_executor.py +279 -0
- connectonion/tool_factory.py +186 -0
- connectonion/tool_registry.py +105 -0
- connectonion/trust.py +166 -0
- connectonion/trust_agents.py +71 -0
- connectonion/trust_functions.py +88 -0
- connectonion/tui/__init__.py +57 -0
- connectonion/tui/divider.py +39 -0
- connectonion/tui/dropdown.py +251 -0
- connectonion/tui/footer.py +31 -0
- connectonion/tui/fuzzy.py +56 -0
- connectonion/tui/input.py +278 -0
- connectonion/tui/keys.py +35 -0
- connectonion/tui/pick.py +130 -0
- connectonion/tui/providers.py +155 -0
- connectonion/tui/status_bar.py +163 -0
- connectonion/usage.py +161 -0
- connectonion/useful_events_handlers/__init__.py +16 -0
- connectonion/useful_events_handlers/reflect.py +116 -0
- connectonion/useful_plugins/__init__.py +20 -0
- connectonion/useful_plugins/calendar_plugin.py +163 -0
- connectonion/useful_plugins/eval.py +139 -0
- connectonion/useful_plugins/gmail_plugin.py +162 -0
- connectonion/useful_plugins/image_result_formatter.py +127 -0
- connectonion/useful_plugins/re_act.py +78 -0
- connectonion/useful_plugins/shell_approval.py +159 -0
- connectonion/useful_tools/__init__.py +44 -0
- connectonion/useful_tools/diff_writer.py +192 -0
- connectonion/useful_tools/get_emails.py +183 -0
- connectonion/useful_tools/gmail.py +1596 -0
- connectonion/useful_tools/google_calendar.py +613 -0
- connectonion/useful_tools/memory.py +380 -0
- connectonion/useful_tools/microsoft_calendar.py +604 -0
- connectonion/useful_tools/outlook.py +488 -0
- connectonion/useful_tools/send_email.py +205 -0
- connectonion/useful_tools/shell.py +97 -0
- connectonion/useful_tools/slash_command.py +201 -0
- connectonion/useful_tools/terminal.py +285 -0
- connectonion/useful_tools/todo_list.py +241 -0
- connectonion/useful_tools/web_fetch.py +216 -0
- connectonion/xray.py +467 -0
- connectonion-0.5.8.dist-info/METADATA +741 -0
- connectonion-0.5.8.dist-info/RECORD +113 -0
- connectonion-0.5.8.dist-info/WHEEL +4 -0
- connectonion-0.5.8.dist-info/entry_points.txt +3 -0
connectonion/cli/docs.md
ADDED
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# ConnectOnion Framework - Complete Reference
|
|
2
|
+
|
|
3
|
+
## What is ConnectOnion?
|
|
4
|
+
|
|
5
|
+
ConnectOnion is a simple Python framework for creating AI agents that can use tools and track their behavior.
|
|
6
|
+
|
|
7
|
+
**Key Principles:**
|
|
8
|
+
- Keep simple things simple, make hard things possible
|
|
9
|
+
- Function-based tools are preferred over classes
|
|
10
|
+
- Activity logging to .co/logs/ (Python SDK only)
|
|
11
|
+
- Default settings work for most use cases
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
```python
|
|
16
|
+
from connectonion import Agent
|
|
17
|
+
|
|
18
|
+
# Define tools as regular functions
|
|
19
|
+
def search(query: str) -> str:
|
|
20
|
+
'''Search for information.'''
|
|
21
|
+
return f"Found information about {query}"
|
|
22
|
+
|
|
23
|
+
# Create agent
|
|
24
|
+
agent = Agent(
|
|
25
|
+
name="my_assistant",
|
|
26
|
+
system_prompt="prompt.md", # Always use markdown files for prompts
|
|
27
|
+
tools=[search]
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
# Use agent
|
|
31
|
+
result = agent.input("Search for Python tutorials")
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Core Concepts
|
|
35
|
+
|
|
36
|
+
### Tools
|
|
37
|
+
Tools are just Python functions with type hints:
|
|
38
|
+
```python
|
|
39
|
+
def my_tool(param: str, optional: int = 10) -> str:
|
|
40
|
+
'''This docstring becomes the tool description.'''
|
|
41
|
+
return f"Result: {param}"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
### System Prompts
|
|
45
|
+
Always use markdown files for system prompts:
|
|
46
|
+
```python
|
|
47
|
+
agent = Agent(
|
|
48
|
+
name="assistant",
|
|
49
|
+
system_prompt="prompt.md", # Best practice
|
|
50
|
+
tools=[...]
|
|
51
|
+
)
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### max_iterations
|
|
55
|
+
Controls how many tool calls the agent can make:
|
|
56
|
+
- Simple tasks: 3-5 iterations
|
|
57
|
+
- Standard workflows: 10-15 iterations
|
|
58
|
+
- Complex analysis: 20-40 iterations
|
|
59
|
+
|
|
60
|
+
## Common Patterns
|
|
61
|
+
|
|
62
|
+
### Calculator Bot
|
|
63
|
+
```python
|
|
64
|
+
def calculate(expression: str) -> float:
|
|
65
|
+
'''Perform math calculations.'''
|
|
66
|
+
return eval(expression) # Use safely
|
|
67
|
+
|
|
68
|
+
agent = Agent("calc", tools=[calculate], max_iterations=5)
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Research Assistant
|
|
72
|
+
```python
|
|
73
|
+
def web_search(query: str) -> str:
|
|
74
|
+
'''Search the web.'''
|
|
75
|
+
return f"Results for {query}"
|
|
76
|
+
|
|
77
|
+
def summarize(text: str) -> str:
|
|
78
|
+
'''Summarize text.'''
|
|
79
|
+
return f"Summary: {text[:100]}..."
|
|
80
|
+
|
|
81
|
+
agent = Agent("researcher", tools=[web_search, summarize], max_iterations=20)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Debugging with @xray
|
|
85
|
+
|
|
86
|
+
See inside your agent's mind:
|
|
87
|
+
```python
|
|
88
|
+
from connectonion.decorators import xray
|
|
89
|
+
|
|
90
|
+
@xray
|
|
91
|
+
def my_tool(text: str) -> str:
|
|
92
|
+
print(xray.agent.name) # Agent name
|
|
93
|
+
print(xray.task) # Original request
|
|
94
|
+
print(xray.iteration) # Current iteration
|
|
95
|
+
return "Done"
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## Best Practices
|
|
99
|
+
|
|
100
|
+
1. **Use type hints** - Required for all tools
|
|
101
|
+
2. **Write clear docstrings** - They become tool descriptions
|
|
102
|
+
3. **Handle errors gracefully** - Return error messages, don't raise
|
|
103
|
+
4. **Use markdown for prompts** - Keep prompts separate from code
|
|
104
|
+
5. **Set appropriate iterations** - Match complexity of task
|
|
105
|
+
|
|
106
|
+
## Activity Logging
|
|
107
|
+
|
|
108
|
+
All agent activities are automatically logged to `.co/logs/{name}.log`:
|
|
109
|
+
```python
|
|
110
|
+
# Logs are written to .co/logs/ directory by default
|
|
111
|
+
# Each agent gets its own log file: .co/logs/{agent_name}.log
|
|
112
|
+
|
|
113
|
+
# You can customize logging:
|
|
114
|
+
agent = Agent("assistant", log=False) # Disable logging
|
|
115
|
+
agent = Agent("assistant", log=True) # Log to {name}.log in current dir
|
|
116
|
+
agent = Agent("assistant", log="custom.log") # Custom log path
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
## Full Documentation
|
|
120
|
+
|
|
121
|
+
For complete documentation, visit: https://github.com/connectonion/connectonion
|
|
122
|
+
|
|
123
|
+
This embedded reference helps your agent understand and use ConnectOnion effectively.
|
connectonion/cli/main.py
ADDED
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Purpose: Entry point for ConnectOnion CLI application using Typer framework with Rich formatting
|
|
3
|
+
LLM-Note:
|
|
4
|
+
Dependencies: imports from [typer, rich.console, typing, __version__] | imported by [setup.py entry_points, __main__.py] | loads commands from [cli/commands/{init, create, deploy, auth, status, reset, doctor, browser}_commands.py] | tested by [tests/cli/test_cli_help.py]
|
|
5
|
+
Data flow: cli() entry point → creates Typer app → registers command callbacks (init, create, deploy, auth, status, reset, doctor, browser) → Typer parses args → invokes corresponding handle_*() function from commands module → command outputs via rich.Console
|
|
6
|
+
State/Effects: no persistent state | writes to stdout via rich.Console | lazy imports command handlers on invocation | registers typer.Option and typer.Argument decorators | uses typer.Exit() for early termination
|
|
7
|
+
Integration: exposes cli() entry point registered in setup.py as 'co' command | app() is the Typer instance | commands: init, create, deploy, auth [google|microsoft], status, reset, doctor, browser | --version flag shows version | -b/--browser flag shortcuts browser command | no args shows custom help via _show_help()
|
|
8
|
+
Performance: fast startup (lazy imports) | Typer arg parsing is O(n) args | Rich console initialization is lightweight
|
|
9
|
+
Errors: typer.Exit() on --version or --browser | invalid commands show Typer error with suggestions | command-specific errors handled in respective handlers
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
import typer
|
|
13
|
+
from rich.console import Console
|
|
14
|
+
from typing import Optional
|
|
15
|
+
|
|
16
|
+
from .. import __version__
|
|
17
|
+
|
|
18
|
+
console = Console()
|
|
19
|
+
app = typer.Typer(add_completion=False, no_args_is_help=False)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def version_callback(value: bool):
|
|
23
|
+
if value:
|
|
24
|
+
console.print(f"co {__version__}")
|
|
25
|
+
raise typer.Exit()
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@app.callback(invoke_without_command=True)
|
|
29
|
+
def main(
|
|
30
|
+
ctx: typer.Context,
|
|
31
|
+
version: bool = typer.Option(False, "--version", "-v", callback=version_callback, is_eager=True),
|
|
32
|
+
browser: Optional[str] = typer.Option(None, "-b", "--browser", help="Quick browser command"),
|
|
33
|
+
):
|
|
34
|
+
"""ConnectOnion - A simple Python framework for creating AI agents."""
|
|
35
|
+
if browser:
|
|
36
|
+
from .commands.browser_commands import handle_browser
|
|
37
|
+
handle_browser(browser)
|
|
38
|
+
raise typer.Exit()
|
|
39
|
+
if ctx.invoked_subcommand is None:
|
|
40
|
+
_show_help()
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
def _show_help():
|
|
44
|
+
"""Show help message."""
|
|
45
|
+
console.print()
|
|
46
|
+
console.print(f"[bold cyan]co[/bold cyan] - ConnectOnion v{__version__}")
|
|
47
|
+
console.print()
|
|
48
|
+
console.print("A simple Python framework for creating AI agents.")
|
|
49
|
+
console.print()
|
|
50
|
+
console.print("[bold]Quick Start:[/bold]")
|
|
51
|
+
console.print(" [cyan]co create my-agent[/cyan] Create new agent project")
|
|
52
|
+
console.print(" [cyan]cd my-agent && python agent.py[/cyan] Run your agent")
|
|
53
|
+
console.print()
|
|
54
|
+
console.print("[bold]Commands:[/bold]")
|
|
55
|
+
console.print(" [green]create[/green] <name> Create new project")
|
|
56
|
+
console.print(" [green]init[/green] Initialize in current directory")
|
|
57
|
+
console.print(" [green]deploy[/green] Deploy to ConnectOnion Cloud")
|
|
58
|
+
console.print(" [green]auth[/green] Authenticate for managed keys")
|
|
59
|
+
console.print(" [green]status[/green] Check account balance")
|
|
60
|
+
console.print(" [green]doctor[/green] Diagnose installation")
|
|
61
|
+
console.print()
|
|
62
|
+
console.print("[bold]Docs:[/bold] https://docs.connectonion.com")
|
|
63
|
+
console.print("[bold]Discord:[/bold] https://discord.gg/4xfD9k8AUF")
|
|
64
|
+
console.print()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@app.command()
|
|
68
|
+
def init(
|
|
69
|
+
template: Optional[str] = typer.Option(None, "-t", "--template", help="Template: minimal, playwright, custom"),
|
|
70
|
+
yes: bool = typer.Option(False, "-y", "--yes", help="Skip prompts"),
|
|
71
|
+
key: Optional[str] = typer.Option(None, "--key", help="API key"),
|
|
72
|
+
description: Optional[str] = typer.Option(None, "--description", help="Description for custom template"),
|
|
73
|
+
force: bool = typer.Option(False, "--force", help="Overwrite existing files"),
|
|
74
|
+
):
|
|
75
|
+
"""Initialize project in current directory."""
|
|
76
|
+
from .commands.init import handle_init
|
|
77
|
+
handle_init(ai=None, key=key, template=template, description=description, yes=yes, force=force)
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
@app.command()
|
|
81
|
+
def create(
|
|
82
|
+
name: Optional[str] = typer.Argument(None, help="Project name"),
|
|
83
|
+
template: Optional[str] = typer.Option(None, "-t", "--template", help="Template: minimal, playwright, custom"),
|
|
84
|
+
yes: bool = typer.Option(False, "-y", "--yes", help="Skip prompts"),
|
|
85
|
+
key: Optional[str] = typer.Option(None, "--key", help="API key"),
|
|
86
|
+
description: Optional[str] = typer.Option(None, "--description", help="Description for custom template"),
|
|
87
|
+
):
|
|
88
|
+
"""Create new project."""
|
|
89
|
+
from .commands.create import handle_create
|
|
90
|
+
handle_create(name=name, ai=None, key=key, template=template, description=description, yes=yes)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
@app.command()
|
|
94
|
+
def deploy():
|
|
95
|
+
"""Deploy to ConnectOnion Cloud."""
|
|
96
|
+
from .commands.deploy_commands import handle_deploy
|
|
97
|
+
handle_deploy()
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
@app.command()
|
|
101
|
+
def auth(service: Optional[str] = typer.Argument(None, help="Service: google, microsoft")):
|
|
102
|
+
"""Authenticate with OpenOnion."""
|
|
103
|
+
if service == "google":
|
|
104
|
+
from .commands.auth_commands import handle_google_auth
|
|
105
|
+
handle_google_auth()
|
|
106
|
+
elif service == "microsoft":
|
|
107
|
+
from .commands.auth_commands import handle_microsoft_auth
|
|
108
|
+
handle_microsoft_auth()
|
|
109
|
+
else:
|
|
110
|
+
from .commands.auth_commands import handle_auth
|
|
111
|
+
handle_auth()
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
@app.command()
|
|
115
|
+
def status():
|
|
116
|
+
"""Check account status."""
|
|
117
|
+
from .commands.status_commands import handle_status
|
|
118
|
+
handle_status()
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
@app.command()
|
|
122
|
+
def reset():
|
|
123
|
+
"""Reset account (destructive)."""
|
|
124
|
+
from .commands.reset_commands import handle_reset
|
|
125
|
+
handle_reset()
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
@app.command()
|
|
129
|
+
def doctor():
|
|
130
|
+
"""Diagnose installation."""
|
|
131
|
+
from .commands.doctor_commands import handle_doctor
|
|
132
|
+
handle_doctor()
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
@app.command()
|
|
136
|
+
def browser(command: str = typer.Argument(..., help="Browser command")):
|
|
137
|
+
"""Browser automation."""
|
|
138
|
+
from .commands.browser_commands import handle_browser
|
|
139
|
+
handle_browser(command)
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def cli():
|
|
143
|
+
"""Entry point."""
|
|
144
|
+
app()
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
if __name__ == "__main__":
|
|
148
|
+
cli()
|
|
@@ -0,0 +1,287 @@
|
|
|
1
|
+
# ConnectOnion Agent Project
|
|
2
|
+
|
|
3
|
+
Welcome to your ConnectOnion agent project! This README will guide you through the project structure and how to get started.
|
|
4
|
+
|
|
5
|
+
## 🚀 Quick Start
|
|
6
|
+
|
|
7
|
+
1. **Add your OpenAI API key**:
|
|
8
|
+
```bash
|
|
9
|
+
# Edit .env file (already created for you)
|
|
10
|
+
# Replace 'sk-your-api-key-here' with your actual OpenAI API key
|
|
11
|
+
nano .env # or use any text editor
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
2. **Install dependencies**:
|
|
15
|
+
```bash
|
|
16
|
+
pip install connectonion
|
|
17
|
+
pip install python-dotenv # For loading .env files
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
3. **Run your agent**:
|
|
21
|
+
```bash
|
|
22
|
+
python agent.py
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 📁 Project Structure
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
your-project/
|
|
29
|
+
├── agent.py # Main agent implementation
|
|
30
|
+
├── prompts/ # System prompts directory
|
|
31
|
+
│ ├── metagent.md # Main system prompt
|
|
32
|
+
│ ├── docs_retrieve_prompt.md # Documentation retrieval prompt
|
|
33
|
+
│ ├── answer_prompt.md # Answer generation prompt
|
|
34
|
+
│ └── think_prompt.md # Reflection/thinking prompt
|
|
35
|
+
├── .env # Environment configuration (add your API key here)
|
|
36
|
+
├── .co/ # ConnectOnion metadata
|
|
37
|
+
│ ├── config.toml # Project configuration
|
|
38
|
+
│ ├── keys/ # Agent cryptographic keys (git-ignored)
|
|
39
|
+
│ └── docs/
|
|
40
|
+
│ └── co-vibecoding-principles-docs-contexts-all-in-one.md # Complete VibeCoding & framework docs
|
|
41
|
+
├── todo.md # To-do list (created by agent)
|
|
42
|
+
└── README.md # This file
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## 🤖 About the Meta-Agent
|
|
46
|
+
|
|
47
|
+
The Meta-Agent is your AI assistant specialized in ConnectOnion development. It helps you:
|
|
48
|
+
|
|
49
|
+
- **Answer questions** about ConnectOnion using embedded documentation
|
|
50
|
+
- **Generate code** for agents, tools, and tests
|
|
51
|
+
- **Plan projects** with structured to-do lists
|
|
52
|
+
- **Execute commands** cross-platform (bash/PowerShell)
|
|
53
|
+
- **Reflect and think** about task progress
|
|
54
|
+
|
|
55
|
+
## 🛠️ Available Tools
|
|
56
|
+
|
|
57
|
+
### Core Documentation Tools
|
|
58
|
+
|
|
59
|
+
- **`answer_connectonion_question(question)`** - Get expert answers about ConnectOnion
|
|
60
|
+
- Uses `llm_do()` with intelligent document retrieval
|
|
61
|
+
- Searches embedded documentation for relevant content
|
|
62
|
+
- Provides accurate, context-aware responses
|
|
63
|
+
|
|
64
|
+
- **`extract_relevant_connectonion_text(question)`** - Extract relevant documentation
|
|
65
|
+
- Internal helper for documentation retrieval
|
|
66
|
+
- Uses GPT-4o-mini for intelligent extraction
|
|
67
|
+
|
|
68
|
+
### Task Management
|
|
69
|
+
|
|
70
|
+
- **`add_todo(task)`** - Add tasks to your to-do list
|
|
71
|
+
- **`delete_todo(task)`** - Remove completed tasks
|
|
72
|
+
- **`list_todos()`** - View current to-do list
|
|
73
|
+
|
|
74
|
+
### Reflection & Planning
|
|
75
|
+
|
|
76
|
+
- **`think(context)`** - AI reflection on current progress
|
|
77
|
+
- Analyzes conversation history
|
|
78
|
+
- Identifies accomplishments and blockers
|
|
79
|
+
- Suggests next steps
|
|
80
|
+
|
|
81
|
+
### System Operations
|
|
82
|
+
|
|
83
|
+
- **`run_shell(command)`** - Execute shell commands
|
|
84
|
+
- Cross-platform support (macOS/Linux/Windows)
|
|
85
|
+
- Returns stdout, stderr, and exit codes
|
|
86
|
+
- Configurable timeout (default: 120s)
|
|
87
|
+
|
|
88
|
+
## 🎯 How to Use the Agent
|
|
89
|
+
|
|
90
|
+
### Interactive Mode
|
|
91
|
+
|
|
92
|
+
Run the agent and interact via the command line:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
python agent.py
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Example interactions:
|
|
99
|
+
```
|
|
100
|
+
You: How do tools work in ConnectOnion?
|
|
101
|
+
Assistant: [Provides detailed explanation from documentation]
|
|
102
|
+
|
|
103
|
+
You: Create a to-do list for building a web scraper
|
|
104
|
+
Assistant: [Generates structured task list]
|
|
105
|
+
|
|
106
|
+
You: Run ls -la to see the files
|
|
107
|
+
Assistant: [Executes command and shows output]
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### Programmatic Usage
|
|
111
|
+
|
|
112
|
+
Import and use the agent in your code:
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from agent import agent
|
|
116
|
+
|
|
117
|
+
# Ask a question
|
|
118
|
+
result = agent.input("How do I create custom tools?")
|
|
119
|
+
print(result)
|
|
120
|
+
|
|
121
|
+
# Execute multiple tasks
|
|
122
|
+
agent.input("Add todo: Research web scraping libraries")
|
|
123
|
+
agent.input("Add todo: Create prototype scraper")
|
|
124
|
+
todos = agent.input("List all todos")
|
|
125
|
+
print(todos)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## 📖 VibeCoding Documentation
|
|
129
|
+
|
|
130
|
+
The `.co/docs/co-vibecoding-principles-docs-contexts-all-in-one.md` file contains complete VibeCoding principles and ConnectOnion framework documentation. This comprehensive guide includes:
|
|
131
|
+
|
|
132
|
+
- **Framework Overview**: Core concepts and architecture
|
|
133
|
+
- **Agent Development**: Building intelligent agents with tools
|
|
134
|
+
- **LLM Integration**: Using `llm_do()` for AI-powered functionality
|
|
135
|
+
- **Tool System**: Creating and using custom tools
|
|
136
|
+
- **Best Practices**: Design patterns and coding guidelines
|
|
137
|
+
- **API Reference**: Complete API documentation
|
|
138
|
+
|
|
139
|
+
### 🤖 Using with AI Coding Assistants
|
|
140
|
+
|
|
141
|
+
If you're using AI-powered coding assistants like **Cursor**, **Claude Code**, or **GitHub Copilot**, you can leverage the Vibe Coding documentation for better assistance:
|
|
142
|
+
|
|
143
|
+
1. **Point your AI assistant to the doc**: Reference `.co/docs/co-vibecoding-principles-docs-contexts-all-in-one.md` when asking questions about ConnectOnion
|
|
144
|
+
2. **Get framework-specific help**: The documentation helps AI assistants understand ConnectOnion's patterns and best practices
|
|
145
|
+
3. **Consistent coding style**: AI assistants will follow the framework's conventions when generating code
|
|
146
|
+
|
|
147
|
+
Example prompt for your AI assistant:
|
|
148
|
+
```
|
|
149
|
+
Please read .co/docs/co-vibecoding-principles-docs-contexts-all-in-one.md to understand
|
|
150
|
+
the ConnectOnion framework and VibeCoding principles, then help me create a custom tool for [your task]
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
This documentation is embedded locally in your project for offline access. The Meta-Agent can also answer questions about ConnectOnion by referencing this documentation.
|
|
154
|
+
|
|
155
|
+
## 📚 Understanding the Architecture
|
|
156
|
+
|
|
157
|
+
### LLM Function (`llm_do`)
|
|
158
|
+
|
|
159
|
+
The Meta-Agent uses ConnectOnion's `llm_do()` function for intelligent operations:
|
|
160
|
+
|
|
161
|
+
```python
|
|
162
|
+
from connectonion import llm_do
|
|
163
|
+
|
|
164
|
+
# Simple usage
|
|
165
|
+
answer = llm_do("What's 2+2?")
|
|
166
|
+
|
|
167
|
+
# With structured output
|
|
168
|
+
from pydantic import BaseModel
|
|
169
|
+
|
|
170
|
+
class Analysis(BaseModel):
|
|
171
|
+
sentiment: str
|
|
172
|
+
confidence: float
|
|
173
|
+
|
|
174
|
+
result = llm_do(
|
|
175
|
+
"I love this product!",
|
|
176
|
+
output=Analysis
|
|
177
|
+
)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
### System Prompts
|
|
181
|
+
|
|
182
|
+
Prompts are stored as markdown files for better maintainability:
|
|
183
|
+
|
|
184
|
+
- **`metagent.md`** - Main personality and capabilities
|
|
185
|
+
- **`docs_retrieve_prompt.md`** - Instructions for document extraction
|
|
186
|
+
- **`answer_prompt.md`** - Guidelines for answering questions
|
|
187
|
+
- **`think_prompt.md`** - Framework for reflection
|
|
188
|
+
|
|
189
|
+
### The Agent Loop
|
|
190
|
+
|
|
191
|
+
1. User provides input
|
|
192
|
+
2. Agent processes with LLM (GPT-4o-mini by default)
|
|
193
|
+
3. LLM decides which tools to call
|
|
194
|
+
4. Tools execute and return results
|
|
195
|
+
5. Process repeats up to `max_iterations` (15 for Meta-Agent)
|
|
196
|
+
6. Final response returned to user
|
|
197
|
+
|
|
198
|
+
## 🔧 Customization
|
|
199
|
+
|
|
200
|
+
### Modify Tools
|
|
201
|
+
|
|
202
|
+
Edit `agent.py` to add your own tools:
|
|
203
|
+
|
|
204
|
+
```python
|
|
205
|
+
def my_custom_tool(param: str) -> str:
|
|
206
|
+
"""Description for the LLM."""
|
|
207
|
+
return f"Processed: {param}"
|
|
208
|
+
|
|
209
|
+
# Add to agent
|
|
210
|
+
agent = Agent(
|
|
211
|
+
name="meta_agent",
|
|
212
|
+
tools=[
|
|
213
|
+
answer_connectonion_question,
|
|
214
|
+
think,
|
|
215
|
+
my_custom_tool, # Your new tool
|
|
216
|
+
# ... other tools
|
|
217
|
+
]
|
|
218
|
+
)
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
### Adjust Behavior
|
|
222
|
+
|
|
223
|
+
Modify system prompts in the `prompts/` directory to change agent personality and behavior.
|
|
224
|
+
|
|
225
|
+
### Change Models
|
|
226
|
+
|
|
227
|
+
Update the model parameter:
|
|
228
|
+
|
|
229
|
+
```python
|
|
230
|
+
agent = Agent(
|
|
231
|
+
name="meta_agent",
|
|
232
|
+
model="gpt-4", # Use GPT-4 instead of GPT-4o-mini
|
|
233
|
+
# ...
|
|
234
|
+
)
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
## 📖 Documentation Access
|
|
238
|
+
|
|
239
|
+
The embedded ConnectOnion documentation is available at:
|
|
240
|
+
`.co/docs/co-vibecoding-principles-docs-contexts-all-in-one.md`
|
|
241
|
+
|
|
242
|
+
This comprehensive reference includes:
|
|
243
|
+
- Framework overview and concepts
|
|
244
|
+
- API reference
|
|
245
|
+
- Code examples
|
|
246
|
+
- Best practices
|
|
247
|
+
- Troubleshooting guide
|
|
248
|
+
|
|
249
|
+
The Meta-Agent automatically searches this documentation to answer your questions.
|
|
250
|
+
|
|
251
|
+
## 🐛 Debugging
|
|
252
|
+
|
|
253
|
+
Use the `@xray` decorator for debugging tools:
|
|
254
|
+
|
|
255
|
+
```python
|
|
256
|
+
from connectonion import xray
|
|
257
|
+
|
|
258
|
+
@xray
|
|
259
|
+
def debug_tool(text: str) -> str:
|
|
260
|
+
print(f"Agent: {xray.agent.name}")
|
|
261
|
+
print(f"Task: {xray.task}")
|
|
262
|
+
print(f"Iteration: {xray.iteration}")
|
|
263
|
+
return "Done"
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
## 🔗 Resources
|
|
267
|
+
|
|
268
|
+
- **GitHub**: https://github.com/openonion/connectonion
|
|
269
|
+
- **Documentation**: https://connectonion.com/docs
|
|
270
|
+
- **PyPI**: https://pypi.org/project/connectonion/
|
|
271
|
+
- **Discord**: https://discord.gg/4xfD9k8AUF
|
|
272
|
+
|
|
273
|
+
## 💡 Tips
|
|
274
|
+
|
|
275
|
+
1. **Start Simple**: Test basic commands before complex workflows
|
|
276
|
+
2. **Check Documentation**: Use `answer_connectonion_question()` for framework questions
|
|
277
|
+
3. **Track Progress**: Use the to-do tools to manage tasks
|
|
278
|
+
4. **Review Prompts**: Customize prompts for your specific needs
|
|
279
|
+
5. **Monitor Iterations**: Increase `max_iterations` for complex tasks
|
|
280
|
+
|
|
281
|
+
## 🤝 Contributing
|
|
282
|
+
|
|
283
|
+
Feel free to extend this agent with your own tools and improvements. Share your creations with the ConnectOnion community!
|
|
284
|
+
|
|
285
|
+
## 📝 License
|
|
286
|
+
|
|
287
|
+
This project uses ConnectOnion, which is open source. Check the main repository for license details.
|