đź§µ
TaskWeaver+Stompy

Code-first agents with memory-first persistence

Execute code, remember results

The Problem

TaskWeaver from Microsoft Research takes a fundamentally different approach to AI agents: code is the action. Your agents don't just chat—they write Python, execute it, and use the results. Data analysis with pandas, visualizations with matplotlib, transformations with numpy. Real computational work, not just conversation.

But code execution without memory is groundhog day.

Here's what happens: You ask TaskWeaver to analyze your sales data. It writes brilliant pandas code, discovers that Q4 always has a spike, generates a visualization showing the pattern. You're impressed. Next week, you ask about sales trends again. TaskWeaver writes new code from scratch. It has no idea it already analyzed this data. The insight about Q4? Lost. The effective aggregation strategy? Forgotten. The visualization that worked perfectly? Recreated from nothing.

The problem runs deeper than wasted computation. TaskWeaver learns your data's quirks during analysis—the column that needs type conversion, the date format that's inconsistent, the join key that requires preprocessing. Every session, it rediscovers these quirks. Every session, it writes the same workaround code. The analysis itself might be correct, but the accumulated understanding of your data never persists.

For data teams using TaskWeaver in production, this means significant inefficiency. Your agent analyzes the same dataset hundreds of times, learning nothing from each interaction. The insights are in the output, but the meta-insights—what approaches work, what patterns matter, what code is effective—evaporate between sessions.

Code execution needs execution memory.

How Stompy Helps

Stompy gives TaskWeaver agents true memory of their code execution journey.

Your code-first agents gain persistent data intelligence: - **Execution memory**: The code that worked is remembered. The patterns that mattered are recalled. Your agent builds a library of effective analysis approaches. - **Data understanding**: The quirks of your datasets—type issues, formatting problems, preprocessing needs—are learned once and remembered forever. - **Insight accumulation**: Not just storing outputs, but building a compounding understanding of your data over time. Q4 spikes, weekly patterns, correlation insights—all persist. - **Code reuse intelligence**: When facing a similar analysis, your agent can recall not just that it solved this before, but exactly how. The effective pandas operations, the visualization parameters that worked.

TaskWeaver's code-first approach becomes even more powerful with code-first memory. Your agents don't just execute—they learn from execution.

Execute once, learn forever.

Integration Walkthrough

1

Configure Stompy as a TaskWeaver plugin

Add Stompy to your TaskWeaver configuration to enable persistent memory for all code execution.

# taskweaver_config.yaml
plugins:
- name: stompy_memory
type: mcp
config:
url: "https://mcp.stompy.ai/sse"
headers:
Authorization: "Bearer $STOMPY_TOKEN"
tools:
- recall_context
- lock_context
- context_search
# Or programmatically:
from taskweaver.plugin import Plugin
import httpx
import os
class StompyPlugin(Plugin):
"""Persistent memory for TaskWeaver agents."""
async def recall(self, topic: str) -> str:
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(self, topic: str, content: str):
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}
)
2

Enable code pattern memory

Configure your agent to save effective code patterns and recall them for similar tasks.

from taskweaver import TaskWeaver
# Initialize TaskWeaver with Stompy memory
tw = TaskWeaver(plugins=["stompy_memory"])
async def analyze_with_memory(query: str, dataset_name: str):
"""Execute analysis with persistent code memory."""
# Recall effective patterns for this dataset
data_patterns = await tw.plugins["stompy_memory"].recall(f"data_{dataset_name}_patterns")
effective_code = await tw.plugins["stompy_memory"].recall(f"code_{dataset_name}_effective")
# Build context-aware prompt
context = f"""Previous effective patterns for {dataset_name}:
{data_patterns}
Code that worked well:
{effective_code}
"""
# Execute analysis with context
result = await tw.execute(query, context=context)
# Save the successful analysis
if result.success:
await tw.plugins["stompy_memory"].save(
topic=f"analysis_{dataset_name}_{query[:50]}",
content=f"Query: {query}\nCode: {result.code}\nInsight: {result.summary}"
)
return result
3

Build cumulative data understanding

Automatically capture data insights and quirks during analysis for future sessions.

async def learn_from_execution(result, dataset_name: str):
"""Extract and persist learnings from code execution."""
# Capture data quirks discovered during execution
if "type conversion" in result.code.lower() or "astype" in result.code:
await tw.plugins["stompy_memory"].save(
topic=f"data_{dataset_name}_types",
content=f"Type conversion needed: {extract_type_info(result.code)}"
)
# Capture successful aggregation patterns
if result.success and any(agg in result.code for agg in ["groupby", "agg", "pivot"]):
await tw.plugins["stompy_memory"].save(
topic=f"code_{dataset_name}_aggregations",
content=f"Effective aggregation:\n{result.code}"
)
# Capture discovered patterns
patterns = extract_patterns(result.summary) # Your pattern extraction logic
if patterns:
await tw.plugins["stompy_memory"].save(
topic=f"insight_{dataset_name}_patterns",
content=f"Patterns discovered: {patterns}\nDate: {datetime.now()}"
)
# Now every analysis session builds cumulative understanding
result = await analyze_with_memory("Show me monthly revenue trends", "sales_data")
await learn_from_execution(result, "sales_data")

What You Get

  • Code pattern library: Effective pandas/numpy operations are remembered and reused, reducing redundant code generation
  • Dataset intelligence: Data quirks, type issues, and preprocessing needs are learned once and recalled in every future session
  • Insight accumulation: Discovered patterns and trends persist, building cumulative understanding of your data over time
  • Execution efficiency: Similar analyses can reference past successful code instead of regenerating from scratch
  • Analysis lineage: See how your understanding of a dataset has evolved across hundreds of execution sessions

Ready to give TaskWeaver a memory?

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