Skip to main content

Neon OpenAI Swarm Agent for interacting with Postgres and Neon databases

Project description

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

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

neon_swarm-0.1.0.tar.gz (5.5 MB view details)

Uploaded Source

Built Distribution

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

neon_swarm-0.1.0-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

Details for the file neon_swarm-0.1.0.tar.gz.

File metadata

  • Download URL: neon_swarm-0.1.0.tar.gz
  • Upload date:
  • Size: 5.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for neon_swarm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 cf7f50e0d3b5cfad70183ac21985b105b4b7d48361fb6c026e102562eb4ee856
MD5 ba40a808f912e224d7c53a70a6dc24fc
BLAKE2b-256 81e1bad5f21a747b10f69d32f4f7b9a9fbe7d86007d8416e54772a3634aec1bd

See more details on using hashes here.

File details

Details for the file neon_swarm-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: neon_swarm-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 8.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.3

File hashes

Hashes for neon_swarm-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16542f98f228d1135e9ef26396dddb722097042606272b40c634fdae060b0787
MD5 53fe027d3f8d65ea26d95dc7dc09b19f
BLAKE2b-256 64b5bee8c54d1a698dcd0925a2f14b3c5adf98e40066493bfca83a031c070a9c

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