-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add memory agent and caching functionality 🧠✨ (#761)
* Add memory agent and caching functionality 🧠✨ * Add memory cache support and enhance agent memory management 🧠✨ * Remove incomplete bullet point from system.mdx 📄✂️ * Refactor memory handling: rename `memory` to `disableMemory` 🚀 * Improve GitHub detection regex for system inclusion 🔍 * Refactor workflow parameters and update branch-specific failed run search 🚀🔍 * Fix typo in 'retrieves' across documentation and source files 📚🛠️ * Add agent memory section and disableMemory option 🧠🔧 * Update agents.mdx to clarify `agent_memory` usage and enable instructions 📚🧠 * Remove memory usage and redundant info in system agent configs ✨ * Update workflow scripts for failure handling and memory caching 🔄 * Update guidelines: duplicated exclusion rules 📝
- Loading branch information
Showing
34 changed files
with
341 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
system({ | ||
title: "agent that retrieves memories", | ||
}) | ||
|
||
const cache = await host.cache("agent_memory") | ||
defAgent( | ||
"memory", | ||
"queries the memories created by other agent conversations.", | ||
async (ctx) => { | ||
const memories = await cache.values() | ||
ctx.$`Your are a helpfull LLM agent that acts as a knowledge base for memories created by other agents. | ||
Answer the question in QUERY with the memories in MEMORY. | ||
- Use the information in MEMORY exclusively to answer the question in QUERY. | ||
- If the information in MEMORY is not enough to answer the question in QUERY, respond <NO_MEMORY>. | ||
- The memory | ||
` | ||
memories.reverse().forEach( | ||
({ agent, query, answer }) => | ||
ctx.def( | ||
"MEMORY", | ||
`${agent}> ${query}? | ||
${answer} | ||
` | ||
), | ||
{ | ||
flex: 1, | ||
} | ||
) | ||
}, | ||
{ | ||
model: "openai:gpt-4o", | ||
flexTokens: 30000, | ||
system: ["system"], | ||
disableMemory: true, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.