supermemory/apps/docs/integrations/viasocket.mdx
Dhravya 984297b62d
Add Supermemory integration for Microsoft Agent Framework (#775)
## Summary

This PR introduces comprehensive Supermemory integration for the Microsoft Agent Framework, providing three complementary approaches to add persistent memory capabilities to agents: middleware for automatic memory injection, context providers for session-based memory management, and tools for explicit memory operations.

## Key Changes

- **SupermemoryChatMiddleware**: Automatic memory injection middleware that fetches relevant memories from Supermemory before LLM calls and optionally saves conversations. Supports three modes:
  - `"profile"`: Injects all static and dynamic profile memories
  - `"query"`: Searches for memories relevant to the current user message
  - `"full"`: Combines both profile and query modes

- **SupermemoryContextProvider**: Idiomatic context provider following the Agent Framework pattern (similar to built-in Mem0 integration). Integrates with the session pipeline via `before_run()` and `after_run()` hooks for automatic memory retrieval and storage.

- **SupermemoryTools**: FunctionTool-compatible tools that agents can use for explicit memory operations:
  - `search_memories()`: Search for specific memories
  - `add_memory()`: Add new memories
  - `get_profile()`: Retrieve user profile

- **Utility Functions**: Helper functions for:
  - Memory deduplication across static, dynamic, and search result sources
  - Profile-to-markdown conversion for LLM consumption
  - Message extraction and conversation formatting
  - Logging with configurable verbosity

- **Exception Hierarchy**: Custom exceptions for better error handling:
  - `SupermemoryConfigurationError`: Missing/invalid configuration
  - `SupermemoryAPIError`: API request failures
  - `SupermemoryNetworkError`: Network connectivity issues
  - `SupermemoryMemoryOperationError`: Memory operation failures

- **Comprehensive Documentation**: README with quick start examples, configuration options, and API reference for all three integration approaches.

- **Test Suite**: Unit tests covering middleware, context provider, tools, and utility functions with proper mocking and error scenarios.

## Implementation Details

- Supports both async (aiohttp) and sync (requests) HTTP clients with automatic fallback
- Handles multiple message formats (dict, objects with attributes, content arrays)
- Configurable memory storage with optional conversation grouping via `conversation_id`
- Environment variable fallback for API key configuration (`SUPERMEMORY_API_KEY`)
- Background task management for non-blocking memory operations in middleware
- Proper async/sync compatibility for the Supermemory SDK

https://claude.ai/code/session_012idB5y6UGK3zmeFULgTc4z
2026-03-10 01:49:45 +00:00

79 lines
3.2 KiB
Text

---
title: "viaSocket"
sidebarTitle: "viaSocket"
description: "Connect Supermemory with viaSocket to build automation flows using triggers, API tokens, and actions like Gmail."
icon: "/images/viasocket-icon-ico.ico"
---
Connect Supermemory to viaSocket to build powerful automation flows — search your memory, trigger actions, and wire up services like Gmail, all without writing code.
## Prerequisites
- A Supermemory API key ([get one here](https://console.supermemory.ai/settings))
- A viaSocket account
## Step-by-Step Tutorial
<Steps>
<Step title="Generate Supermemory API Token">
- Log in to your [Supermemory account](https://console.supermemory.ai).
- Go to **Settings → API Key**.
- Copy your Personal API key.
- Keep the key secure — treat it like a password.
![make a zap - annotated](/images/viaSocket-supermemory-auth.png)
</Step>
<Step title="Create a New Flow in viaSocket">
- Click **Create New Flow** in your viaSocket dashboard.
- In the **Trigger** section, search for and select **Supermemory**.
- Choose a trigger — **Search Memory** or **Search User Profile**.
![make a zap - annotated](/images/viasocket-supermemory-connection.png)
</Step>
<Step title="Connect Your Supermemory Account">
- Click **Connect to Supermemory**.
- Paste your Supermemory API key.
- Click **Save** to store the connection.
- Confirm the connection is successfully added before proceeding.
![make a zap - annotated](/images/viasocket-supermemory-connection.png)
</Step>
<Step title="Configure the Trigger">
- Provide a **Query** — either a static value or a dynamic input from a previous step.
- Click **TEST** to run a sample and verify the output.
- Save the trigger once the test returns expected data.
![make a zap - annotated](/images/viasocket-supermemory-configured-trigger.png)
</Step>
<Step title="Add an Action (Example: Gmail Send Email)">
- Click **Add Step**.
- Select **Gmail → Send Email**.
- Choose an existing Gmail connection or create a new one.
- Map the required fields:
- **To** — recipient email address
- **Subject** — email subject line
- **Message Body** — use the trigger's `body` object as dynamic input
- Click **Test** to send a test email.
- Confirm a **200** response status before saving.
![make a zap - annotated](/images/viasocket-supermemory-action.png)
</Step>
<Step title="Go Live & Monitor">
- Click **GO LIVE** to activate your flow.
- Confirm the activation prompt.
- Use **Flow View** to inspect the flow structure and **Log View** to monitor executions in real time.
- If needed, re-run any execution from **Run History**.
![make a zap - annotated](/images/viasocket-supermemory-go-live.png)
</Step>
</Steps>
<Note>
Make sure your Supermemory API key has the correct permissions before
connecting. If the TEST step returns no data, double-check the query and
ensure your Supermemory account has indexed content.
</Note>
You can extend this flow with other actions and services supported by viaSocket.