From b186ac3497a32071444cf977f59537bba85a4e28 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Sat, 7 Jun 2025 22:35:02 +0530 Subject: [PATCH] Add DuckDB conversation example --- .../communication_examples/duckdb_agent.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/communication_examples/duckdb_agent.py diff --git a/examples/communication_examples/duckdb_agent.py b/examples/communication_examples/duckdb_agent.py new file mode 100644 index 00000000..b10b3c6e --- /dev/null +++ b/examples/communication_examples/duckdb_agent.py @@ -0,0 +1,25 @@ +from swarms import Agent +from swarms.communication.duckdb_wrap import DuckDBConversation + +# Configure a DuckDB-backed conversation store +conversation_store = DuckDBConversation( + db_path="support_conversation.duckdb", + table_name="support_history", + enable_logging=True, +) + +# Create an agent that uses this persistent memory +agent = Agent( + agent_name="HelpdeskAgent", + system_prompt="You are a helpful assistant.", + model_name="gpt-4o-mini", + long_term_memory=conversation_store, + max_loops=1, + autosave=True, +) + +response = agent.run("What are your hours of operation?") +print(response) + +# View the conversation as stored in DuckDB +print(conversation_store.to_dict())