mirror of
https://github.com/langchain-ai/langgraph.git
synced 2026-09-27 03:55:00 +02:00
Test hitl prebuilt
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"dockerfile_lines": [],
|
||||
"graphs": {
|
||||
"langgraph101": "src/graph.py:agent"
|
||||
},
|
||||
"python_version": "3.11",
|
||||
"dependencies": [
|
||||
"."
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
[project]
|
||||
name = "test_studio"
|
||||
version = "0.1.0"
|
||||
description = "Test Studio"
|
||||
requires-python = ">=3.11"
|
||||
dependencies = [
|
||||
"langchain>=0.3.9",
|
||||
"langchain-core>=0.3.59",
|
||||
"langchain-openai",
|
||||
# Use local langgraph build
|
||||
"langgraph @ file:///Users/rlm/Desktop/Code/langgraph/libs/langgraph",
|
||||
"langgraph-prebuilt @ file:///Users/rlm/Desktop/Code/langgraph/libs/prebuilt",
|
||||
"langsmith[pytest]>=0.3.4",
|
||||
]
|
||||
|
||||
[project.optional-dependencies]
|
||||
dev = ["mypy>=1.11.1", "ruff>=0.6.1"]
|
||||
|
||||
[build-system]
|
||||
requires = ["setuptools>=73.0.0", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
|
||||
[tool.setuptools]
|
||||
packages = ["agent"]
|
||||
|
||||
[tool.setuptools.package-dir]
|
||||
"agent" = "src/graph"
|
||||
|
||||
[tool.setuptools.package-data]
|
||||
"*" = ["py.typed"]
|
||||
|
||||
[tool.ruff]
|
||||
lint.select = [
|
||||
"E", # pycodestyle
|
||||
"F", # pyflakes
|
||||
"I", # isort
|
||||
"D", # pydocstyle
|
||||
"D401", # First line should be in imperative mood
|
||||
"T201",
|
||||
"UP",
|
||||
]
|
||||
lint.ignore = [
|
||||
"UP006",
|
||||
"UP007",
|
||||
"UP035",
|
||||
"D417",
|
||||
"E501",
|
||||
]
|
||||
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"tests/*" = ["D", "UP"]
|
||||
|
||||
[tool.ruff.lint.pydocstyle]
|
||||
convention = "google"
|
||||
@@ -0,0 +1,27 @@
|
||||
from langchain.tools import tool
|
||||
from langgraph.prebuilt import create_react_agent
|
||||
from langgraph.checkpoint.memory import InMemorySaver
|
||||
from langgraph.prebuilt.interrupt import HumanInterruptConfig, InterruptToolNode
|
||||
|
||||
from langchain.chat_models import init_chat_model
|
||||
llm = init_chat_model("openai:gpt-4.1", temperature=0)
|
||||
|
||||
@tool
|
||||
def write_email(to: str, subject: str, content: str) -> str:
|
||||
"""Write and send an email."""
|
||||
# Placeholder response - in real app would send email
|
||||
return f"Email sent to {to} with subject '{subject}' and content: {content}"
|
||||
|
||||
agent = create_react_agent(
|
||||
llm,
|
||||
tools=[write_email],
|
||||
prompt="You are a helpful email assistant.",
|
||||
post_model_hook=InterruptToolNode(
|
||||
write_email=HumanInterruptConfig(
|
||||
allow_accept=True,
|
||||
allow_edit=True,
|
||||
allow_ignore=True,
|
||||
allow_respond=True,
|
||||
)
|
||||
),
|
||||
)
|
||||
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user