@@ -140,57 +140,60 @@ async function getFeatureFrontendFiles(featureId: string) {
140140}
141141
142142const integrationsFolderPath = '../../../integrations'
143- const agentFilesMapper : Record < string , ( agentKeys : string [ ] ) => Record < string , string > > = {
143+ const agentFilesMapper : Record < string , ( agentKeys : string [ ] ) => Record < string , string [ ] > > = {
144144 'middleware-starter' : ( ) => ( {
145- agentic_chat : path . join ( __dirname , integrationsFolderPath , `/middleware-starter/src/index.ts` )
145+ agentic_chat : [ path . join ( __dirname , integrationsFolderPath , `/middleware-starter/src/index.ts` ) ]
146146 } ) ,
147147 'pydantic-ai' : ( agentKeys : string [ ] ) => {
148148 return agentKeys . reduce ( ( acc , agentId ) => ( {
149149 ...acc ,
150- [ agentId ] : `https://github.com/pydantic/pydantic-ai/blob/main/examples/pydantic_ai_examples/ag_ui/api/${ agentId } .py`
150+ [ agentId ] : [ `https://github.com/pydantic/pydantic-ai/blob/main/examples/pydantic_ai_examples/ag_ui/api/${ agentId } .py` ]
151151 } ) , { } )
152152 } ,
153153 'server-starter' : ( ) => ( {
154- agentic_chat : path . join ( __dirname , integrationsFolderPath , `/server-starter/server/python/example_server/__init__.py` )
154+ agentic_chat : [ path . join ( __dirname , integrationsFolderPath , `/server-starter/server/python/example_server/__init__.py` ) ]
155155 } ) ,
156156 'server-starter-all-features' : ( agentKeys : string [ ] ) => {
157157 return agentKeys . reduce ( ( acc , agentId ) => ( {
158158 ...acc ,
159- [ agentId ] : path . join ( __dirname , integrationsFolderPath , `/server-starter/server/python/example_server/${ agentId } .py` )
159+ [ agentId ] : [ path . join ( __dirname , integrationsFolderPath , `/server-starter-all-features /server/python/example_server/${ agentId } .py` ) ]
160160 } ) , { } )
161161 } ,
162162 'mastra' : ( ) => ( {
163- agentic_chat : path . join ( __dirname , integrationsFolderPath , `/mastra/example/src/mastra/agents/weather-agent.ts` )
163+ agentic_chat : [ path . join ( __dirname , integrationsFolderPath , `/mastra/example/src/mastra/agents/weather-agent.ts` ) ]
164164 } ) ,
165165 'mastra-agent-lock' : ( ) => ( {
166- agentic_chat : path . join ( __dirname , integrationsFolderPath , `/mastra/example/src/mastra/agents/weather-agent.ts` )
166+ agentic_chat : [ path . join ( __dirname , integrationsFolderPath , `/mastra/example/src/mastra/agents/weather-agent.ts` ) ]
167167 } ) ,
168168 'vercel-ai-sdk' : ( ) => ( {
169- agentic_chat : path . join ( __dirname , integrationsFolderPath , `/vercel-ai-sdk/src/index.ts` )
169+ agentic_chat : [ path . join ( __dirname , integrationsFolderPath , `/vercel-ai-sdk/src/index.ts` ) ]
170170 } ) ,
171171 'langgraph' : ( agentKeys : string [ ] ) => {
172172 return agentKeys . reduce ( ( acc , agentId ) => ( {
173173 ...acc ,
174- [ agentId ] : path . join ( __dirname , integrationsFolderPath , `/langgraph/examples/agents/${ agentId } /agent.py` )
174+ [ agentId ] : [
175+ path . join ( __dirname , integrationsFolderPath , `/langgraph/examples/python/agents/${ agentId } /agent.py` ) ,
176+ path . join ( __dirname , integrationsFolderPath , `/langgraph/examples/typescript/src/agents/${ agentId } /agent.ts` )
177+ ]
175178 } ) , { } )
176179 } ,
177180 'langgraph-fastapi' : ( agentKeys : string [ ] ) => {
178181 return agentKeys . reduce ( ( acc , agentId ) => ( {
179182 ...acc ,
180- [ agentId ] : path . join ( __dirname , integrationsFolderPath , `/langgraph/python/ag_ui_langgraph/ examples/agents/${ agentId } .py` )
183+ [ agentId ] : [ path . join ( __dirname , integrationsFolderPath , `/langgraph/examples/python/ agents/${ agentId } /agent .py` ) ]
181184 } ) , { } )
182185 } ,
183186 'agno' : ( ) => ( { } ) ,
184187 'llama-index' : ( agentKeys : string [ ] ) => {
185188 return agentKeys . reduce ( ( acc , agentId ) => ( {
186189 ...acc ,
187- [ agentId ] : path . join ( __dirname , integrationsFolderPath , `/llamaindex/server-py/server/routers/${ agentId } .py` )
190+ [ agentId ] : [ path . join ( __dirname , integrationsFolderPath , `/llamaindex/server-py/server/routers/${ agentId } .py` ) ]
188191 } ) , { } )
189192 } ,
190193 'crewai' : ( agentKeys : string [ ] ) => {
191194 return agentKeys . reduce ( ( acc , agentId ) => ( {
192195 ...acc ,
193- [ agentId ] : path . join ( __dirname , integrationsFolderPath , `/crewai/python/ag_ui_crewai/examples/${ agentId } .py` )
196+ [ agentId ] : [ path . join ( __dirname , integrationsFolderPath , `/crewai/python/ag_ui_crewai/examples/${ agentId } .py` ) ]
194197 } ) , { } )
195198 }
196199}
@@ -202,14 +205,16 @@ async function runGenerateContent() {
202205 const agentsPerFeatures = agentConfig . agentKeys
203206
204207 const agentFilePaths = agentFilesMapper [ agentConfig . id ] ( agentConfig . agentKeys )
208+
205209 // Per feature, assign all the frontend files like page.tsx as well as all agent files
206210 for ( const featureId of agentsPerFeatures ) {
211+ const agentFilePathsForFeature = agentFilePaths [ featureId ] ?? [ ]
207212 // @ts -expect-error -- redundant error about indexing of a new object.
208213 result [ `${ agentConfig . id } ::${ featureId } ` ] = [
209214 // Get all frontend files for the feature
210215 ...( await getFeatureFrontendFiles ( featureId ) ) ,
211216 // Get the agent (python/TS) file
212- await getFile ( agentFilePaths [ featureId ] )
217+ ... ( await Promise . all ( agentFilePathsForFeature . map ( async f => await getFile ( f ) ) ) )
213218 ]
214219 }
215220 }
0 commit comments