LangGraph agent invoke returns empty content and response_metadata with Kimi-K2.5 on Azure Foundry

Hi everyone! I wanted to try and build a fairly simple agent using LangGraph that does some Tool Calls. But I’ve been running into some Issues where the Response of the .invoke function i would get would be missing Data. I haven’t found anything Online yet regarding that so i wanted to try my luck here!

For Context:

I wanted to use Kimi-K2.5 hosted on Azure Foundry. I believe that Model is OpenAI API Compliant so i reused the AzureChatOpenAI Class from previous Testing which is working most of the time to send Requests to the LLM and get an Answer back:

# chat_model.py
llm = AzureChatOpenAI(
    api_key=settings.azure_foundry_api_key,
    azure_endpoint=settings.azure_foundry_endpoint,
    azure_deployment=settings.azure_foundry_chat_deployment,
    api_version=settings.azure_foundry_api_version,
)

coordinator_agent = llm.bind_tools(TOOLS)

My Graph is fairly basic, i decided to switch from using create_agent to just binding the tools to the llm directly in an attempt to get closer to the Issue I’m facing by doing some more logging:

# graph.py
def build_graph():
    """Build and compile the SPAIC coordinator graph."""
    graph = StateGraph(State, config_schema=Configuration)

    # Nodes
    graph.add_node("require_runtime_config_node", require_runtime_config_node)
    graph.add_node("coordinator", coordinator_node)
    graph.add_node("tools", ToolNode(TOOLS))

    # Edges
    graph.add_edge(START, "require_runtime_config_node")
    graph.add_edge("require_runtime_config_node", "coordinator")
    graph.add_conditional_edges("coordinator", tools_condition)
    graph.add_edge("tools", "coordinator")

    return graph.compile()

As for the Node that’s invoking the the LLM it looks something like this:

# coordinator_node.py
def coordinator_node(state: State) -> dict:
    """Run one coordinator model step and append the generated AI message."""
    input_messages = state.get("messages", [])
    model_input = [SystemMessage(content=_SYSTEM_PROMPT), *input_messages]

    try:
        result = coordinator_agent.invoke(model_input)
    except Exception as e:
        logger.error(
            "[coordinator_node] Agent invocation failed: %s: %s",
            type(e).__name__,
            e,
            exc_info=True,
        )
        raise

    if result is None:
        logger.warning("[coordinator_node] Model returned no message.")
        return {}

    # Warn if the model returned empty content — helps spot silent model failures.
    final = result
    if (
        isinstance(final, AIMessage)
        and not getattr(final, "content", "").strip()
        and not getattr(final, "tool_calls", None)
    ):
        if getattr(final, "response_metadata", None) in (None, {}, []):
            logger.error(
                "[coordinator_node] Model returned an empty message with no response metadata, indicating a likely silent failure. Check next logs for details:"
            )

        logger.warning(
            "[coordinator_node] invoke result: type=%s id=%s content=%r tool_calls=%s response_metadata=%s additional_kwargs=%s",
            type(result).__name__,
            getattr(result, "id", None),
            getattr(result, "content", None),
            getattr(result, "tool_calls", None),
            getattr(result, "response_metadata", {}),
            getattr(result, "additional_kwargs", {}),
        )

    return {"messages": [result]}

The Logs I’m seeing in the Console look something like that:

2026-03-16T11:36:21.255952Z [error    ] [coordinator_node] Model returned an empty message with no response metadata, indicating a likely silent failure. Check next logs for details: [nodes.coordinator_node] api_variant=local_dev assistant_id=2690b4e4-0442-45f6-9f92-18bbf0793538 graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=47cbdd8b-1bf1-4055-bb57-b440d0f50bfc run_attempt=1 run_id=019cf66e-565d-71e3-97da-f9f4db533ff0 thread_id=9cf311b8-5606-475c-87b6-1a6f9c745baf thread_name=MainThread
2026-03-16T11:36:21.256184Z [warning  ] [coordinator_node] invoke result: type=AIMessage id=lc_run--019cf66e-c249-7371-99e6-45f9201be563 content='' tool_calls=[] response_metadata={} additional_kwargs={} [nodes.coordinator_node] api_variant=local_dev assistant_id=2690b4e4-0442-45f6-9f92-18bbf0793538 graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=47cbdd8b-1bf1-4055-bb57-b440d0f50bfc run_attempt=1 run_id=019cf66e-565d-71e3-97da-f9f4db533ff0 thread_id=9cf311b8-5606-475c-87b6-1a6f9c745baf thread_name=MainThread

This is where i’m seeing the empty response_metadata object and in LangSmith Studio “no data.”

Am I doing something completely wrong? I believe that if the Model itself would have answered with no Message i should at least be seing response metadata. The Issue i’m seeing is happening sporadically, i can’t see a pattern.

Regarding my Versions. I’m running
“langchain>=1.2.10”,
“langchain-openai>=1.1.10”,
“langgraph>=1.0.0”,

on Python 3.12.12

Thank you all!

Hi @JNSAPH

Could you try using AzureAIChatCompletionsModel from the langchain-azure-ai package instead. This class is purpose-built for Azure AI Foundry’s Model Catalog and supports third-party models like DeepSeek R1, Cohere, Phi, Mistral, and - relevantly - Kimi-K2.5:

pip install -U langchain-azure-ai
from langchain_azure_ai.chat_models import AzureAIChatCompletionsModel

llm = AzureAIChatCompletionsModel(
    endpoint=settings.azure_foundry_endpoint,
    credential=settings.azure_foundry_api_key,
    model_name=settings.azure_foundry_chat_deployment,
    api_version=settings.azure_foundry_api_version,
)

coordinator_agent = llm.bind_tools(TOOLS)

This is documented at: Azure AI Integration - LangChain Docs.

Hi Pawel,
Thanks for your reply! The AzureAIChatCompletionsModel appears to be deprecated according to the docstring. I tried switching to AzureAIOpenAIApiChatModel, which seems to be the suggested replacement.

I tried using that but got a 404 Error. From what i can see here. I should use a endpoint in this Format:
https://{your-resource-name}.services.ai.azure.com/api/projects/{your-project}

The Foundry Resource that i created gives me an Endpoint in this Format tho:
https://{myresource-name}.cognitiveservices.azure.com/

I got the Correct Endpoint by Creating a Foundry Project instead of just a Foundry Resource (Azure is a mess) and creating a new deployment of the models in that new Project.

When i try to use that Endpoint i get a 400 Code Error from Azure saying my API version not supported:

(Error code: 400 - {'error': {'code': 'BadRequest', 'message': 'API version not supported'}}) 

I’ve tried several different Versions: 2024-08-01-preview, 2024-05-01-preview, … but none worked so far. That’s just an Azure Issue though

On the Side: I see on the Page of the Models Deployment also an Option to call the Endpoint via the OpenAI PIP package which says i should use the https://{myresource-name}.services.ai.azure.com/openai/v1/ Endpoint instead of the https://{resource-name}.services.ai.azure.com/api/projects/{project} Endpoint

You don’t happen to know where to go from here? If not I’ll get back to you once i am again able to send Requests to Azure!

Regarding this:
I am now able to send Request to Azure using the AzureAIOpenAIApiChatModel Class and the OpenAI Endpoint Azure Provides. I had the Constructor Parameters named wrong (model != model_name):

llm = AzureAIOpenAIApiChatModel(
    endpoint="https://{my_resource}.services.ai.azure.com/openai/v1/",
    credential="super_secret_key",
    model="Kimi-K2.5"
)

While i can send Requests that way now all the llm invokes i do are missing the Data

2026-03-16T15:10:03.382382Z [error    ] [coordinator_node] Model returned an empty message with no response metadata, indicating a likely silent failure. Check next logs for details: [nodes.coordinator_node] api_variant=local_dev assistant_id=7c2875c9-7fad-4eb8-80ee-7170a026587d graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=9f28940e-1249-402c-96a3-a81435dfa3d3 run_attempt=1 run_id=019cf732-6684-79c0-9299-95165b00cfec thread_id=284f1685-0e08-4adb-accb-127110efbf90 thread_name=asyncio_0
2026-03-16T15:10:03.383235Z [warning  ] [coordinator_node] invoke result: type=AIMessage id=lc_run--019cf732-697a-7723-9800-fbf26548a79c content='' tool_calls=[] response_metadata={} additional_kwargs={} [nodes.coordinator_node] api_variant=local_dev assistant_id=7c2875c9-7fad-4eb8-80ee-7170a026587d graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=9f28940e-1249-402c-96a3-a81435dfa3d3 run_attempt=1 run_id=019cf732-6684-79c0-9299-95165b00cfec thread_id=284f1685-0e08-4adb-accb-127110efbf90 thread_name=asyncio_0
2026-03-16T15:10:03.385188Z [warning  ] [tools_condition] Routing to __end__ with empty content and no tool calls. response_metadata={} [nodes.tools_condition] api_variant=local_dev assistant_id=7c2875c9-7fad-4eb8-80ee-7170a026587d graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=9f28940e-1249-402c-96a3-a81435dfa3d3 run_attempt=1 run_id=019cf732-6684-79c0-9299-95165b00cfec thread_id=284f1685-0e08-4adb-accb-127110efbf90 thread_name=asyncio_1

I see that the class silently enables the Responses API by default (use_responses_api=True) when both api_version and credential are provided.

The Responses API is an OpenAI-specific feature (GPT-5, o-series, codex only). Kimi-K2.5 likely doesn’t support it, so requests silently return empty content.

try using Chat Completion API instead of Responses API.

Cna you try one of these:

llm = AzureAIOpenAIApiChatModel(
    endpoint="https://{resource}.services.ai.azure.com/openai/v1/",
    credential="your-api-key",
    model="Kimi-K2.5",
    use_responses_api=False,
)

or

llm = AzureAIOpenAIApiChatModel(
    endpoint="https://{resource}.services.ai.azure.com/openai/v1/",
    credential="your-api-key",
    model="Kimi-K2.5",
    api_version="2024-10-21",          # check your Azure portal for the correct value for "v1"
    use_responses_api=False,
)

But I’m sure you will be able to call tools. Check it out please.

Sure! I’ve tried both but unfortunately I’m still not getting anything back from the Model. I did see a new Error though:

2026-03-16T18:23:03.290050Z [error    ] [coordinator_node] Agent invocation failed: ValueError: No generations found in stream. [nodes.coordinator_node] api_variant=local_dev assistant_id=7c2875c9-7fad-4eb8-80ee-7170a026587d graph_id=spaic_core langgraph_api_version=0.7.65 langgraph_node=coordinator request_id=159d2290-e6eb-44f3-9473-d9b7c17b0ef7 run_attempt=1 run_id=019cf7e3-1795-7603-97ab-7757978efda7 thread_id=a5738100-cd3c-41a7-b112-ec73e80925fe thread_name=asyncio_0

I tried disabling Streaming after seeing that Error and while that did not fix my Issue i got an Error from Azure saying that I’m being Rate Limited. The Azure Monitoring doesn’t show an unusual amount of Requests though.

I’ve been spending the last couple days trying to get this to work. Perhaps another model will just work but i was pretty set on going with Kimi K2.5 as the balance between Quality and Prcing seemed compelling.

Thank you so much for taking a look at my Issue :slight_smile:

If only I could debug more… but I don’t have my private Azure account. Maybe it’s the right time to change it :slight_smile:

You’ve helped plenty already! Do you happen to know if there is a way to see the HTTP Requests that Langchain does unter the Hood? Perhaps that could shine some light into what is happening.

I’ll also open a Thread / Ticket on a Microsoft Forum to see if they can help out and keep this Thread updated. I surely can’t be the only one having Issues with this :slight_smile:

hi @JNSAPH

thanks for your kind words!

regarding the http requests maybe some of these would help:

  1. logging
import logging

logging.getLogger("httpx").setLevel(logging.DEBUG)

logging.getLogger("openai").setLevel(logging.DEBUG)

logging.basicConfig(level=logging.DEBUG)
  1. include_response_headers=True
llm = AzureAIOpenAIApiChatModel(
    endpoint="https://{resource}.services.ai.azure.com/openai/v1/",
    credential="your-api-key",
    model="Kimi-K2.5",
    include_response_headers=True,
)

result = llm.invoke("Hello")
print(result.response_metadata)

This won’t show you the request body, but the response headers often reveal content-filter flags (x-ms-content-filter-*), rate-limit info, and the actual model serving the request.

  1. Custom httpx client with event hooks (full request + response body)

For the most complete picture, inject a custom httpx.Client with logging hooks. This captures the full request payload AND the raw response body - exactly what you’d need for a Microsoft support ticket:

import httpx
import json
import logging

logger = logging.getLogger("http_debug")
logger.setLevel(logging.DEBUG)

def log_request(request: httpx.Request):
    logger.debug(f">>> {request.method} {request.url}")
    logger.debug(f">>> Headers: {dict(request.headers)}")
    if request.content:
        try:
            body = json.loads(request.content)
            logger.debug(f">>> Body: {json.dumps(body, indent=2)}")
        except Exception:
            logger.debug(f">>> Body: {request.content[:500]}")

def log_response(response: httpx.Response):
    response.read()  # Ensure body is available
    logger.debug(f"<<< {response.status_code} {response.url}")
    logger.debug(f"<<< Headers: {dict(response.headers)}")
    logger.debug(f"<<< Body: {response.text[:2000]}")

http_client = httpx.Client(
    event_hooks={
        "request": [log_request],
        "response": [log_response],
    }
)

llm = AzureAIOpenAIApiChatModel(
    endpoint="https://{resource}.services.ai.azure.com/openai/v1/",
    credential="your-api-key",
    model="Kimi-K2.5",
    http_client=http_client,
)
  1. LangSmith tracing

connect to LangSmith

  1. via your OS, locally

what’s your OS? There are some tools for intercepting http requests

Hi there, I tried the Option with the “custom” http_client that logs. While i didn’t see any Azure Errors in there, there is still a bunch of usefull Information!

I’m currently on Windows, my next step would be to open a Ticket with Azure directly and see if they have any Tips :slight_smile:

1 Like

Alright :slight_smile: I’m looking forward to hearing more updates from you then