a7d6d88f6f
CI / changes (push) Has been cancelled
CI / cd libs/checkpoint (push) Has been cancelled
CI / cd libs/checkpoint-conformance (push) Has been cancelled
CI / cd libs/checkpoint-postgres (push) Has been cancelled
CI / cd libs/checkpoint-sqlite (push) Has been cancelled
CI / cd libs/cli (push) Has been cancelled
CI / cd libs/prebuilt (push) Has been cancelled
CI / cd libs/sdk-py (push) Has been cancelled
CI / cd libs/langgraph (push) Has been cancelled
CI / Check SDK methods matching (push) Has been cancelled
CI / Check CLI schema hasn't changed #3.13 (push) Has been cancelled
CI / CLI integration test (push) Has been cancelled
CI / sdk-py integration test (push) Has been cancelled
CI / CI Success (push) Has been cancelled
baseline / benchmark (push) Has been cancelled
Deploy Redirects to GitHub Pages / deploy (push) Has been cancelled
30 lines
781 B
Python
30 lines
781 B
Python
from collections.abc import Sequence
|
|
from typing import Annotated, TypedDict
|
|
|
|
from langchain_core.messages import AIMessage, BaseMessage
|
|
from langgraph.graph import END, START, StateGraph
|
|
from langgraph.graph.message import add_messages
|
|
|
|
|
|
class State(TypedDict):
|
|
messages: Annotated[Sequence[BaseMessage], add_messages]
|
|
|
|
|
|
def call_model(state: State) -> dict:
|
|
message = AIMessage(content="Hello from simple uv agent!")
|
|
return {"messages": [message]}
|
|
|
|
|
|
def should_continue(state: State):
|
|
if len(state["messages"]) > 0:
|
|
return END
|
|
return "call_model"
|
|
|
|
|
|
workflow = StateGraph(State)
|
|
workflow.add_node("call_model", call_model)
|
|
workflow.add_edge(START, "call_model")
|
|
workflow.add_conditional_edges("call_model", should_continue)
|
|
|
|
graph = workflow.compile()
|