šŸ
OpenAI Swarm+Stompy

Swarm intelligence with persistent hive mind

A swarm that remembers its missions

The Problem

OpenAI Swarm showed how elegantly simple multi-agent coordination can be. Agents hand off to each other. Specialists handle their domains. A triage agent routes to the right expert. The swarm is greater than the sum of its parts—an emergent intelligence built from focused specialists.

For one session.

Here's what happens in practice: Your swarm handles a complex customer support case brilliantly. The triage agent routes to billing, billing escalates to technical, technical resolves with a custom solution. Perfect coordination. Then the session ends. Tomorrow, the same customer calls back about a follow-up. The swarm has collective amnesia. The triage agent doesn't know this customer was already escalated. The technical agent doesn't know what solution was implemented. The brilliant coordination? Reset to zero.

The problem is deeper than lost conversation history. The handoff patterns that emerged—the recognition that certain query types always need escalation, that some customers prefer direct routing to technical—that learned behavior is gone. Each specialist's accumulated domain knowledge? Vanished. The swarm doesn't just forget the conversation. It forgets how to be a swarm.

You can rebuild the same agent architecture every time. But swarm intelligence isn't in the architecture—it's in the collective learning that emerges from hundreds of interactions. Without persistent memory, every swarm session starts from scratch.

Swarm intelligence without swarm memory is just chaos with extra steps.

How Stompy Helps

Stompy gives your OpenAI Swarm a true persistent hive mind.

Your agent swarm gains collective memory: - **Persistent handoff patterns**: The triage agent remembers which specialists handle which request types, learns from successful (and failed) routing decisions, and builds intuition over time - **Specialist domain knowledge**: Each agent accumulates expertise. Your billing agent remembers edge cases. Your technical agent remembers solutions that worked. Knowledge that compounds. - **Cross-agent learning**: When the billing agent discovers a pattern, the triage agent can learn to route appropriately. Insights flow through the hive. - **Session continuity**: Returning customers pick up where they left off. The swarm remembers the full relationship history.

The architecture is OpenAI Swarm's elegant simplicity. The intelligence is Stompy's persistent memory. Together: a swarm that actually learns.

The swarm evolves. The swarm remembers. The swarm becomes more than the sum of its agents.

Integration Walkthrough

1

Create Stompy-enabled agents with shared hive memory

Give every agent in your swarm access to collective memory through Stompy tools.

from swarm import Swarm, Agent
import httpx
import os
def get_stompy_tools():
"""Create Stompy tool functions for swarm agents."""
async def recall_context(topic: str) -> str:
"""Recall knowledge from the hive mind."""
async with httpx.AsyncClient() as client:
response = await client.post(
"https://mcp.stompy.ai/sse",
headers={"Authorization": f"Bearer {os.environ['STOMPY_TOKEN']}"},
json={"tool": "recall_context", "topic": topic}
)
return response.json().get("content", "")
async def save_learning(topic: str, content: str, priority: str = "reference") -> str:
"""Save knowledge to the hive mind."""
async with httpx.AsyncClient() as client:
await client.post(
"https://mcp.stompy.ai/sse",
headers={"Authorization": f"Bearer {os.environ['STOMPY_TOKEN']}"},
json={"tool": "lock_context", "topic": topic,
"content": content, "priority": priority}
)
return "Saved to hive memory"
return [recall_context, save_learning]
stompy_tools = get_stompy_tools()
2

Build specialists with domain memory

Create agents that accumulate expertise in their specific domains.

def transfer_to_billing():
"""Hand off to billing specialist."""
return billing_agent
def transfer_to_technical():
"""Hand off to technical specialist."""
return technical_agent
triage_agent = Agent(
name="Triage",
instructions="""You are the routing specialist. Use recall_context to check:
- "routing_patterns": Known patterns for efficient routing
- "customer_{id}_history": Past interactions with returning customers
After successful routing, save_learning the pattern for future reference.""",
functions=[*stompy_tools, transfer_to_billing, transfer_to_technical]
)
billing_agent = Agent(
name="Billing",
instructions="""You handle billing inquiries. Always recall_context for:
- "billing_edge_cases": Known edge cases and solutions
- "customer_{id}_billing": This customer's billing history
Save novel solutions with save_learning for future agents.""",
functions=[*stompy_tools, transfer_to_technical]
)
technical_agent = Agent(
name="Technical",
instructions="""You solve technical issues. recall_context for:
- "technical_solutions": Proven solutions to common issues
- "system_status": Current known issues
Document new solutions with save_learning.""",
functions=[*stompy_tools]
)
3

Track routing patterns and emergent behaviors

Let the swarm learn from its own coordination patterns.

from swarm import Swarm
client = Swarm()
async def run_with_learning(messages: list, user_id: str = None):
"""Run the swarm with memory and pattern tracking."""
# Pre-load relevant context for this conversation
if user_id:
history = await stompy_tools[0](f"customer_{user_id}_history")
if history:
messages[0]["content"] += f"\n\nCUSTOMER HISTORY:\n{history}"
# Run the swarm
response = client.run(agent=triage_agent, messages=messages)
# Track the routing pattern for future optimization
agents_used = [m.get("sender") for m in response.messages if m.get("sender")]
routing_path = " -> ".join(agents_used)
await stompy_tools[1](
topic=f"routing_log_{datetime.now().strftime('%Y%m%d')}",
content=f"Query type: {classify_query(messages)}\nPath: {routing_path}\nOutcome: {response.messages[-1]['content'][:200]}",
priority="reference"
)
return response
# The swarm now builds institutional knowledge with every interaction

What You Get

  • Collective hive memory: All agents share the same persistent knowledge base—insights from one specialist benefit the entire swarm
  • Learned routing patterns: Triage agent improves over time, learning which specialists handle which request types most effectively
  • Domain expertise accumulation: Each specialist agent builds knowledge in their area, remembering edge cases and proven solutions
  • Customer continuity: Returning users get seamless continuation, with full history available to any agent in the swarm
  • Emergent optimization: The swarm collectively learns optimal handoff patterns that no single agent could discover alone

Ready to give OpenAI Swarm a memory?

Join the waitlist and be the first to know when Stompy is ready. Your OpenAI Swarm projects will never forget again.