feat: Add model utils, move to websockets and responses api, add gpt-5.3-codex (#998)

* feat: Add model utils, move to websockets and responses api, add gpt-5.3-codex

* cr
This commit is contained in:
Brace Sproul 2026-03-02 12:13:24 -08:00 • committed by GitHub
parent 484465c399
commit 336a163924
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 15 additions and 2 deletions

View file

@ -23,7 +23,6 @@ warnings.filterwarnings("ignore", message=".*Pydantic V1.*", category=UserWarnin
# Now safe to import agent (which imports LangChain modules)
from deepagents import create_deep_agent
from deepagents.backends.protocol import SandboxBackendProtocol
from langchain_openai import ChatOpenAI
from langsmith.sandbox import SandboxClientError
from .encryption import decrypt_token
@ -36,6 +35,7 @@ from .middleware import (
)
from .prompt import construct_system_prompt
from .tools import commit_and_open_pr, fetch_url, http_request
from .utils.model import make_model
client = get_client()
@ -361,7 +361,7 @@ async def get_agent(config: RunnableConfig) -> Pregel: # noqa: PLR0915
logger.info("Returning agent with sandbox for thread %s", thread_id)
return create_deep_agent(
model=ChatOpenAI(model="gpt-5.2-codex", temperature=0, max_tokens=20_000),
model=make_model("openai:gpt-5.3-codex", temperature=0, max_tokens=20_000),
system_prompt=construct_system_prompt(
repo_dir,
linear_project_id=linear_project_id,

View file

@ -0,0 +1,13 @@
from langchain.chat_models import init_chat_model
OPENAI_RESPONSES_WS_BASE_URL = "wss://api.openai.com/v1"
def make_model(model_id: str, **kwargs: dict):
model_kwargs = kwargs.copy()
if model_id.startswith("openai:"):
model_kwargs["base_url"] = OPENAI_RESPONSES_WS_BASE_URL
model_kwargs["use_responses_api"] = True
return init_chat_model(model=model_id, **model_kwargs)