-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
bugSomething isn't workingSomething isn't workingpendingawaiting review/confirmation by maintainerawaiting review/confirmation by maintainer
Description
Checked other resources
- This is a bug, not a usage question. For questions, please use the LangChain Forum (https://forum.langchain.com/).
- I added a clear and detailed title that summarizes the issue.
- I read what a minimal reproducible example is (https://stackoverflow.com/help/minimal-reproducible-example).
- I included a self-contained, minimal example that demonstrates the issue INCLUDING all the relevant imports. The code run AS IS to reproduce the issue.
Example Code
from langgraph.prebuilt import create_react_agent
from datetime import datetime
from zoneinfo import ZoneInfo
from enum import StrEnum
from typing import Annotated, Literal
import httpx
from langchain_openai import ChatOpenAI
from langchain_google_genai import ChatGoogleGenerativeAI
from langchain_openai import ChatOpenAI
class StatusCategory(StrEnum):
DONE = "Done"
TODO = "To Do"
IN_PROGRESS = "In Progress"
IN_REVIEW = "In Review"
class Priority(StrEnum):
LOW = "Low"
MEDIUM = "Medium"
HIGH = "High"
URGENT = "Urgent"
model = ChatGoogleGenerativeAI(
model="gemini-2.5-flash-lite",
api_key=google_api_key,
temperature=0.9,
max_retries=2,
)
# model =ChatOpenAI(
# model="gpt-4o-mini",
# api_key=openai_api_key,
# temperature=0.9,
# max_retries=2,
# )
async def update_task_status(
task_key: str,
status: Literal[StatusCategory.TODO, StatusCategory.IN_PROGRESS, StatusCategory.IN_REVIEW, StatusCategory.DONE],
):
"""
Update the status of a specific task.
Args:
task_key (str): The name of the task to update.
status (str): The new status to set for the task.
"""
return "successful"
async def update_task_priority(
task_key: str,
priority: Literal[Priority.LOW, Priority.MEDIUM, Priority.HIGH, Priority.URGENT],
):
"""
Update the priority of a specific task.
Args:
task_key (str): The name of the task to update.
priority (str): The new priority level to set for the task.
"""
return "successful"
AGENT_CRUD_PROMPT = """
# Identity
You are a CRUD Assistant, designed to help the Project Manager create, update, or delete tasks based on their requests.
Current time is: {current_time}
# CRITICAL INSTRUCTION
* You must always reply in {last_user_message_language}"""
tz = ZoneInfo("Asia/Ho_Chi_Minh")
prompt = AGENT_CRUD_PROMPT.format(
current_time=datetime.now(tz).strftime("%A, %Y-%m-%d %H:%M:%S"),
last_user_message_language="vietnamese",
)
agent = create_react_agent(
model=model,
tools=[update_task_status, update_task_priority],
prompt=prompt
)
response = await agent.ainvoke(
{"messages": [{"role": "user", "content": "update status of task P1-10 in project1-1 to In Progress and priority to Urgent"}]},
)
Error Message and Stack Trace (if applicable)
AIMessage(content='', additional_kwargs={}, response_metadata={'prompt_feedback': {'block_reason': 0, 'safety_ratings': []}, 'finish_reason': 'STOP', 'model_name': 'gemini-2.5-flash-lite', 'safety_ratings': []}, id='run--f2380282-040d-4acd-b5ef-449b8bc7c159-0', usage_metadata={'input_tokens': 402, 'output_tokens': 0, 'total_tokens': 402, 'input_token_details': {'cache_read': 0}})
Description
I tried running the same code with both Gemini and OpenAI (GPT-4o family). In most cases, the agent returns an empty response instead of the expected output. This makes it difficult to determine whether the issue is in the code, the agent setup, or the model integration.
langgraph=0.6.8
langchain-google-genai=2.1.12
langchain-openai=0.3.34
System Info
Run in a .ipynb file
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingpendingawaiting review/confirmation by maintainerawaiting review/confirmation by maintainer