https://github.com/sustia-llc/surrealdb-live-message
Agent messaging based on SurrealDB live query
https://github.com/sustia-llc/surrealdb-live-message
messaging surrealdb
Last synced: 3 months ago
JSON representation
Agent messaging based on SurrealDB live query
- Host: GitHub
- URL: https://github.com/sustia-llc/surrealdb-live-message
- Owner: sustia-llc
- License: mit
- Created: 2024-04-12T18:05:26.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-29T21:03:43.000Z (4 months ago)
- Last Synced: 2025-07-29T23:48:41.192Z (4 months ago)
- Topics: messaging, surrealdb
- Language: Rust
- Homepage:
- Size: 671 KB
- Stars: 4
- Watchers: 0
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# surrealdb-live-message
- demonstrates a light message layer for multi-agent interaction, based on surrealdb live query. Message records are sent by establishing a graph relation from sending agent to receiving agent.
## Requirements
* [Rust](https://www.rust-lang.org/tools/install)
* [Docker](https://docs.docker.com/get-docker/)
* [SurrealDB](https://surrealdb.com/docs/surrealdb/installation/) (for client sql queries, see Run below)
## Test
```sh
# run the integration test
cargo test --test integration_test
# or run in production mode with your surrealdb cloud endpoint:
# config/production.toml:
cat << EOF > config/production.toml
environment = "production"
[logger]
level = "info"
[sdb]
username = "test"
password = "test"
namespace = "test"
database = "test"
endpoint = "wss://"
EOF
RUN_MODE=production cargo test --test integration_test
```
## Run
## Terminal 1
```sh
# start the app
cargo run
# when finished with client below, hit ctrl-c to view the log outputs from the subsystem and listener shutdowns
```
## Terminal 2
```sh
# start surrealdb client
surreal sql --user root --pass root --namespace test --database test
# message from bob to alice
RELATE agent:bob->message->agent:alice
CONTENT {
created: time::now(),
payload: { Text: { content: 'Hello, Alice!' } },
};
# message from alice to bob
RELATE agent:alice->message->agent:bob
CONTENT {
created: time::now(),
payload: { Text: { content: 'Hello, Bob!' } },
};
# check messages
select * from message
```
## Documentation
For detailed documentation on SurrealDB, visit [SurrealDB's Documentation](https://surrealdb.com/docs).
## Acknowledgments
* [tokio-graceful-shutdown](https://github.com/Finomnis/tokio-graceful-shutdown)
* [surrealDB](https://github.com/surrealdb/surrealdb)