[FEATURE] query_postgres for Executing SQL Queries on PostgreSQL
Problem Statement
This feature request proposes the addition of a new tool named query_postgres to the strands-tools suite. The tool allows agents to securely connect to a PostgreSQL database and run parameterized SQL queries, returning structured results for further use in workflows.
Proposed Solution
Proposed Functionality The query_postgres tool supports:
- Connecting to a PostgreSQL database using provided credentials.
- Executing user-defined, parameterized SQL queries (e.g., SELECT, INSERT, UPDATE).
- Returning structured query results to the agent in JSON format.
- Optional support for environment-variable-based configuration for secure handling of credentials.
Have taken the liberty to create the PR: https://github.com/strands-agents/tools/pull/135
Use Case
Agents often require access to relational data for decision-making or automation tasks. Currently, there is no built-in tool in strands-tools that enables querying a PostgreSQL database. Adding query_postgres fills this gap and aligns with the modular design of the toolkit
Alternatives Solutions
No response
Additional Context
Open to code review and any suggestions on improving the PR.
Hi @Sagart-cactus Thank you for raising this request, our tool repo is community driven, we would like to recommend you follow this guideline to create your own package https://github.com/strands-agents/docs/blob/main/docs/community/community-packages.md