Smart AI agent with reasoning and tool use capabilities
Project description
Smart Agent
A powerful AI agent chatbot that leverages external tools to augment its intelligence rather than being constrained by built-in capabilities, enabling more accurate, verifiable, and adaptable problem-solving capabilities for practical AI application development.
Features
- Unified API Access: Uses AsyncOpenAI client making it API provider agnostic
- Integrated Tools: Python REPL, browser automation, and more
- Configuration-Driven: Simple YAML configuration for all settings
- LiteLLM Support: Easily connect to Claude, GPT, and other models
- CLI Interface: Intuitive commands for all operations
Overview
Smart Agent represents a breakthrough in AI agent capabilities by combining three key technologies:
-
Claude 3.7 Sonnet with Think Tool: The core innovation is the discovery that Claude 3.7 Sonnet's "Think" Tool unlocks powerful reasoning capabilities even without explicit thinking mode. This tool grounds the agent's reasoning process, enabling it to effectively use external tools - a capability that pure reasoning models typically struggle with.
-
OpenAI Agents Framework: This robust framework orchestrates the agent's interactions, managing the flow between reasoning and tool use to create a seamless experience.
The combination of these technologies creates an agent that can reason effectively while using tools to extend its capabilities beyond what's possible with traditional language models alone.
Key Features
- Grounded Reasoning: The Think Tool enables the agent to pause, reflect, and ground its reasoning process
- Tool Augmentation: Extends capabilities through external tools rather than being limited to built-in knowledge
- Verifiable Problem-Solving: Tools provide factual grounding that makes solutions more accurate and verifiable
- Adaptable Intelligence: Easily extend capabilities by adding new tools without retraining the model
Model Context Protocol (MCP) Integration
Smart Agent is an AI assistant that integrates with the Model Context Protocol (MCP) to provide a unified interface for AI-powered tools and services.
Key Features
- Unified Tool Architecture: All tools follow the Model Context Protocol for consistent integration
- Flexible Deployment Options: Run locally or connect to remote tools
- Secure Tool Execution: Docker isolation for tools that require it
- Standardized Communication: Server-Sent Events (SSE) for all tool interactions
How Smart Agent Uses MCP
Smart Agent implements the MCP client-server architecture:
- Smart Agent (MCP Client): Acts as the client that connects to various tool servers
- Tool Servers (MCP Servers): Each tool exposes capabilities through the standardized protocol
- Supergateway: Converts stdio-based tools to SSE endpoints following the MCP specification
This architecture allows Smart Agent to:
- Dynamically discover and use tools through the
tools/listendpoint - Invoke tool actions via the
tools/callendpoint - Maintain a consistent interface regardless of whether tools are local or remote
Prerequisites
- Python 3.9+
- Node.js and npm (required for running tools via supergateway)
- Docker (for running LiteLLM proxy and container-based tools)
- Git (for installation from source)
- API keys for language models
Installation
Setting Up a Virtual Environment (Recommended)
It's best practice to use a virtual environment for Python projects:
# Create a virtual environment
python -m venv venv
# Activate the virtual environment
# On macOS/Linux:
source venv/bin/activate
# On Windows:
# venv\Scripts\activate
# Ensure pip is up to date
pip install --upgrade pip
Installing Smart Agent
# Install from PyPI
pip install smart-agent
# Install with monitoring support
pip install smart-agent[monitoring]
# Install from source
git clone https://github.com/ddkang1/smart-agent.git
cd smart-agent
pip install -e .
Usage
Smart Agent provides multiple ways to use the tool based on your needs:
Quick Start (Single Session)
For development or quick testing, run Smart Agent with tools managed automatically:
# Run the interactive setup wizard
smart-agent setup --quick # Setup (default is all options)
### After Quick Setup: Configure Your YAML Files
Quick setup just copies example files to your config directory. You'll need to edit these files manually to configure your environment:
1. **Edit `config/config.yaml`**:
2. **Edit `config/tools.yaml`**:
3. **Edit `config/litellm_config.yaml`**:
# Start required services (this must be done before chatting)
smart-agent start# Start all required services (both tools and proxy)
# Start chat session
smart-agent chat
Services must be explicitly started before chatting. The Smart Agent follows a 3-step procedure:
- Setup: Configure your environment
- Start: Launch the required services
- Chat: Begin your conversation with the agent
Development Mode (Persistent Services)
For development when you need tools to stay running between chat sessions:
# Terminal 1: First setup your configuration
smart-agent setup [--all|--quick|--config|--tools|--litellm] # Setup (default is all options)
# Then launch tools and proxy services that keep running
smart-agent start [--all|--tools|--proxy] # Use --tools or --proxy to start specific services
# Terminal 2: Start chat client that connects to running tools
smart-agent chat
# To stop or restart services
smart-agent stop # Stop all services
smart-agent restart # Restart all services
This approach is useful for development when you want to keep tools running between chat sessions.
Production Mode (Remote Tool Services)
Connect to remote tool services running elsewhere (e.g., in production):
# Create configuration through the interactive wizard
smart-agent setup --quick # Setup (default is all options)
# Edit config/tools.yaml to use remote URLs
# Example: url: "https://production-server.example.com/tool-name/sse"
# Start chat client - will automatically detect remote tools
smart-agent chat
In this mode, your tools.yaml contains URLs to remote tool services instead of localhost.
Tool Management
Smart Agent provides a simple way to manage tools through YAML configuration:
# Example tools.yaml configuration
tools:
mcp_think_tool:
enabled: true
repository: "git+https://github.com/ddkang1/mcp-think-tool"
url: "http://localhost:8000/sse"
launch_cmd: "uvx"
ddg_mcp:
enabled: true
repository: "git+https://github.com/ddkang1/ddg-mcp"
url: "http://localhost:8001/sse"
launch_cmd: "uvx"
# Docker container-based tool example
python_repl:
enabled: true
repository: "ghcr.io/ddkang1/mcp-py-repl:latest"
url: "http://localhost:8002/sse"
storage_path: "/path/to/storage"
launch_cmd: "docker"
# Remote tool example (no need for repository or launch_cmd)
remote_tool:
enabled: true
url: "https://api.remote-tool.com/sse"
All tool management is done through the configuration files in the config directory:
- Enable/Disable Tools: Set
enabled: trueorenabled: falsein yourtools.yamlfile - Configure URLs: Set the appropriate URLs for each tool in
tools.yaml - Storage Paths: Configure where tool data is stored with the
storage_pathproperty
No command-line flags are needed - simply edit your configuration files and run the commands.
Configuration
Smart Agent uses YAML configuration files located in the config directory:
config.yaml- Main configuration filetools.yaml- Tool configurationlitellm_config.yaml- LLM provider configuration
The configuration system has been refactored to eliminate duplication between files. The main config now references the LiteLLM config file for model definitions, creating a single source of truth.
Configuration Structure
The main configuration file (config/config.yaml) has the following structure:
# API Configuration
api:
provider: "proxy" # Options: anthropic, bedrock, proxy
base_url: "http://0.0.0.0:4000"
# Model Configuration
model:
name: "claude-3-7-sonnet-20240229"
temperature: 0.0
# Logging Configuration
logging:
level: "INFO"
file: null # Set to a path to log to a file
# Monitoring Configuration
monitoring:
langfuse:
enabled: false
host: "https://cloud.langfuse.com"
# Include tools configuration
tools_config: "config/tools.yaml"
Tool Configuration
Tools are configured in config/tools.yaml with the following structure:
# Example tools.yaml configuration
tools:
mcp_think_tool:
enabled: true
repository: "git+https://github.com/ddkang1/mcp-think-tool"
url: "http://localhost:8000/sse"
launch_cmd: "uvx"
ddg_mcp:
enabled: true
repository: "git+https://github.com/ddkang1/ddg-mcp"
url: "http://localhost:8001/sse"
launch_cmd: "uvx"
# Docker container-based tool example
python_repl:
enabled: true
repository: "ghcr.io/ddkang1/mcp-py-repl:latest"
url: "http://localhost:8002/sse"
storage_path: "/path/to/storage"
launch_cmd: "docker"
# Remote tool example (no need for repository or launch_cmd)
remote_tool:
enabled: true
url: "https://api.remote-tool.com/sse"
Tool Configuration Schema
Each tool in the YAML configuration can have the following properties:
| Property | Description | Required |
|---|---|---|
enabled |
Whether the tool is enabled by default | Yes |
url |
URL for the tool's endpoint | Yes |
repository |
Git repository or Docker image for the tool | Required for local tools, optional for remote SSE tools |
launch_cmd |
Command to launch the tool | Required for local tools ("docker", "uvx", "npx") |
name |
Human-readable name | No (defaults to tool ID) |
storage_path |
Path for tool data storage | No (only for Docker container tools) |
env_prefix |
Environment variable prefix | No (defaults to SMART_AGENT_TOOL_{TOOL_ID_UPPERCASE}) |
Tool Types and Launch Commands
Smart Agent supports two types of tools:
- Remote SSE Tools: Tools that are already running and accessible via a remote URL
- Local stdio Tools: Tools that need to be launched locally and converted to SSE
For local stdio tools, Smart Agent uses supergateway to automatically convert them to SSE. This approach allows for seamless integration with various MCP tools without requiring them to natively support SSE.
The launch_cmd field specifies how the tool should be launched:
- docker: For container-based tools (e.g., Python REPL)
- uvx: For Python packages that use the uvx launcher
- npx: For Node.js-based tools
All local tools are treated as stdio tools and converted to SSE using supergateway, regardless of their type setting in the configuration.
Configuration Management
Smart Agent uses YAML configuration files to manage settings and tools. The configuration is split into two main files:
- config.yaml - Contains API settings, model configurations, and logging options
- tools.yaml - Contains tool-specific settings including URLs and storage paths
The Smart Agent CLI provides commands to help manage these configuration files:
# Run the setup wizard to create configuration files
smart-agent setup [--all|--quick|--config|--tools|--litellm] # Setup (default is all options)
The setup wizard will guide you through creating configuration files based on examples.
Development
Setup Development Environment
If you want to contribute to Smart Agent or modify it for your own needs:
# Clone the repository
git clone https://github.com/ddkang1/smart-agent.git
cd smart-agent
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install development dependencies
pip install -e ".[dev]"
# Run the setup wizard to create configuration files
smart-agent setup [--all|--quick|--config|--tools|--litellm] # Setup (default is all options)
Running Tests
pytest
License
MIT
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file smart_agent-0.5.0.tar.gz.
File metadata
- Download URL: smart_agent-0.5.0.tar.gz
- Upload date:
- Size: 42.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
65ee996cfbf32d8b65bd4ddaae1a2476a9d1d5ef70a0d6bafce45ee08fd4d7bd
|
|
| MD5 |
105f41f06bb72cf00890f20fb2887932
|
|
| BLAKE2b-256 |
09b454d52fcc14cfca0050edd5cc3e56b4e3d9eed0b5227c55e52581d7bf18fb
|
File details
Details for the file smart_agent-0.5.0-py3-none-any.whl.
File metadata
- Download URL: smart_agent-0.5.0-py3-none-any.whl
- Upload date:
- Size: 40.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ace183bfc769f56b47d431401f9dd7a24f7fe6a194e77e6effc31235960502ba
|
|
| MD5 |
fa3c5ac1ba44b4a6b5f785c26f387b82
|
|
| BLAKE2b-256 |
e6905a5ad6a7fb228b9146d71cfe5b82008390212fa95df5db439eb3b13ce547
|