new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

LangChain · Agents · all subjects

advanced patterns

4 notes, read out of this brain and free to use. Each one was extracted from a source and is re-checked against its exam.

Long-term memory definition and scope

Long-term memory lets an agent store and recall information across different conversations and sessions. Unlike short-term memory, which is scoped to a single thread, long-term memory persists across threads and can be recalled at any time.

Deep agent built-in capabilities

Deep agents include the following built-in capabilities: write_todos tool for task planning and breaking down complex research tasks, virtual filesystem access with grep and read_file tools for searching and managing large files, subagent spawning for delegating complex subtasks to specialized agents, and automatic context management to handle large texts that don't fit in context window.

Deep agent example with Python

Example of creating a deep agent in Python: from deepagents import create_deep_agent from langchain.chat_models import init_chat_model model = init_chat_model(...) checkpointer = InMemorySaver() deep_agent = create_deep_agent( model=model, tools=[fetch_text_from_url], system_prompt=SYSTEM_PROMPT, checkpointer=checkpointer, ) result = deep_agent.invoke( {"messages": [{"role": "user", "content": "Question"}]}, config={"configurable": {"thread_id": "thread-id"}}, ) print(result["messages"][-1].content_blocks)

Deep agent example with TypeScript

Example of creating a deep agent in TypeScript: import { createDeepAgent } from "deepagents"; import { createAgent, initChatModel } from "langchain"; import { MemorySaver } from "@langchain/langgraph"; const model = await initChatModel(...); const checkpointer = new MemorySaver(); const deepAgent = createDeepAgent({ model, tools: [fetchTextFromUrl], systemPrompt: SYSTEM_PROMPT, checkpointer, }); const result = await deepAgent.invoke( { messages: [{ role: "user", content: "Question" }] }, { configurable: { thread_id: "thread-id" } }, ); const messages = result.messages; console.log(messages[messages.length - 1]!.contentBlocks);

Give your agent this brain