ConnectOnionConnectOnion

CLI Reference

Quickly scaffold and manage ConnectOnion agent projects with the CLI.

Installation

The CLI is automatically installed when you install ConnectOnion:

Terminal
$pip install connectonion

This provides two equivalent commands: co (short form) and connectonion (full form)

co init

Initialize a new ConnectOnion agent project in the current directory.

Basic Usage

Create meta-agent (default)
$mkdir meta-agent
$cd meta-agent
$co init
Create web automation agent
$mkdir playwright-agent
$cd playwright-agent
$co init --template playwright

Options

OptionDescription
--template, -tChoose a template: meta-agent (default),playwright
--forceOverwrite existing files

What Gets Created

Meta-Agent (default)

Files created:

my-project/
├──🐍agent.py
├──prompts/
├──metagent.md
├──docs_retrieve_prompt.md
├──answer_prompt.md
└──think_prompt.md
├──README.md
├──.env.example
└──.co/

Playwright Template

Files created:

my-project/
├──🐍agent.py
├──prompt.md
├──.env.example
├──.co/
├──config.toml
└──docs/
└──connectonion.md
└──.gitignore

Templates

Meta-Agent (Default)

A ConnectOnion development assistant powered by llm_do() for intelligent operations:

answer_connectonion_question()

Uses llm_do() for intelligent doc retrieval

think()

AI reflection on task progress

add_todo() / delete_todo()

Task management functions

run_shell()

Generate pytest test suites

think()

Self-reflection on tasks

generate_todo_list()

Create structured plans (GPT-4o-mini)

suggest_project_structure()

Architecture recommendations

Example usage
1# Learn about ConnectOnion
2result = agent.input("What is ConnectOnion and how do tools work?")
3
4# Generate agent code
5result = agent.input("Create a web scraper agent")
6
7# Create tool functions
8result = agent.input("Generate a tool for sending emails")

Playwright Template

Web automation agent with stateful browser control:

start_browser()

Launch browser instance

navigate()

Go to URLs

scrape_content()

Extract page content

fill_form()

Fill and submit forms

take_screenshot()

Capture pages

extract_links()

Get all links

execute_javascript()

Run JS code

close_browser()

Clean up resources

Note: Requires running the following command first:

Terminal
$pip install playwright && playwright install

Interactive Features

The CLI will:

  • Warn if you're in a special directory (home, root, system)
  • Ask for confirmation if the directory is not empty
  • Automatically detect git repositories and update .gitignore
  • Provide clear next steps after initialization

Best Practices

Use Markdown for Prompts

Always store system prompts in prompt.md files for better formatting and readability.

Environment Variables

Never commit .env files. Use .env.example as a template.

Git Integration

The CLI automatically handles .gitignore for git repositories.

Embedded Documentation

The docs in .co/docs/ allow agents to work offline.

Troubleshooting

Python Version

ConnectOnion requires Python 3.8 or higher. Check your version:

Terminal
$python --version

API Keys Setup

After running co init, set up your API keys:

Terminal
$cp .env.example .env
$# Edit .env and add your actual API keys
$nano .env # or use your preferred editor