Skip to content

Commit c6e3f34

Browse files
Add tool
Signed-off-by: Luis Valdes <[email protected]>
1 parent c32f8bd commit c6e3f34

File tree

1 file changed

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

1 file changed

+11
-1
lines changed

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

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,23 @@
1414
from langgraph.types import Command
1515
from langchain_core.tools import tool
1616

17-
1817
class AgentState(MessagesState):
1918
"""
2019
State of our graph.
2120
"""
2221
tools: List[Any] = []
2322

2423

24+
@tool
25+
def change_background(background: str) -> str: # pylint: disable=unused-argument
26+
"""
27+
Change the background color of the chat. Can be anything that the CSS background attribute accepts. Regular colors, linear of radial gradients etc.
28+
29+
Args:
30+
background: str: The background color to change to. Can be anything that the CSS background attribute accepts. Regular colors, linear of radial gradients etc.
31+
""" # pylint: disable=line-too-long
32+
33+
2534
async def chat_node(state: AgentState, config: Optional[RunnableConfig] = None):
2635
"""
2736
Standard chat node based on the ReAct design pattern. It handles:
@@ -45,6 +54,7 @@ async def chat_node(state: AgentState, config: Optional[RunnableConfig] = None):
4554
model_with_tools = model.bind_tools(
4655
[
4756
*state.get("tools", []),
57+
change_background,
4858
# your_tool_here
4959
],
5060

0 commit comments

Comments
 (0)