Skip to main content

Neon Swarm

Neon Swarm is a set of tools and agents for interacting with Neon PostgreSQL databases. It leverages the power of OpenAI Swarm Framework to simplify database operations, query generation, and project management.

Features

  • AI-powered database interaction
  • Project management (create, list, delete projects)
  • Branch management (create, list, delete branches)
  • SQL query execution and generation
  • Database schema retrieval
  • Secure connection handling

Installation

You can install Neon Swarm using pip:

pip install neon-swarm

Dependencies

⚠️ Warning

This package requires the swarm package from OpenAI, which is not available on PyPI. To install it, run:

pip install git+https://github.com/openai/swarm.git

Make sure to install this before using neon_swarm.

Agents

Neon Swarm provides three main agents:

  1. Neon Agent: Handles project and branch management tasks.
  2. SQL Executor: Executes SQL queries on your Neon databases.

Usage

Set up API keys

Before using Neon Swarm, make sure to set up your Neon and OpenAI API keys as environment variables:

export NEON_API_KEY='your_neon_api_key'
export OPENAI_API_KEY='your_openai_api_key'

Initialize the Neon Agent

First, you can initialize the agent and provide the necessary context variables:

from neon_swarm import neon_agent_init
from swarm.repl import run_demo_loop

neon_agent, context_variables = neon_agent_init()
run_demo_loop(agent=neon_agent, context_variables=context_variables, debug=True)

Example Session

Starting Swarm CLI 🐝

User: Hi there what can you do?

Neon Agent: I can assist with tasks related to managing your projects, such as listing projects, creating or deleting projects, managing branches within projects, and executing SQL queries. Please let me know what you need help with!

User: list my projects by region

Neon Agent: Your projects are distributed in the following regions:

1. **AWS EU Central 1:**
   - Project Name: test

2. **AWS US East 2:**
   - Project Name: holy-lab-67952041
   - Project Name: dark-art-95693218
   - Project Name: sweet-wave-03017484
   - Project Name: lively-feather-51928761
   - Project Name: Project 3
   - Project Name: Project 2
   - Project Name: Project 1

3. **AWS US East 1:**
   - Project Name: mute-silence-42691339

4. **AWS EU Central 1:**
   - Project Name: proud-mode-21844084

If you need any more information or assistance with these projects, please let me know!

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Support

If you encounter any issues or have questions, please file an issue on the GitHub issue tracker.

Acknowledgements

  • Swarm for the Swarm Framework
  • OpenAI for the AI models powering the agents
  • Neon for providing the serverless PostgreSQL platform

Metadata

Release files for neon-swarm 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 neon-swarm 0.1.0
File Size Uploaded
neon_swarm-0.1.0.tar.gz 5.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for neon-swarm 0.1.0
File Interpreter ABI Platform
neon_swarm-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 5.5 MB

Release files / neon_swarm-0.1.0.tar.gz

Download URL neon_swarm-0.1.0.tar.gz
Size 5.5 MB
Tags Source
SHA-256 checksum
How to use checksums
cf7f50e0d3b5cfad70183ac21985b105b4b7d48361fb6c026e102562eb4ee856
BLAKE2b-256 checksum
How to use checksums
81e1bad5f21a747b10f69d32f4f7b9a9fbe7d86007d8416e54772a3634aec1bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

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

Download URL neon_swarm-0.1.0-py3-none-any.whl
Size 8.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
16542f98f228d1135e9ef26396dddb722097042606272b40c634fdae060b0787
BLAKE2b-256 checksum
How to use checksums
64b5bee8c54d1a698dcd0925a2f14b3c5adf98e40066493bfca83a031c070a9c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.11.3

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