Creates a fetch info handler that retrieves data for AI without modifying system state (READ pattern).
Execution flow:
If fetch, commit, or execution operations fail
// Fetch conversation history with error handlingconst fetchHistory = createFetchInfo({ fallback: (error, clientId, agentName) => { logger.error("Failed to fetch history", { error, clientId, agentName }); }, fetchContent: async (params, clientId, agentName) => { const history = await historyService.getHistory(clientId); return JSON.stringify(history); }, emptyContent: (content) => content || "No history found",});// Usage: called internally by addFetchInfoawait fetchHistory("tool-789", "client-012", "HistoryAgent", "FetchHistory", {}, true); Copy
// Fetch conversation history with error handlingconst fetchHistory = createFetchInfo({ fallback: (error, clientId, agentName) => { logger.error("Failed to fetch history", { error, clientId, agentName }); }, fetchContent: async (params, clientId, agentName) => { const history = await historyService.getHistory(clientId); return JSON.stringify(history); }, emptyContent: (content) => content || "No history found",});// Usage: called internally by addFetchInfoawait fetchHistory("tool-789", "client-012", "HistoryAgent", "FetchHistory", {}, true);
The type of parameters expected by the fetch operation
Configuration object
Handler function that executes the fetch operation
Creates a fetch info handler that retrieves data for AI without modifying system state (READ pattern).
Execution flow:
Throws
If fetch, commit, or execution operations fail
Example