feat(agentflow): make client-specific knowledge fields for agent nodes (#6226)

- Updated Agent node to include 'client' property for 'agentKnowledgeDocumentStores' and 'agentKnowledgeVSEmbeddings', allowing differentiation between 'agentflowv2' and 'agentflowsdk'.
- Added tests to ensure correct filtering of knowledge fields based on client type.
This commit is contained in:
Jocelyn Lin
2026-04-16 08:58:44 -07:00
committed by GitHub
parent 85df44bca4
commit be37e73ed1
2 changed files with 38 additions and 0 deletions
@@ -273,6 +273,7 @@ class Agent_Agentflow implements INode {
name: 'agentKnowledgeDocumentStores',
type: 'array',
description: 'Give your agent context about different document sources. Document stores must be upserted in advance.',
client: ['agentflowv2'],
array: [
{
label: 'Document Store',
@@ -303,6 +304,7 @@ class Agent_Agentflow implements INode {
name: 'agentKnowledgeVSEmbeddings',
type: 'array',
description: 'Give your agent context about different document sources from existing vector stores and embeddings',
client: ['agentflowv2'],
array: [
{
label: 'Vector Store',
@@ -214,6 +214,42 @@ describe('filterNodeByClient', () => {
})
})
describe('Agent node knowledge field filtering', () => {
const agentNode = makeNode({
inputs: [
{ label: 'Agent Name', name: 'agentName', type: 'string' },
{
label: 'Knowledge (Document Stores)',
name: 'agentKnowledgeDocumentStores',
type: 'array',
client: ['agentflowv2']
},
{
label: 'Knowledge (Vector Embeddings)',
name: 'agentKnowledgeVSEmbeddings',
type: 'array',
client: ['agentflowv2']
}
]
})
it('removes knowledge fields for agentflowsdk', () => {
const result = filterNodeByClient(agentNode, 'agentflowsdk')
const inputNames = result.inputs!.map((i: any) => i.name)
expect(inputNames).toContain('agentName')
expect(inputNames).not.toContain('agentKnowledgeDocumentStores')
expect(inputNames).not.toContain('agentKnowledgeVSEmbeddings')
})
it('keeps knowledge fields for agentflowv2', () => {
const result = filterNodeByClient(agentNode, 'agentflowv2')
const inputNames = result.inputs!.map((i: any) => i.name)
expect(inputNames).toContain('agentName')
expect(inputNames).toContain('agentKnowledgeDocumentStores')
expect(inputNames).toContain('agentKnowledgeVSEmbeddings')
})
})
describe('immutability', () => {
it('does not mutate the original node', () => {
const node = makeNode({