Agent Building Examples
Master ConnectOnion through practical examples, from simple fundamentals to advanced automation
Progressive Learning Path
1
Calculator
Learn the basics
2
Browser
Advanced automation
Calculator AgentStart Here
BeginnerLearn the fundamentals with a simple math calculator that demonstrates tool creation, input validation, and error handling
What you'll learn:
Function toolsInput validationError handlingSafe evaluation
Code Preview
def calculate(expression: str) -> str:
# Validate input safety
allowed = set('0123456789+-*/()., ')
if not all(c in allowed for c in expression):
return "Error: Invalid characters"
try:
result = eval(expression)
return str(result)
except:
return "Error: Invalid expression"
Browser Automation
IntermediateControl web browsers with natural language using Playwright integration for screenshots, scraping, and automation
What you'll learn:
Browser controlScreenshotsWeb scrapingNatural language commands
Code Preview
# Control browser with natural language
agent.input("Navigate to example.com")
agent.input("Take a screenshot")
agent.input("Extract all links from the page")
agent.input("Fill search box with 'AI' and submit")
Ready to Build Your First Agent?
Start with the Calculator example to learn the fundamentals, then advance to Browser automation
Start with Calculator