Introducing Connect Onion — Build AI Agents with Just Python Functions
Connect Onion is a lightweight agent framework for Python that transforms regular functions into powerful AI tools.
It focuses on simplicity, transparency, and speed, no verbose chains, no overengineered agent classes, no role hierarchies. Just tools, memory, and prompts.
Why Connect Onion?
Connect Onion solves the pain points developers often face with agent SDKs like LangChain, AutoGen, and CrewAI:
- Functions = Tools — no decorators, no schemas to define
- Auto type inference from function annotations
- Built-in system prompts, memory, trust, and iteration limits
- xray decorator to visualize agent thinking
- CLI support for rapid local iteration
- Fully compatible with OpenAI LLMs
Other frameworks introduce layers of abstraction that make agents harder to debug and maintain. Connect Onion takes the opposite approach. Start simple, and layer complexity only if you need it.
Example: Your First Agent
Here’s how to go from function to agent in 5 lines:
from connectonion import Agent
def get_weather(city: str) -> str:
return f"Weather in {city}: sunny, 72°F"
agent = Agent("weather_bot", tools=[get_weather])
print(agent.input("What's the weather in NYC?"))
That’s a working agent.
It auto-generates a tool schema based on your function signature.
You can add memory, change system prompts, or customise its behaviour with zero boilerplate.
Installation
pip install connectonion
Features Overview
Feature | Connect Onion |
---|---|
Setup Time | 60 seconds |
Tool Integration | Just Python functions |
Type Safety | Type-hint based |
System Prompts | Built-in |
Debugging |
@xray decorator |
Agent Loop | Max iterations, trust filter |
Production Ready | Yes |
Learn More
The project is currently in early beta (v0.0.1b6) and under active development. Feedback, issues, and contributions are more than welcome!
There’s a full tutorial on building your first agent here in the docs.
Connect Onion is for developers who want to connect AI to their apps without learning an entire new framework. If you can write a Python function, you can build an agent.
Top comments (1)
Interesting, I was recently exploring this agent tech, was trying out n8n. Need to give this a try as well.
Agents are really supporting us in many ways, one way is through speeding up my coding workflow.
But over time, the code became prime to bugs and redundancies. So I thought of building LiveReview, an AI based code review tool that takes a look at your code and gives comments on the potential bugs and improvements which you can make.
So agentic AI + AI companions like LiveReview is making my coding flow fast as well as accurate.