Skip to main content

auto-base

A thin wrapper for the ag2 library, providing a simplified interface for easy usage.

Installation

pip install auto-base

This will automatically install the required dependency ag2.

Usage

Basic Usage

from auto_base import AutoBase

# Create an instance of the wrapper
auto = AutoBase()

# Check if ag2 is available
print(f"ag2 available: {auto.ag2_available}")

# Access autogen attributes directly
print(auto.DEFAULT_MODEL)  # Access autogen constants

# Get raw autogen instance
autogen_raw = auto.autogen

Agent Creation

from auto_base import AutoBase

auto = AutoBase()

# Create AssistantAgent
assistant = auto.create_assistant_agent(
    name="assistant",
    system_message="You are a helpful AI assistant",
    llm_config={
        "temperature": 0.7,
        "config_list": [
            {"model": "gpt-4", "api_key": "YOUR_API_KEY"}
        ]
    }
)

# Create UserProxyAgent
user_proxy = auto.create_user_proxy_agent(
    name="user_proxy",
    code_execution_config={"use_docker": False},  # Disable docker for code execution
    human_input_mode="NEVER"  # No human input required
)

# Create GroupChat
groupchat = auto.create_group_chat(
    agents=[assistant, user_proxy],
    messages=[],
    max_round=5,
    speaker_selection_method="auto"
)

# Create GroupChatManager
groupchat_manager = auto.create_group_chat_manager(
    groupchat=groupchat,
    llm_config={
        "config_list": [
            {"model": "gpt-4", "api_key": "YOUR_API_KEY"}
        ]
    }
)

Configuration Management

from auto_base import AutoBase

auto = AutoBase()

# Load config from dotenv file
config_list = auto.config_list_from_dotenv(
    dotenv_file_path=".env"
)

# Load config from JSON file
# config_list = auto.config_list_from_json(
#     file_path="OAI_CONFIG_LIST.json",
#     filter_dict={"model": ["gpt-4", "gpt-3.5-turbo"]}
# )

# Get GPT-4 and GPT-3.5 config list
# config_list = auto.config_list_gpt4_gpt35()

Function Registration

from auto_base import AutoBase

auto = AutoBase()

# Define a function to register
def add_numbers(a, b):
    """Add two numbers together"""
    return a + b

# Register the function
user_proxy = auto.create_user_proxy_agent(name="user_proxy")
auto.register_function(
    func=add_numbers,
    callable_agent=user_proxy,
    name="add_numbers",
    description="Add two numbers together"
)

Initiating Chats

from auto_base import AutoBase

auto = AutoBase()

# Create agents
assistant = auto.create_assistant_agent(name="assistant", system_message="You are helpful")
user_proxy = auto.create_user_proxy_agent(name="user_proxy", human_input_mode="NEVER")

# Initiate a chat between two agents
result = auto.initiate_chat(
    sender=user_proxy,
    receiver=assistant,
    message="What is the capital of France?"
)

# Or with group chat
# groupchat = auto.create_group_chat(agents=[assistant, user_proxy])
# manager = auto.create_group_chat_manager(groupchat=groupchat)
# result = auto.initiate_group_chat(
#     group_chat_manager=manager,
#     message="What is the capital of France?"
# )

Features

  • Thin wrapper around autogen library with optional ag2 support
  • Simplified API for creating and managing autogen agents
  • Easy agent creation: AssistantAgent, UserProxyAgent, GroupChat, GroupChatManager
  • Convenient configuration management
  • Simplified function registration for agent use
  • Easy chat initiation between agents
  • Optional ag2 integration (available if ag2 is installed)
  • Backward compatible with direct autogen access
  • Well-documented with usage examples

Development

Installation for Development

# Clone the repository
git clone https://github.com/yourusername/auto-base.git
cd auto-base

# Install in development mode
pip install -e .

Running Tests

python test_wrapper.py

License

MIT

Metadata

Release files for auto-base 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for auto-base 0.1.0
File Size Uploaded
auto_base-0.1.0.tar.gz 5.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for auto-base 0.1.0
File Interpreter ABI Platform
auto_base-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.1 kB

Release files / auto_base-0.1.0.tar.gz

Download URL auto_base-0.1.0.tar.gz
Size 5.6 kB
Tags Source
SHA-256 checksum
How to use checksums
386264ac68abf0cfb7cf433149cba7cbceb71fdc64abd0c83da86b85a66ba741
BLAKE2b-256 checksum
How to use checksums
3dba7882aeecf9b3c373d5df1a801df45ed40d9e0504e2ebb7c5c71b2dfeef8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / auto_base-0.1.0-py3-none-any.whl

Download URL auto_base-0.1.0-py3-none-any.whl
Size 5.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68e44b3ed6ffc8897004424eab37371d2a586fdffb52e873e6c0d7e810267149
BLAKE2b-256 checksum
How to use checksums
675ad0ccfe8f4849f6785496fe8c47206d6c3476ae99aa84d58c8e47a7e0b8d7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page