# A Common-Sense Guide to AI Engineering: Appending results to rag\_chunks in research\_docs (sub-agent) (page: 216 and page 226)

**URL:** <https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344>\
**Category:** PragProg Customers\
**Tags:** book-a-common-sense-guide-to-ai-engineering, question\
**Created:** [16 June 2026 17:28 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344 "2026-06-16T17:28:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![shaolang](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@shaolang](https://forum.devtalk.com/u/shaolang)\
**Post date:** [16 June 2026 17:28 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344/1 "2026-06-16T17:28:08Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![jaywengrow](https://forum.devtalk.com/user_avatar/forum.devtalk.com/jaywengrow/32/527_2.png) [@jaywengrow](https://forum.devtalk.com/u/jaywengrow)\
**Post date:** [3 July 2026 18:05 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344/2 "2026-07-03T18:05:01Z")

</div>

Thanks for this! I think I see what you’re saying. You mean to say that search\_manual shouldn’t have to return the entire rag\_chunks again, but rather only the _new_ chunks that were found by the most recent search. Is that what you mean?

---

<div class="post-metadata">

**Author:** ![shaolang](https://forum.devtalk.com/letter_avatar_proxy/v4/letter/s/6a8cbe/32.png) [@shaolang](https://forum.devtalk.com/u/shaolang)\
**Post date:** [4 July 2026 02:30 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344/3 "2026-07-04T02:30:57Z")

</div>

Yes. I think it shouldn’t. If it should, it’s not apparent in the text (or that I somehow miss it).

---

<div class="post-metadata">

**Author:** ![jaywengrow](https://forum.devtalk.com/user_avatar/forum.devtalk.com/jaywengrow/32/527_2.png) [@jaywengrow](https://forum.devtalk.com/u/jaywengrow)\
**Post date:** [8 July 2026 19:51 UTC](https://forum.devtalk.com/t/a-common-sense-guide-to-ai-engineering-appending-results-to-rag-chunks-in-research-docs-sub-agent-page-216-and-page-226/247344/4 "2026-07-08T19:51:10Z")

</div>

That makes sense, thank you! I plan to fix this for a future edition.
