Skip to content

Commit 406d730

Browse files
authored
fix: add missing imports and correct agent initialization syntax (#1536)
## Overview <!-- Brief description of what documentation is being added/updated --> ## Type of change **Type:** [Replace with: New documentation page / Update existing documentation / Fix typo/bug/link/formatting / Remove outdated content / Other] ## Related issues/PRs <!-- Link to related issues, feature PRs, or discussions (if applicable) To automatically close an issue when this PR is merged, use closing keywords: - "closes #123" or "fixes #123" or "resolves #123" For regular references without auto-closing, just use: - "#123" or "See issue #123" Examples: - closes #456 (will auto-close issue #456 when PR is merged) - See #789 for context (will reference but not auto-close issue #789) --> - GitHub issue: - Feature PR: <!-- For LangChain employees, if applicable: --> - Linear issue: - Slack thread: ## Checklist <!-- Put an 'x' in all boxes that apply --> - [ ] I have read the [contributing guidelines](README.md) - [ ] I have tested my changes locally using `docs dev` - [ ] All code examples have been tested and work correctly - [ ] I have used **root relative** paths for internal links - [ ] I have updated navigation in `src/docs.json` if needed (Internal team members only / optional): Create a preview deployment as necessary using the [Create Preview Branch workflow](https://github.com/langchain-ai/docs/actions/workflows/create-preview-branch.yml) ## Additional notes <!-- Any other information that would be helpful for reviewers -->
1 parent f6df489 commit 406d730

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/oss/langchain/short-term-memory.mdx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,6 +964,7 @@ from langgraph.graph.message import REMOVE_ALL_MESSAGES
964964
from langgraph.checkpoint.memory import InMemorySaver
965965
from langchain.agents import create_agent, AgentState
966966
from langchain.agents.middleware import before_model
967+
from langchain_core.runnables import RunnableConfig
967968
from langgraph.runtime import Runtime
968969
from typing import Any
969970

@@ -987,11 +988,12 @@ def trim_messages(state: AgentState, runtime: Runtime) -> dict[str, Any] | None:
987988
]
988989
}
989990

991+
990992
agent = create_agent(
991-
model,
993+
"gpt-5-nano",
992994
tools=[],
993-
middleware=[trim_messages]
994-
checkpoint=InMemorySaver()
995+
middleware=[trim_messages],
996+
checkpointer=InMemorySaver()
995997
)
996998

997999
config: RunnableConfig = {"configurable": {"thread_id": "1"}}

0 commit comments

Comments
 (0)