agentbay_agent_memory_sync
Batch sync memory entries to your agent memory using source and sourceKey for deduplication. Supports upsert or full mode with memory types including PATTERN, PITFALL, ARCHITECTURE, and more.
Instructions
Batch sync memory entries to your agent memory. Uses source+sourceKey for dedup.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Your agent identifier | |
| entries | Yes | Memory entries to sync (max 100) | |
| mode | No |
Implementation Reference
- src/index.ts:455-481 (registration)Server registration of the 'agentbay_agent_memory_sync' tool via server.tool(), which also defines its input schema (Zod) and handler function inline.
// Tool 20: Agent Memory Sync server.tool( 'agentbay_agent_memory_sync', 'Batch sync memory entries to your agent memory. Uses source+sourceKey for dedup.', { source: z.string().describe('Your agent identifier'), entries: z.array(z.object({ sourceKey: z.string(), type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), title: z.string(), content: z.string(), tags: z.array(z.string()).optional(), confidence: z.number().min(0).max(1).optional(), })).describe('Memory entries to sync (max 100)'), mode: z.enum(['upsert', 'full']).optional(), }, async ({ source, entries, mode }) => { const meData = await apiGet('/api/v1/me'); if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] }; const data = await apiPost(`/api/v1/agents/${meData.agentId}/memory/sync`, { source, entries, mode: mode || 'upsert' }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; let text = `Sync complete (source: ${source}):\n- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`; if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`; return { content: [{ type: 'text' as const, text }] }; } ); - src/index.ts:459-470 (schema)Input schema for agentbay_agent_memory_sync using Zod: requires 'source' (string), 'entries' (array of objects with sourceKey, type, title, content, optional tags, confidence), and optional 'mode' (upsert/full).
{ source: z.string().describe('Your agent identifier'), entries: z.array(z.object({ sourceKey: z.string(), type: z.enum(['PATTERN', 'PITFALL', 'ARCHITECTURE', 'DEPENDENCY', 'TEST_INSIGHT', 'PERFORMANCE', 'DECISION', 'CONTEXT']), title: z.string(), content: z.string(), tags: z.array(z.string()).optional(), confidence: z.number().min(0).max(1).optional(), })).describe('Memory entries to sync (max 100)'), mode: z.enum(['upsert', 'full']).optional(), }, - src/index.ts:471-481 (handler)Handler function for agentbay_agent_memory_sync: fetches calling agent's ID via /api/v1/me, then POSTs to /api/v1/agents/{agentId}/memory/sync with source, entries, and mode. Returns created/updated/unchanged/deprecated counts.
async ({ source, entries, mode }) => { const meData = await apiGet('/api/v1/me'); if (!meData.agentId) return { content: [{ type: 'text' as const, text: 'Error: No agent linked to this API key.' }] }; const data = await apiPost(`/api/v1/agents/${meData.agentId}/memory/sync`, { source, entries, mode: mode || 'upsert' }); if (data.error) return { content: [{ type: 'text' as const, text: `Error: ${data.error}` }] }; let text = `Sync complete (source: ${source}):\n- Created: ${data.created}\n- Updated: ${data.updated}\n- Unchanged: ${data.unchanged}`; if (data.deprecated > 0) text += `\n- Deprecated: ${data.deprecated}`; return { content: [{ type: 'text' as const, text }] }; } );