Sunday, August 18, 2024

Added another agent to my workflows, this one captures the google custom search api.

 Added another proc agent tonight. When I pair it up with the exec_api_get agent it retrieves a google custom search.  See all the optional parameters? 


This is the workflow with the google search agent and the network get request agent. 



   The "num": "5" line is an optional parameter to the function. You don't have to have it in the list, and if you don't have it, it just doesn't get added to the request url.  


And this is the first full function that takes advantage of the optional parameters to capture an api.  I don't have any unit checking because I want to add units and grep strings to find valid matches for the inputs automagically in my config files. 


If you notice, not a single optional parameter is mentioned by name in the body of the function. It magically creates a list of the optional parameters and only adds the ones that aren't the empty string.  So you can update the list of parameters and never touch the body of the code.  This was the hardest one to write, now that I have this as an example, they get trivially easy moving forward.

I started by testing just the agent alone where it gets automatically promoted to a workflow by using the singleton workflow. It took me a few hours to realize that the reason I could not add an optional parameter was because of a bug in the create singleton where it needs to compare the agents optional parameters to the cli_args list and add inputs to both the workflow step parameters, but also add them as an input parameter in the step, mapped to the input in the workflow.





No comments:

Post a Comment