Skip to content

Commit 5474e4e

Browse files
Add tool to change background
Signed-off-by: Luis Valdes <[email protected]>
1 parent 017da0b commit 5474e4e

File tree

1 file changed

+11
-0
lines changed
  • typescript-sdk/integrations/langgraph/examples/python/agents/agentic_chat

1 file changed

+11
-0
lines changed

typescript-sdk/integrations/langgraph/examples/python/agents/agentic_chat/agent.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@
1212
from langgraph.graph import StateGraph, END, START
1313
from langgraph.graph import MessagesState
1414
from langgraph.types import Command
15+
from langchain_core.tools import tool
1516

1617
class AgentState(MessagesState):
1718
"""
1819
State of our graph.
1920
"""
2021
tools: List[Any] = []
2122

23+
@tool
24+
def change_background(background: str) -> str: # pylint: disable=unused-argument
25+
"""
26+
Change the background color of the chat. Can be anything that the CSS background attribute accepts. Regular colors, linear of radial gradients etc.
27+
28+
Args:
29+
background: str: The background color to change to. Can be anything that the CSS background attribute accepts. Regular colors, linear of radial gradients etc.
30+
""" # pylint: disable=line-too-long
31+
2232
async def chat_node(state: AgentState, config: Optional[RunnableConfig] = None):
2333
"""
2434
Standard chat node based on the ReAct design pattern. It handles:
@@ -42,6 +52,7 @@ async def chat_node(state: AgentState, config: Optional[RunnableConfig] = None):
4252
model_with_tools = model.bind_tools(
4353
[
4454
*state.get("tools", []),
55+
change_background,
4556
# your_tool_here
4657
],
4758

0 commit comments

Comments
 (0)