agent-squad icon indicating copy to clipboard operation
agent-squad copied to clipboard

Add SQL Conversation Storage

Open Rajaniraiyn opened this issue 1 year ago • 1 comments

Issue number: #110

Summary

Changes

This PR adds a new feature, SQL Storage, to the Multi-Agent Orchestrator system. It introduces persistent conversation storage using the libsql library, supporting both local SQLite databases and remote databases. This implementation improves flexibility, reliability, and scalability for storing agent conversation history.

User experience

Before this change:

  • Conversation data was limited to DynamoDB or in-memory storage without a CustomStorage implementation.

After this change:

  • Users can store conversations persistently with support for both local and remote databases.
  • Provides robust solutions for edge and serverless deployments.
  • Simplifies setup with automatic schema creation and indexing.

Checklist

If your change doesn't seem to apply, please leave them unchecked.

  • [x] I have performed a self-review of this change
  • [x] Changes have been tested
  • [x] Changes are documented
Is this a breaking change? No

RFC issue number:

Checklist:

  • [ ] Migration process documented
  • [ ] Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

Rajaniraiyn avatar Nov 26 '24 20:11 Rajaniraiyn

Any update on this PR?

I've got a similar use-case where we're using a SQL DB for storing conversations. I've rolled my own storage engine for this outside of the multi-agent orchestrator framework, but having this built-in would be pretty nice.

Looks like the current HEAD of this fork needs a rebase. Happy to contribute if OP no longer has the bandwidth, but also not sure if the maintainers are willing to accept this. Looking for some feedback either way.

Thanks!

fryz avatar Dec 13 '24 17:12 fryz

Hi @Rajaniraiyn, Thanks for the PR. We did some changes to the python version so that a user will install only the required libraries, not all of them. Can you make changes so that it works for libsql similar to aws, anthropic and openai? Check the setup.cfg and the init files. The point is that we should install this lib only if we use this storage.

Also add a mention to this package in the doc for python.

Thanks.

cornelcroi avatar Dec 24 '24 09:12 cornelcroi

Hey @cornelcroi I have made the requested changes,

  • made libsql installing when only used in python
  • mention sql storage in overview docs

Thanks

Rajaniraiyn avatar Dec 24 '24 10:12 Rajaniraiyn

Can you add the pip install with the package like we did here ? The users are more likely to skip the initial installation step so if they head to this storage, the installation of the lib must be recalled.

Thanks.

cornelcroi avatar Dec 24 '24 11:12 cornelcroi

@cornelcroi I have updated both DynamoDB and SQL storage docs for python, specifying extras dependency installation. Let me know any further changes required. Thanks.

Rajaniraiyn avatar Dec 24 '24 14:12 Rajaniraiyn

Great, thanks. Merging.

cornelcroi avatar Dec 26 '24 09:12 cornelcroi

Thanks for merging this :)

fryz avatar Jan 03 '25 14:01 fryz

I am getting this error while using the SqlChatStorage with local db file

image

I am setting up the orchestrator in the fast api async method same as in fastapi streaming example

image

image

psqbt avatar Jan 10 '25 10:01 psqbt

@fryz can you have a look?

cornelcroi avatar Jan 10 '25 10:01 cornelcroi

CC @Rajaniraiyn (original contributor)

Would be happy to contribute but I'm more familiar with the Typescript side of things. Looks like it's because the query invoking the read from the DB is async and not being handled correctly? (eg: await?)

fryz avatar Jan 10 '25 16:01 fryz

CC @Rajaniraiyn (original contributor)

Would be happy to contribute but I'm more familiar with the Typescript side of things.

Looks like it's because the query invoking the read from the DB is async and not being handled correctly? (eg: await?)

Sorry, I meant to tag the original author 😊

cornelcroi avatar Jan 10 '25 16:01 cornelcroi

CC @Rajaniraiyn (original contributor)

Would be happy to contribute but I'm more familiar with the Typescript side of things. Looks like it's because the query invoking the read from the DB is async and not being handled correctly? (eg: await?)

@fryz Yes, async method not awaited....full trace below

image

psqbt avatar Jan 10 '25 18:01 psqbt

@psqbt Fixed Python async/sync inconsistencies and implemented a missing newly added method: https://github.com/awslabs/multi-agent-orchestrator/pull/201

Rajaniraiyn avatar Jan 10 '25 18:01 Rajaniraiyn

Thanks @Rajaniraiyn !

psqbt avatar Jan 10 '25 18:01 psqbt