mirror of
https://github.com/d0zingcat/solana-agent-kit.git
synced 2026-05-13 23:16:55 +00:00
readme
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
OPENAI_API_KEY=
|
||||
RPC_URL=
|
||||
SOLANA_PRIVATE_KEY=
|
||||
POSTGRES_DB_URL=
|
||||
66
examples/persistance-agent/README.md
Normal file
66
examples/persistance-agent/README.md
Normal file
@@ -0,0 +1,66 @@
|
||||
# Persistent Agent with PostgreSQL
|
||||
|
||||
This example showcases a persistent agent that retains memory across sessions using a PostgreSQL database. It ensures that the agent can remember previous conversations even after being restarted, enhancing the user experience in applications requiring long-term context retention.
|
||||
[Reference](https://langchain-ai.github.io/langgraphjs/reference/classes/checkpoint_postgres.PostgresSaver.html)
|
||||
|
||||
## Key Features
|
||||
|
||||
- **Persistent Memory**: The agent stores chat history in a PostgreSQL database, allowing it to remember past interactions across sessions.
|
||||
- **Seamless Integration**: Designed to integrate smoothly with existing setups.
|
||||
- **Scalable Solution**: Ideal for applications requiring long-term memory capabilities.
|
||||
|
||||
## Prerequisites
|
||||
|
||||
To use this feature, ensure you have the following:
|
||||
|
||||
1. **PostgreSQL Database URL**: Create and host ur PostgreSQL databse and enter the URL. It will be of the format "postgresql://user:password@localhost:5432/db"
|
||||
|
||||
## Before applying persistance
|
||||
```
|
||||
Available modes:
|
||||
1. chat
|
||||
- Interactive chat mode
|
||||
2. auto
|
||||
- Autonomous action mode
|
||||
Choose a mode (enter number or name: 1
|
||||
Starting chat mode... Type 'exit' to end.
|
||||
Prompt: i am arpit
|
||||
Hello Arpit! How can I assist you today?
|
||||
Prompt: ^С
|
||||
® arpitsingh Mac persistance-agent & ts-node index.ts
|
||||
Starting Agent...
|
||||
Available modes:
|
||||
1. chat
|
||||
- Interactive chat mode
|
||||
2. auto
|
||||
- Autonomous action mode
|
||||
Choose a mode (enter number or name): 1
|
||||
Starting chat mode... Type 'exit' to end.
|
||||
Prompt: do u know my name
|
||||
I don't know your name yet. If you'd like, you can share it.
|
||||
```
|
||||
## After applying persistence
|
||||
```
|
||||
Available modes:
|
||||
1. chat
|
||||
- Interactive chat mode
|
||||
2. auto
|
||||
- Autonomous action mode
|
||||
Choose a mode (enter number or name: 1
|
||||
Starting chat mode... Type 'exit' to end.
|
||||
Prompt: i am arpit
|
||||
Hello Arpit! How can I assist you today?
|
||||
Prompt: ^С
|
||||
® arpitsingh Mac persistance-agent & ts-node index.ts
|
||||
Starting Agent...
|
||||
Available modes:
|
||||
1. chat
|
||||
- Interactive chat mode
|
||||
2. auto
|
||||
- Autonomous action mode
|
||||
Choose a mode (enter number or name): 1
|
||||
Starting chat mode... Type 'exit' to end.
|
||||
Prompt: do u know my name
|
||||
Yes, you mentioned that your name is Arpit. How can I help you today?
|
||||
```
|
||||
|
||||
@@ -9,7 +9,7 @@ import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";
|
||||
dotenv.config();
|
||||
|
||||
const checkpointer = PostgresSaver.fromConnString(
|
||||
"postgresql://user:password@localhost:5432/db"
|
||||
process.env.POSTGRES_DB_URL!
|
||||
);
|
||||
|
||||
function validateEnvironment(): void {
|
||||
|
||||
Reference in New Issue
Block a user