Question About Efficient Token Use for Crews

Hi all, I am relatively new to CrewAI and had a question about efficiently creating agents/tasks to allow me to handle a problem. If you could provide any advice/point me to appropriate documentation/examples for my question below, it would be greatly appreciated!

Essentially, I want to run a series of prompts in which I ask a question about a piece of information, using the text of a file for the LLM to base it’s answers on. If I was doing this using an LLM’s API, I would simply provide the document as a system prompt and user prompt the LLM for each piece of information. However, I would like to use CrewAI to orchestrate this process and take advantage of output format enforcement, async execution and other features.

My question is:

  1. Given my problem overview, how would I create a crew that would efficiently execute it (especially without reproviding the file as a user prompt to every LLM call). It makes sense for me to have an agent that takes a piece of information/text and has the context of the document and outputs a well-formatted answer about the information. What’s confusing to me is how to have a task/agent that takes in as context all of the pieces of information and the document and delegates it to the specialized agent to repeat a task many times for each individual piece of information

Efficient context management is important when working with multiple LLM tasks, especially when you want to save tokens and maintain consistent results. Using shared context and well-structured tasks can make workflows easier to manage. Outside of AI, daily quizzes are another great way to keep learning and improve general knowledge. I’d recommend checking out this website, which offers daily quiz questions and answers in a simple format. It can be useful for people who enjoy testing their knowledge, exploring different topics, and making learning part of their everyday routine.

I’d separate document loading from the question-answering tasks. If the document is small enough, pass it through shared inputs or task context and provide each question separately. For larger documents or many questions, RAG could help by retrieving only the relevant sections.

One important point: sharing context between tasks doesn’t necessarily reduce token usage, since the document may still be sent to the LLM on each call.