Skip to content

Commit de17eaf

Browse files
authored
Merge pull request #222 from bgrenon/add-neon-docs
Add Neon docs
2 parents 0d8a133 + c3cd652 commit de17eaf

2 files changed

Lines changed: 58 additions & 0 deletions

File tree

docs/tools/community.mdx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ description: 'AgentStack tools from community contributors'
1818

1919
- [Mem0](/tools/tool/mem0)
2020

21+
## Database Tools
22+
- [Neon](/tools/tool/neon)
23+
2124
## Code Execution
2225

2326
- [Open Interpreter](/tools/tool/open-interpreter)

docs/tools/tool/neon.mdx

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
---
2+
title: Neon
3+
description: Postgres for agents
4+
---
5+
## Description
6+
Neon is a serverless Postgres platform that lets your agents create and manage databases on demand. It supports ephemeral or long-lived Postgres instances for storing structured data.
7+
8+
## Prerequisites
9+
1. A Neon account. If you do not have one, sign up at [Neon](https://neon.tech).
10+
2. Get your API key from the [Neon Console](https://console.neon.tech/app/settings/api-keys).
11+
3. The tool will automatically install required dependencies:
12+
- neon-api
13+
- psycopg2-binary
14+
15+
## Installation
16+
17+
```bash
18+
agentstack tools add neon
19+
```
20+
21+
## Configuration
22+
```bash
23+
NEON_API_KEY=...
24+
```
25+
26+
## Available Actions
27+
The following actions are automatically included when you add the Neon tool to your agent:
28+
29+
1. **`create_database`**
30+
Creates a new Neon project and returns a connection URI. Default settings create a database called `neondb` with the `neondb_owner` role.
31+
32+
<Note>The agent's response to errors will depend on its reasoning about the specific situation. It may retry a failed action, but this behavior is probabilistic rather than deterministic.</Note>
33+
34+
2. **`execute_sql_ddl`**
35+
Run schema commands (e.g., `CREATE TABLE`) using a connection URI and SQL command. Transactions are automatically handled.
36+
37+
3. **`run_sql_query`**
38+
Run data queries (e.g., `SELECT`, `INSERT`) using a connection URI and SQL query. Results are returned as formatted strings.
39+
40+
## Using the Tool
41+
Add the Neon tool to your agent:
42+
```python
43+
@agent
44+
def db_writer(self) -> Agent:
45+
return Agent(
46+
config=self.agents_config['db_writer'],
47+
tools=[*agentstack.tools['neon']], # Includes all Neon actions listed above
48+
verbose=True,
49+
)
50+
```
51+
52+
For a complete example, see `AgentStack/examples/web_researcher` where an agent stores collected data in Postgres as part of a multi-agent workflow.
53+
54+
## Usage Note
55+
When you add the Neon tool to an existing project, all its tools will be added to every agent in the `agents.yaml` file. You may need to remove unused tools to keep each agent's scope clear.

0 commit comments

Comments
 (0)