Skip to main content

LLM agents powered by supypowers - build AI agents with tool use, multi-agent orchestration, and secure credential management

Project description

Supyagent

PyPI version Python 3.11+ License: MIT

LLM agents powered by supypowers tools.

Features

  • ๐Ÿค– Interactive & Execution Agents - Chat interactively or run automated pipelines
  • ๐Ÿ”ง Tool Integration - Use any supypowers function as an agent tool
  • ๐ŸŒ Any LLM Provider - Via LiteLLM (OpenAI, Anthropic, Ollama, etc.)
  • ๐Ÿ“ YAML Configuration - Simple, declarative agent definitions
  • ๐Ÿ”„ Session Persistence - Conversations persist across sessions
  • ๐Ÿ” Credential Management - Secure storage for API keys and secrets
  • ๐ŸŽญ Multi-Agent Orchestration - Agents can delegate tasks to other agents
  • ๐Ÿ“ฆ Batch Processing - Process multiple inputs from JSONL/CSV files

Installation

pip install supyagent

Or with uv:

uv pip install supyagent

Quick Start

# Initialize supyagent (sets up default tools)
supyagent init

# Set up your API key (stored securely)
supyagent config set ANTHROPIC_API_KEY

# Create your first agent
supyagent new myagent

# Start chatting
supyagent chat myagent

Usage

Interactive Mode

# Create an interactive agent
supyagent new researcher

# Chat with it
supyagent chat researcher

# Resume a previous session
supyagent chat researcher --session <session-id>

# Start fresh
supyagent chat researcher --new

Execution Mode

For automation and pipelines:

# Create an execution agent
supyagent new summarizer --type execution

# Run with inline input
supyagent run summarizer "Summarize this text..."

# Run with file input
supyagent run summarizer --input document.txt

# Get JSON output
supyagent run summarizer --input doc.txt --output json

# Pipe from stdin
cat article.txt | supyagent run summarizer

Batch Processing

# Process multiple inputs
supyagent batch summarizer inputs.jsonl --output results.jsonl

# From CSV
supyagent batch summarizer data.csv --format csv

Multi-Agent Orchestration

# Use the planning agent to orchestrate complex tasks
supyagent plan "Build a Python library for data validation"

# The planner will delegate to specialist agents (coder, writer, researcher)

Configuration

Setting Up API Keys

Supyagent securely stores your LLM API keys so you don't need to export them every time:

# Interactive setup (recommended)
supyagent config set
# Shows a menu of common providers to choose from

# Set a specific key
supyagent config set ANTHROPIC_API_KEY
supyagent config set OPENAI_API_KEY

# Import from a .env file
supyagent config import .env

# Import only specific keys
supyagent config import .env --filter OPENAI

# List configured keys
supyagent config list

# Export keys to backup
supyagent config export backup.env

# Delete a key
supyagent config delete OPENAI_API_KEY

Keys are encrypted and stored in ~/.supyagent/config/. They're automatically loaded when running any agent command.

Supported Providers

Supyagent uses LiteLLM, supporting 100+ providers:

model:
  # OpenAI
  provider: openai/gpt-4o
  
  # Anthropic
  provider: anthropic/claude-3-5-sonnet-20241022
  
  # Ollama (local)
  provider: ollama/llama3
  
  # Azure OpenAI
  provider: azure/gpt-4
  
  # Google
  provider: gemini/gemini-pro

Agent Configuration

Agents are defined in YAML files in the agents/ directory:

name: researcher
description: An AI research assistant
type: interactive  # or "execution"

model:
  provider: anthropic/claude-3-5-sonnet-20241022
  temperature: 0.7
  max_tokens: 4096

system_prompt: |
  You are a helpful research assistant...

tools:
  allow:
    - "*"           # Allow all tools
    # or be specific:
    # - "web:*"     # All functions in web.py
    # - "math:calc" # Specific function
  deny:
    - "dangerous:*" # Block specific tools

# For multi-agent support
delegates:
  - coder
  - writer

CLI Reference

Core Commands

Command Description
supyagent init Initialize project with default tools
supyagent new <name> Create a new agent
supyagent list List all agents
supyagent show <name> Show agent details
supyagent chat <name> Interactive chat session
supyagent run <name> <task> Execute agent (non-interactive)
supyagent batch <name> <file> Process multiple inputs
supyagent plan <task> Run task through planning agent

Session Commands

Command Description
supyagent sessions <name> List sessions for an agent
supyagent chat <name> --session <id> Resume a session
supyagent chat <name> --new Start a new session

Agent Management

Command Description
supyagent agents List active agent instances
supyagent cleanup Remove completed instances

Config Commands

Command Description
supyagent config set [KEY] Set an API key (interactive menu if no key specified)
supyagent config list List all configured keys
supyagent config import <file> Import keys from .env file
supyagent config export <file> Export keys to .env file
supyagent config delete <key> Delete a stored key

In-Chat Commands

While chatting, use these commands:

Command Description
/help Show available commands
/tools List available tools
/history Show conversation history
/sessions List your sessions
/switch <id> Switch to another session
/new Start a new session
/save <title> Save session with title
/export <file> Export session to file
/model <name> Switch LLM model
/creds Manage stored credentials
/clear Clear conversation history
/quit Exit the chat

Bundled Tools

Running supyagent init installs these default tools:

Shell (shell.py)

  • run_command - Execute shell commands
  • run_script - Run multi-line bash scripts
  • which - Find executable paths
  • get_env - Get environment variables

Files (files.py)

  • read_file / write_file - File I/O
  • list_directory - List files with glob patterns
  • copy_file / move_file / delete_file - File operations
  • create_directory - Create directories
  • file_info - Get file metadata

You can add your own tools by creating Python files in powers/.

Project Structure

your-project/
โ”œโ”€โ”€ agents/              # Agent YAML definitions
โ”‚   โ”œโ”€โ”€ assistant.yaml
โ”‚   โ”œโ”€โ”€ planner.yaml
โ”‚   โ””โ”€โ”€ researcher.yaml
โ”œโ”€โ”€ powers/              # Tool definitions (Python)
โ”‚   โ”œโ”€โ”€ shell.py         # Shell commands (bundled)
โ”‚   โ”œโ”€โ”€ files.py         # File operations (bundled)
โ”‚   โ””โ”€โ”€ my_tools.py      # Your custom tools
โ””โ”€โ”€ .supyagent/          # Runtime data (gitignore this)
    โ”œโ”€โ”€ sessions/        # Conversation history
    โ”œโ”€โ”€ credentials/     # Encrypted secrets
    โ””โ”€โ”€ registry.json    # Agent instances

Credential Management

Supyagent securely manages API keys and secrets:

# In chat, agents can request credentials
๐Ÿ”‘ Credential requested: SLACK_API_TOKEN
   Purpose: To send messages to Slack
Enter value (or press Enter to skip): ****
Save for future sessions? [Y/n]: y

# View stored credentials
/creds

Credentials are encrypted at rest using Fernet encryption.

Multi-Agent Architecture

Create orchestrator agents that delegate to specialists:

# agents/planner.yaml
name: planner
type: interactive

delegates:
  - researcher  # Can delegate research tasks
  - coder       # Can delegate coding tasks
  - writer      # Can delegate writing tasks

system_prompt: |
  You are a planning agent. Break down complex tasks
  and delegate to specialist agents...

The planner can then:

  1. Analyze tasks
  2. Create execution plans
  3. Delegate subtasks to appropriate agents
  4. Synthesize results

Development

# Clone the repo
git clone https://github.com/ergodic-ai/supyagent
cd supyagent

# Install with dev dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Run linting
ruff check .

License

MIT

Related Projects

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

supyagent-0.4.0.tar.gz (396.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

supyagent-0.4.0-py3-none-any.whl (165.6 kB view details)

Uploaded Python 3

File details

Details for the file supyagent-0.4.0.tar.gz.

File metadata

  • Download URL: supyagent-0.4.0.tar.gz
  • Upload date:
  • Size: 396.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for supyagent-0.4.0.tar.gz
Algorithm Hash digest
SHA256 b8d9acbf76121861d1199f8e6c490b9e5646c331b2759a8442d04e8625a05efd
MD5 c63faaf76a9651901a4c479c56dda14e
BLAKE2b-256 b2fe6b477610afc19ac409a250e9bea1ca0eedd9041b01f72983518c5a6ed96a

See more details on using hashes here.

File details

Details for the file supyagent-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: supyagent-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 165.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.8

File hashes

Hashes for supyagent-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 901a0570e11284cc2023b7e04fc173bb98be36effcffc8d7d0d6332c6e79169a
MD5 162b74b2b1272c5b8c80bc1d04a8ca60
BLAKE2b-256 2f521f457b543d2a306a527872da5c2bf497d89f4103802fc67149b704b8ee92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page