From 301a0b687aed944d3e201fcaf59947704501126c Mon Sep 17 00:00:00 2001 From: Carlos Escalante Date: Tue, 14 Jul 2026 21:48:54 -0600 Subject: [PATCH] Use Responses API with Luna by default --- .env.example | 2 +- .github/workflows/deploy.yml | 2 +- backend/app/agent/agent.py | 6 ++++-- backend/app/config.py | 2 +- backend/tests/test_agent_config.py | 14 ++++++++++++++ docker-compose.prod.yml | 2 +- docker-compose.yml | 2 +- 7 files changed, 23 insertions(+), 7 deletions(-) create mode 100644 backend/tests/test_agent_config.py diff --git a/.env.example b/.env.example index d520e6f..5e12477 100644 --- a/.env.example +++ b/.env.example @@ -23,4 +23,4 @@ VAPID_PUBLIC_KEY= # ── AI agent (optional in dev; Asistente won't work without it) ────────────── OPENAI_API_KEY= -AGENT_MODEL=gpt-5.4-mini +AGENT_MODEL=gpt-5.6-luna diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ab8377e..e00d450 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -51,7 +51,7 @@ jobs: VAPID_PRIVATE_KEY=${{ secrets.VAPID_PRIVATE_KEY }} VAPID_PUBLIC_KEY=${{ secrets.VAPID_PUBLIC_KEY }} OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} - AGENT_MODEL=gpt-5.4-mini + AGENT_MODEL=gpt-5.6-luna ENVEOF sed -i 's/^[[:space:]]*//' .env.prod diff --git a/backend/app/agent/agent.py b/backend/app/agent/agent.py index 7f9ed50..d0e27c6 100644 --- a/backend/app/agent/agent.py +++ b/backend/app/agent/agent.py @@ -3,7 +3,7 @@ from __future__ import annotations from agent_framework import Agent -from agent_framework.openai import OpenAIChatCompletionClient +from agent_framework.openai import OpenAIChatClient from app.config import settings from app.agent.tools import TOOLS @@ -83,7 +83,9 @@ Generative UI — render tools: def build_agent() -> Agent: - client = OpenAIChatCompletionClient( + # Use the Responses API for every configured model. It preserves one tool + # transport across model changes and supports Luna's tool-result turns. + client = OpenAIChatClient( api_key=settings.OPENAI_API_KEY, model=settings.AGENT_MODEL, ) diff --git a/backend/app/config.py b/backend/app/config.py index 3b168f9..216bad0 100644 --- a/backend/app/config.py +++ b/backend/app/config.py @@ -20,7 +20,7 @@ class Settings(BaseSettings): VAPID_PUBLIC_KEY: str = "" VAPID_CLAIM_EMAIL: str = "mailto:admin@wealth.cescalante.dev" OPENAI_API_KEY: str = "" - AGENT_MODEL: str = "gpt-5.4-mini" + AGENT_MODEL: str = "gpt-5.6-luna" @property def cors_origins_list(self) -> list[str]: diff --git a/backend/tests/test_agent_config.py b/backend/tests/test_agent_config.py new file mode 100644 index 0000000..05ebecb --- /dev/null +++ b/backend/tests/test_agent_config.py @@ -0,0 +1,14 @@ +"""Assistant transport configuration.""" + +from agent_framework.openai import OpenAIChatClient + +from app.agent import agent as agent_module + + +def test_agent_uses_responses_client_for_the_configured_model(monkeypatch): + monkeypatch.setattr(agent_module.settings, "AGENT_MODEL", "gpt-5.6-luna") + + agent = agent_module.build_agent() + + assert isinstance(agent.client, OpenAIChatClient) + assert agent.client.model == "gpt-5.6-luna" diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 38b14ce..c005bc8 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -31,7 +31,7 @@ services: VAPID_PRIVATE_KEY: ${VAPID_PRIVATE_KEY} VAPID_PUBLIC_KEY: ${VAPID_PUBLIC_KEY} OPENAI_API_KEY: ${OPENAI_API_KEY} - AGENT_MODEL: ${AGENT_MODEL:-gpt-5.4-mini} + AGENT_MODEL: ${AGENT_MODEL:-gpt-5.6-luna} # MAF 1.6+ enables OTel instrumentation by default; keep it off explicitly. ENABLE_INSTRUMENTATION: "false" expose: diff --git a/docker-compose.yml b/docker-compose.yml index baf308c..be369a4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -30,7 +30,7 @@ services: VAPID_PRIVATE_KEY: ${VAPID_PRIVATE_KEY:-} VAPID_PUBLIC_KEY: ${VAPID_PUBLIC_KEY:-} OPENAI_API_KEY: ${OPENAI_API_KEY:-} - AGENT_MODEL: ${AGENT_MODEL:-gpt-5.4-mini} + AGENT_MODEL: ${AGENT_MODEL:-gpt-5.6-luna} # MAF 1.6+ enables OTel instrumentation by default; keep it off explicitly. ENABLE_INSTRUMENTATION: "false" ports: