ConnectOnionConnectOnion
Tutorial 0015 min read

AI Agent = Prompt + Function

The truth about those $199 courses - and why you don't need them

The Truth About Those $199 Courses

People are selling expensive courses for what's essentially a simple concept:

"Master LangChain in 30 Days!"$199
"AutoGen Expert Certification"$299
"Complete CrewAI Bootcamp"$499

The "Secret" Formula

AI Agent = Prompt + Function

That's it. That's the entire course. Let me show you why.

Why I Built ConnectOnion

I was building a project with LangChain and got frustrated:

  • Simple agent required 100+ lines of code
  • Documentation was incomprehensible
  • Every update broke my code

See the Difference

LangChain: 67 lines of complexity

main.py
1from langchain.agents import Tool, AgentExecutor, LLMSingleActionAgent 2from langchain.prompts import StringPromptTemplate 3from langchain.chains import LLMChain 4from langchain.schema import AgentAction, AgentFinish 5from langchain.chat_models import ChatOpenAI 6# ... 20 more imports ... 7 8class CustomPromptTemplate(StringPromptTemplate): 9 # ... 30 lines of boilerplate ... 10 11class CustomOutputParser: 12 # ... 25 lines of parsing logic ... 13 14# Finally create the agent (line 67) 15agent_executor = AgentExecutor.from_agent_and_tools(...) 16result = agent_executor.run("What's the weather in San Francisco?")
Python REPL
Interactive
Getting weather for San Francisco... The weather in San Francisco is sunny, 72°F

ConnectOnion: 5 lines of simplicity

main.py
1from connectonion import Agent 2 3def get_weather(city: str) -> str: 4 return f"The weather in {city} is sunny, 72°F" 5 6agent = Agent("weather_bot", tools=[get_weather]) 7result = agent.input("What's the weather in San Francisco?")
Python REPL
Interactive
Getting weather for San Francisco... The weather in San Francisco is sunny, 72°F

Same result. 93% less code.

Get Started in 30 Seconds

1Install the package

Terminal
$pip install connectonion

2Write your first agent

main.py
1from connectonion import Agent 2 3agent = Agent("assistant") 4result = agent.input("What's 2+2?") 5print(result)
Python REPL
Interactive
4

What You'll Learn

AI agents are just ChatGPT that can call functions
You don't need complex abstractions
Simple solutions are often the best solutions

Ready to Build?