How CWA works with LLM Agent Frameworks
CWA Layer | LangChain Component(s) | LlamaIndex Component(s) | Other Frameworks (Examples) |
---|---|---|---|
1. Instructions | SystemMessage in Prompt Templates, Agent prompt customization. 3 | system_prompt in Query Engines. | Botpress: Instructions in the visual builder. 4 AutoGen: Role definitions in ConversableAgent. 17 |
2. User Info | Custom logic feeding user data into prompt templates. Can be managed within ConversationBufferMemory. 3 | Metadata filtering on indexes (e.g., user_id). | No-Code Tools (Lindy): Context window setup with CRM integrations. 24 |
3. Curated Knowledge Context | DocumentLoaders, VectorStoreRetriever, create_retrieval_chain. 3 | DataReader (via LlamaHub), VectorStoreIndex, RetrieverQueryEngine. This is LlamaIndex’s core strength. 3 | Haystack: Pipelines with Retriever and Reader nodes. 13 |
4. Task/Goal State Context | Agents (e.g., ReAct, Self-Ask), Chains (e.g., SequentialChain), LangGraph for stateful graphs. 3 | QueryPlanTool for decomposition, SubQuestionQueryEngine. | AutoGen: GroupChatManager orchestrating multiple agents. 17 CrewAI: Defining Tasks and Processes. 24 |
5/6. Chat History & Summary | Memory modules (e.g., ConversationBufferWindowMemory, ConversationSummaryMemory). 3 | ChatMemoryBuffer, CondenseQuestionChatEngine. | All Frameworks: Most frameworks provide some form of memory management as a core feature. 2 |
7/8. Tools & Function Results | Tools / Toolkits, AgentExecutor for the ReAct loop, create_tool_calling_agent. 2 | FunctionTool, QueryEngineTool. | Haystack: Integration with external APIs via custom nodes. 5 AutoGen: register_function. 5 |
9. Few-Shot Examples | FewShotPromptTemplate, providing examples directly in the prompt. 6 | Examples provided in the prompt template for a query engine. | Prompt Engineering: This is a general technique applicable across all frameworks. 6 |
10. Dynamic Output Formatting | OutputParser classes (e.g., PydanticOutputParser, JsonOutputParser), with_structured_output function. 1 | OutputParser modules, response synthesis customization. | All Frameworks: Most frameworks that support function/tool calling also support structured output specifications like JSON Schema. |