langchain - 💡(How to fix) Fix azure gpt-5.3-codex not working [4 comments, 3 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
langchain-ai/langchain#36106Fetched 2026-04-08 01:01:54
View on GitHub
Comments
4
Participants
3
Timeline
14
Reactions
0
Author
Timeline (top)
commented ×4labeled ×4mentioned ×2subscribed ×2

I'm trying to use gpt-5.3-codex in my langgraph workflow. When I run it I get error 400

Error Message

ERROR:workflow2:Error in terminal_invoke Traceback (most recent call last): File "/app/workflow2.py", line 97, in terminal_invoke result = self.terminal.invoke({"messages": [ HumanMessage(content="Project files: " + json.dumps(files)), HumanMessage(content=prompt)]}) File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 3292, in invoke for chunk in self.stream( ~~~~~~~~~~~^ input, ^^^^^^ ...<10 lines>... **kwargs, ^^^^^^^^^ ): ^ File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2725, in stream for _ in runner.tick( ~~~~~~~~~~~^ [t for t in loop.tasks.values() if not t.writes], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<2 lines>... schedule_task=loop.accept_push, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ): ^ File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_runner.py", line 167, in tick run_with_retry( ~~~~~~~~~~~~~~^ t, ^^ ...<10 lines>... }, ^^ ) ^ File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_retry.py", line 96, in run_with_retry return task.proc.invoke(task.input, config) ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 656, in invoke input = context.run(step.invoke, input, config, **kwargs) File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 400, in invoke ret = self.func(*args, **kwargs) File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1301, in model_node model_response = _execute_model_sync(request) File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1273, in execute_model_sync output = model.invoke(messages) File "/app/.venv/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 5695, in invoke return self.bound.invoke( ~~~~~~~~~~~~~~~~~^ input, ^^^^^^ self._merge_configs(config), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ **{**self.kwargs, **kwargs}, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 402, in invoke self.generate_prompt( ~~~~~~~~~~~~~~~~~~~~^ [self._convert_input(input)], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ...<6 lines>... **kwargs, ^^^^^^^^^ ).generations[0][0], ^ File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1149, in generate_prompt return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs) ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 958, in generate self._generate_with_cache( ~~~~~~~~~~~~~~~~~~~~~~~~~^ m, ^^ ...<2 lines>... **kwargs, ^^^^^^^^^ ) ^ File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1261, in _generate_with_cache result = self._generate( messages, stop=stop, run_manager=run_manager, **kwargs ) File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1490, in _generate _handle_openai_bad_request(e) ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^ File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1487, in _generate raw_response = self.client.with_raw_response.create(**payload) File "/app/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 367, in wrapped return cast(LegacyAPIResponse[R], func(*args, **kwargs)) ~~~~^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper return func(*args, **kwargs) File "/app/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1211, in create return self._post( ~~~~~~~~~~^ "/chat/completions", ^^^^^^^^^^^^^^^^^^^^ ...<47 lines>... stream_cls=Stream[ChatCompletionChunk], ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ) ^ File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1297, in post return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls)) ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1070, in request raise self._make_status_error_from_response(err.response) from None openai.BadRequestError: Error code: 400 - {'error': {'message': 'The requested operation is unsupported.'}}

Root Cause

I'm trying to use gpt-5.3-codex in my langgraph workflow. When I run it I get error 400

Fix Action

Fix / Workaround

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Other Dependencies

aiohttp: 3.13.3 anthropic: 0.86.0 dataclasses-json: 0.6.7 httpx: 0.28.1 httpx-sse: 0.4.3 jsonpatch: 1.33 langgraph: 1.1.3 numpy: 2.4.2 openai: 2.29.0 opentelemetry-api: 1.39.1 opentelemetry-exporter-otlp-proto-http: 1.39.1 opentelemetry-sdk: 1.39.1 orjson: 3.11.5 packaging: 25.0 pydantic: 2.12.5 pydantic-settings: 2.12.0 pytest: 9.0.2 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 rich: 14.2.0 simsimd: 6.5.16 SQLAlchemy: 2.0.46 sqlalchemy: 2.0.46 tenacity: 9.1.2 tiktoken: 0.12.0 typing-extensions: 4.15.0 uuid-utils: 0.12.0 weaviate-client: 4.20.4 zstandard: 0.25.0

Code Example

# instantiate model
llm= AzureChatOpenAI(azure_endpoint=env["AZURE_LAB_ENDPOINT"], api_key=env["AZURE_LAB_API_KEY"],
                    azure_deployment=env["AZURE_LAB_DEPLOYMENT_5.3"], temperature=temperature,
                    api_version=env["OPENAI_API_VERSION"],
                    timeout=7000)

# create agent
agent= create_agent(llm,
            tools=[...], #add some tools
            system_prompt=prompt,
            name="myagent",
            checkpointer=memory
        )

# invoke
msgs= [HumanMessage("blah blah")]
agent.invoke({"messages": msgs})

---

ERROR:workflow2:Error in terminal_invoke
Traceback (most recent call last):
  File "/app/workflow2.py", line 97, in terminal_invoke
    result = self.terminal.invoke({"messages": [
        HumanMessage(content="Project files: " + json.dumps(files)),
        HumanMessage(content=prompt)]})
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 3292, in invoke
    for chunk in self.stream(
                 ~~~~~~~~~~~^
        input,
        ^^^^^^
    ...<10 lines>...
        **kwargs,
        ^^^^^^^^^
    ):
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2725, in stream
    for _ in runner.tick(
             ~~~~~~~~~~~^
        [t for t in loop.tasks.values() if not t.writes],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        schedule_task=loop.accept_push,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_runner.py", line 167, in tick
    run_with_retry(
    ~~~~~~~~~~~~~~^
        t,
        ^^
    ...<10 lines>...
        },
        ^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_retry.py", line 96, in run_with_retry
    return task.proc.invoke(task.input, config)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 656, in invoke
    input = context.run(step.invoke, input, config, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 400, in invoke
    ret = self.func(*args, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1301, in model_node
    model_response = _execute_model_sync(request)
  File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1273, in _execute_model_sync
    output = model_.invoke(messages)
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 5695, in invoke
    return self.bound.invoke(
           ~~~~~~~~~~~~~~~~~^
        input,
        ^^^^^^
        self._merge_configs(config),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        **{**self.kwargs, **kwargs},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 402, in invoke
    self.generate_prompt(
    ~~~~~~~~~~~~~~~~~~~~^
        [self._convert_input(input)],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        **kwargs,
        ^^^^^^^^^
    ).generations[0][0],
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1149, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 958, in generate
    self._generate_with_cache(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        m,
        ^^
    ...<2 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1261, in _generate_with_cache
    result = self._generate(
        messages, stop=stop, run_manager=run_manager, **kwargs
    )
  File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1490, in _generate
    _handle_openai_bad_request(e)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1487, in _generate
    raw_response = self.client.with_raw_response.create(**payload)
  File "/app/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 367, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1211, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1297, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1070, in request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'The requested operation is unsupported.'}}
RAW_BUFFERClick to expand / collapse

Checked other resources

  • This is a bug, not a usage question.
  • I added a clear and descriptive title that summarizes this issue.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangChain rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangChain (or the specific integration package).
  • This is not related to the langchain-community package.
  • I posted a self-contained, minimal, reproducible example. A maintainer can copy it and run it AS IS.

Package (Required)

  • langchain
  • langchain-openai
  • langchain-anthropic
  • langchain-classic
  • langchain-core
  • langchain-model-profiles
  • langchain-tests
  • langchain-text-splitters
  • langchain-chroma
  • langchain-deepseek
  • langchain-exa
  • langchain-fireworks
  • langchain-groq
  • langchain-huggingface
  • langchain-mistralai
  • langchain-nomic
  • langchain-ollama
  • langchain-openrouter
  • langchain-perplexity
  • langchain-qdrant
  • langchain-xai
  • Other / not sure / general

Related Issues / PRs

https://github.com/langchain-ai/langchain/issues/35584

Reproduction Steps / Example Code (Python)

# instantiate model
llm= AzureChatOpenAI(azure_endpoint=env["AZURE_LAB_ENDPOINT"], api_key=env["AZURE_LAB_API_KEY"],
                    azure_deployment=env["AZURE_LAB_DEPLOYMENT_5.3"], temperature=temperature,
                    api_version=env["OPENAI_API_VERSION"],
                    timeout=7000)

# create agent
agent= create_agent(llm,
            tools=[...], #add some tools
            system_prompt=prompt,
            name="myagent",
            checkpointer=memory
        )

# invoke
msgs= [HumanMessage("blah blah")]
agent.invoke({"messages": msgs})

Error Message and Stack Trace (if applicable)

ERROR:workflow2:Error in terminal_invoke
Traceback (most recent call last):
  File "/app/workflow2.py", line 97, in terminal_invoke
    result = self.terminal.invoke({"messages": [
        HumanMessage(content="Project files: " + json.dumps(files)),
        HumanMessage(content=prompt)]})
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 3292, in invoke
    for chunk in self.stream(
                 ~~~~~~~~~~~^
        input,
        ^^^^^^
    ...<10 lines>...
        **kwargs,
        ^^^^^^^^^
    ):
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/main.py", line 2725, in stream
    for _ in runner.tick(
             ~~~~~~~~~~~^
        [t for t in loop.tasks.values() if not t.writes],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<2 lines>...
        schedule_task=loop.accept_push,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_runner.py", line 167, in tick
    run_with_retry(
    ~~~~~~~~~~~~~~^
        t,
        ^^
    ...<10 lines>...
        },
        ^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/pregel/_retry.py", line 96, in run_with_retry
    return task.proc.invoke(task.input, config)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 656, in invoke
    input = context.run(step.invoke, input, config, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/langgraph/_internal/_runnable.py", line 400, in invoke
    ret = self.func(*args, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1301, in model_node
    model_response = _execute_model_sync(request)
  File "/app/.venv/lib/python3.13/site-packages/langchain/agents/factory.py", line 1273, in _execute_model_sync
    output = model_.invoke(messages)
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/runnables/base.py", line 5695, in invoke
    return self.bound.invoke(
           ~~~~~~~~~~~~~~~~~^
        input,
        ^^^^^^
        self._merge_configs(config),
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        **{**self.kwargs, **kwargs},
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 402, in invoke
    self.generate_prompt(
    ~~~~~~~~~~~~~~~~~~~~^
        [self._convert_input(input)],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ...<6 lines>...
        **kwargs,
        ^^^^^^^^^
    ).generations[0][0],
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1149, in generate_prompt
    return self.generate(prompt_messages, stop=stop, callbacks=callbacks, **kwargs)
           ~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 958, in generate
    self._generate_with_cache(
    ~~~~~~~~~~~~~~~~~~~~~~~~~^
        m,
        ^^
    ...<2 lines>...
        **kwargs,
        ^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/langchain_core/language_models/chat_models.py", line 1261, in _generate_with_cache
    result = self._generate(
        messages, stop=stop, run_manager=run_manager, **kwargs
    )
  File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1490, in _generate
    _handle_openai_bad_request(e)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
  File "/app/.venv/lib/python3.13/site-packages/langchain_openai/chat_models/base.py", line 1487, in _generate
    raw_response = self.client.with_raw_response.create(**payload)
  File "/app/.venv/lib/python3.13/site-packages/openai/_legacy_response.py", line 367, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ~~~~^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/openai/_utils/_utils.py", line 286, in wrapper
    return func(*args, **kwargs)
  File "/app/.venv/lib/python3.13/site-packages/openai/resources/chat/completions/completions.py", line 1211, in create
    return self._post(
           ~~~~~~~~~~^
        "/chat/completions",
        ^^^^^^^^^^^^^^^^^^^^
    ...<47 lines>...
        stream_cls=Stream[ChatCompletionChunk],
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1297, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/app/.venv/lib/python3.13/site-packages/openai/_base_client.py", line 1070, in request
    raise self._make_status_error_from_response(err.response) from None
openai.BadRequestError: Error code: 400 - {'error': {'message': 'The requested operation is unsupported.'}}

Description

I'm trying to use gpt-5.3-codex in my langgraph workflow. When I run it I get error 400

System Info

System Information

OS: Windows OS Version: 10.0.26200 Python Version: 3.11.14 | packaged by conda-forge | (main, Oct 22 2025, 22:35:28) [MSC v.1944 64 bit (AMD64)]

Package Information

langchain_core: 1.2.20 langchain: 1.2.12 langchain_community: 0.4.1 langsmith: 0.6.1 langchain_anthropic: 1.4.0 langchain_classic: 1.0.1 langchain_openai: 1.1.11 langchain_text_splitters: 1.1.1 langchain_weaviate: 0.0.6 langgraph_sdk: 0.3.12

Optional packages not installed

deepagents deepagents-cli

Other Dependencies

aiohttp: 3.13.3 anthropic: 0.86.0 dataclasses-json: 0.6.7 httpx: 0.28.1 httpx-sse: 0.4.3 jsonpatch: 1.33 langgraph: 1.1.3 numpy: 2.4.2 openai: 2.29.0 opentelemetry-api: 1.39.1 opentelemetry-exporter-otlp-proto-http: 1.39.1 opentelemetry-sdk: 1.39.1 orjson: 3.11.5 packaging: 25.0 pydantic: 2.12.5 pydantic-settings: 2.12.0 pytest: 9.0.2 PyYAML: 6.0.3 pyyaml: 6.0.3 requests: 2.32.5 requests-toolbelt: 1.0.0 rich: 14.2.0 simsimd: 6.5.16 SQLAlchemy: 2.0.46 sqlalchemy: 2.0.46 tenacity: 9.1.2 tiktoken: 0.12.0 typing-extensions: 4.15.0 uuid-utils: 0.12.0 weaviate-client: 4.20.4 zstandard: 0.25.0

extent analysis

Fix Plan

The error message indicates that the requested operation is unsupported. This could be due to the model or endpoint being used.

To fix this issue, you can try the following steps:

  • Check the Azure endpoint and API key to ensure they are correct and valid.
  • Verify that the model being used (gpt-5.3-codex) is supported by the Azure endpoint.
  • Update the langchain_openai package to the latest version.

Here's an example of how you can modify your code to handle this error:

import logging

# instantiate model
llm = AzureChatOpenAI(azure_endpoint=env["AZURE_LAB_ENDPOINT"], api_key=env["AZURE_LAB_API_KEY"],
                      azure_deployment=env["AZURE_LAB_DEPLOYMENT_5.3"], temperature=temperature,
                      api_version=env["OPENAI_API_VERSION"],
                      timeout=7000)

# create agent
agent = create_agent(llm,
                    tools=[...],  # add some tools
                    system_prompt=prompt,
                    name="myagent",
                    checkpointer=memory
                    )

# invoke
msgs = [HumanMessage("blah blah")]
try:
    agent.invoke({"messages": msgs})
except openai.BadRequestError as e:
    logging.error(f"Error invoking agent: {e}")
    # Handle the error or retry the invocation

Verification

To verify that the fix worked, you can try running the code again and check for any error messages. If the error persists, you may need to try a different model or endpoint.

Extra Tips

  • Make sure to handle errors and exceptions properly in your code to avoid crashes and unexpected behavior.
  • Keep your packages up to date to ensure you have the latest features and bug fixes.
  • Check the documentation for the langchain_openai package and the Azure endpoint to ensure you are using them correctly.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

langchain - 💡(How to fix) Fix azure gpt-5.3-codex not working [4 comments, 3 participants]