Skip to content

Commit 755e49a

Browse files
Merge pull request #409 from rogerscuall/patch-1
Update agent.mdx to improve memory explanation
2 parents afd571b + 99db21b commit 755e49a

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

units/en/unit3/agentic-rag/agent.mdx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -422,8 +422,7 @@ alfred_with_memory = CodeAgent(
422422
tools=[guest_info_tool, weather_info_tool, hub_stats_tool, search_tool],
423423
model=model,
424424
add_base_tools=True,
425-
planning_interval=3,
426-
memory=True # Enable conversation memory
425+
planning_interval=3
427426
)
428427

429428
# First interaction
@@ -432,7 +431,7 @@ print("🎩 Alfred's First Response:")
432431
print(response1)
433432

434433
# Second interaction (referencing the first)
435-
response2 = alfred_with_memory.run("What projects is she currently working on?")
434+
response2 = alfred_with_memory.run("What projects is she currently working on?", reset=False)
436435
print("🎩 Alfred's Second Response:")
437436
print(response2)
438437
```
@@ -484,6 +483,11 @@ print(response['messages'][-1].content)
484483
</hfoption>
485484
</hfoptions>
486485

486+
Notice that none of these three agent approaches directly couple memory with the agent. Is there a specific reason for this design choice 🧐?
487+
* smolagents: Memory is not preserved across different execution runs, you must explicitly state it using `reset=False`.
488+
* LlamaIndex: Requires explicitly adding a context object for memory management within a run.
489+
* LangGraph: Offers options to retrieve previous messages or utilize a dedicated [MemorySaver](https://langchain-ai.github.io/langgraph/tutorials/introduction/#part-3-adding-memory-to-the-chatbot) component.
490+
487491
## Conclusion
488492

489493
Congratulations! You've successfully built Alfred, a sophisticated agent equipped with multiple tools to help host the most extravagant gala of the century. Alfred can now:

0 commit comments

Comments
 (0)