A Common-Sense Guide to AI Engineering: Appending results to rag_chunks in research_docs (sub-agent) (page: 216 and page 226)

hi, Jay

research_docs maintains a rag_chunks dictionary at the start of the function and the results from search_manual and read_webpage are added to it. This rag_chunks dictionary is then inserted in to the conversation as a the result of the function call, i.e., rag_chunks keeps building up within the research_docs function. Supposed the agent created the following function calls:

  • search_manual
  • read_webpage
  • search_manual

The research history would be similar to the following:

FUNCTION CALL: { call_id: 1, search_manual }
FUNCTION CALL OUTPUT:  { call_id: 1, search_manual_output_1 }

FUNCTION CALL: { call_id: 2, read_webpage }
FUNCTION CALL OUTPUT:  { call_id: 2, search_manual_output_1, read_webpage_output_1 }

FUNCTION CALL: { call_id: 3, search_manual }
FUNCTION CALL OUTPUT:  { call_id: 3, search_manual_output_1, read_webpage_output_1 , search_manual_output_2}

It is unlike flow discussed on page 226.

Question then is: which is the desired outcome? The code on page 216 (with repeated outputs) or the discussion on 226 (without repeated outputs)? My hunch is the latter.