Forgive me if this is a rookie question. I’m building an agent chatbot workflow. One of the main tasks for this agent is to answer questions about devices. I can run postgres query and retrieve all info about devices (typically 20-250 devices for a chat session) and each device has a label, UUID, name etc. During a chat session I might ask the agent about 1 or 5 or maybe 10 devices but not likely all 100. And even if I did it would be to run a generic query.
I’m wondering how I can store this information (DeviceID, Label, Name, Attributes) for the duration of the chat so that any of the agents can access it. I was/am using Redis for chat memory and my thought was to have Chat-> Agent but also branch off of Chat->SQL Query->Code->Redis-> and save that output to Redis. Agent could then call Redis to retrieve. If I leave Redis output unconnected I just get its output in chat. If I connect in parallel to chat output to the agent, it seems to clog up agent and use a ton of tokens.
So in other words is there a good way to scope a list of devices and persist it to some type of fast retrieval so that agents can grab a specific device(s) I am asking about to perform SQl queries on just those select devices and not keep all 100 in context window? That array would only need to exist for duration of chat session.
(Select the nodes on your canvas and use the keyboard shortcuts CMD+C/CTRL+C and CMD+V/CTRL+V to copy and paste the workflow.)
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.103.2
- Database (default: SQLite): Postgres
- n8n EXECUTIONS_PROCESS setting (default: own, main):
- Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
- Operating system: Win 11
