From 22875a6fc198c0ea2319356e9fd4e569ea1d04d7 Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Sun, 8 Jun 2025 15:45:25 +0530 Subject: [PATCH 1/2] Add Pulsar conversation example --- .../pulsar_conversation.py | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 examples/communication_examples/pulsar_conversation.py diff --git a/examples/communication_examples/pulsar_conversation.py b/examples/communication_examples/pulsar_conversation.py new file mode 100644 index 00000000..c74bc4d2 --- /dev/null +++ b/examples/communication_examples/pulsar_conversation.py @@ -0,0 +1,25 @@ +from swarms import Agent +from swarms.communication.pulsar_struct import PulsarConversation + +# Configure a Pulsar-backed conversation store +conversation_store = PulsarConversation( + pulsar_host="pulsar://localhost:6650", # adjust to your broker + topic="support_conversation", + token_count=False, +) + +# Create an agent that uses this persistent memory +agent = Agent( + agent_name="SupportAgent", + 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 time is check-out?") +print(response) + +# View the messages as stored in Pulsar +print(conversation_store.get_messages()) From c9e1497460370a9e16731e34f5d79a4b5683b4ee Mon Sep 17 00:00:00 2001 From: Pavan Kumar <66913595+ascender1729@users.noreply.github.com> Date: Sun, 8 Jun 2025 10:35:20 +0000 Subject: [PATCH 2/2] Add Pulsar conversation example for persistent agent memory --- examples/communication_examples/pulsar_conversation.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/communication_examples/pulsar_conversation.py b/examples/communication_examples/pulsar_conversation.py index c74bc4d2..b0ac00ee 100644 --- a/examples/communication_examples/pulsar_conversation.py +++ b/examples/communication_examples/pulsar_conversation.py @@ -15,7 +15,7 @@ agent = Agent( model_name="gpt-4o-mini", long_term_memory=conversation_store, max_loops=1, - autosave=True, + autosave=False, ) response = agent.run("What time is check-out?")