<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>Question Re: Issue with AI160 JavaScript Exercise – /api/agent/tri... in Technology Q&amp;A</title>
    <link>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14332789#M4937396</link>
    <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12545"&gt;@gregorw&lt;/a&gt;&amp;nbsp; Curl works perfectly.. only&amp;nbsp;SAP AI Core deployment doesn't support&amp;nbsp;&lt;STRONG&gt;&lt;CODE&gt;/chat/completions&lt;/CODE&gt;&lt;/STRONG&gt;endpoint.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;curl -v -i -X POST \
  "https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com/v2/inference/deployments/d48a78b0811caa3b/chat/completions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "AI-Resource-Group: &amp;lt;123&amp;gt;" \
  -H "X-Tenant: e125da77-03b4-4f88-ad8c-d5055c2cfaea" \
  -d '{"messages":[{"role":"user","content":"Hello!"}],"max_tokens":200}'&lt;/LI-CODE&gt;&lt;P&gt;When running the agent code (exercises/javascript/app/agent.ts or po-agents.js), I encounter this TypeScript compilation error:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;Argument of type 'BaseMessage&amp;lt;MessageStructure&amp;lt;MessageToolSet&amp;gt;, MessageType&amp;gt;[]' is not assignable to parameter of type 'BaseLanguageModelInput'. Type 'BaseMessage&amp;lt;MessageStructure&amp;lt;MessageToolSet&amp;gt;, MessageType&amp;gt;[]' is not assignable to type 'BaseMessageLike[]'. [... full error in comment below]&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Error location:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;async function callModel({ messages }: typeof MessagesAnnotation.State) { const response = await modelWithTools.invoke(messages); // ❌ Error here return { messages: [response] }; }&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MKM_0-1771590157842.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/374752iABCFB9ADCF8306B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MKM_0-1771590157842.png" alt="MKM_0-1771590157842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Happy to provide more details or test fixes! Would love to see this resolved for productive SAP AI Core usage.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for the great work!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manoj&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 20 Feb 2026 12:25:12 GMT</pubDate>
    <dc:creator>MKM</dc:creator>
    <dc:date>2026-02-20T12:25:12Z</dc:date>
    <item>
      <title>Issue with AI160 JavaScript Exercise – /api/agent/trigger-agent returning HTML instead of JSON</title>
      <link>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaq-p/14330507</link>
      <description>&lt;P&gt;Hi SAP Community,&lt;/P&gt;&lt;P&gt;I’m currently working through the excellent &lt;STRONG&gt;TechEd 2025 AI160 – “&lt;A href="https://github.com/SAP-samples/teched2025-AI160/blob/main/exercises/javascript/README.md" target="_self"&gt;Build Your Own AI Agent-Based Solution with the Generative AI Hub&lt;/A&gt;”&lt;/STRONG&gt; hands-on, specifically the &lt;STRONG&gt;JavaScript exercise&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;My setup:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Productive SAP AI Core instance&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Provisioned in SAP BTP Cockpit (extended plan)&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Service keys fully configured&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Running the tutorial using &lt;CODE&gt;npm run tutorial&lt;/CODE&gt; in SAP Business Application Studio&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;The UI (port 3002), Agent (port 3001), and Mock Server (port 3000) all start successfully.&lt;/P&gt;&lt;P&gt;However, when triggering the agent from the UI, I get the following error in the browser:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;Error: Failed to execute 'json' on 'Response':
Unexpected token '&amp;lt;', "&amp;lt;!DOCTYPE "... is not valid JSON&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;In the Network tab, I see:&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;GET /api/agent/trigger-agent → 404 / HTML response&lt;/LI-CODE&gt;&lt;P&gt;I verified:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;&lt;P&gt;Vite proxy is configured to forward &lt;CODE&gt;/api&lt;/CODE&gt; → &lt;CODE&gt;&lt;A href="http://localhost:3001" target="_blank" rel="noopener"&gt;http://localhost:3001&lt;/A&gt;&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Agent server is running on port 3001&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;Endpoint &lt;CODE&gt;/api/agent/trigger-agent&lt;/CODE&gt; exists in &lt;CODE&gt;server.ts&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;&lt;LI&gt;&lt;P&gt;&lt;CODE&gt;x-thread-id&lt;/CODE&gt; header is being sent from the UI&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Despite this, the response is sometimes HTML (404 / error page) instead of JSON, causing the parsing error.&lt;/P&gt;&lt;P&gt;Has anyone faced a similar issue with AI160 JavaScript exercises?&lt;BR /&gt;Is there anything specific to check regarding routing, proxying, or error handling when using productive AI Core instances?&lt;/P&gt;&lt;P&gt;Any guidance would be greatly appreciated.&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/150975"&gt;@ZhongpinWang&lt;/a&gt;,&amp;nbsp;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/126699"&gt;@deekshasinha&lt;/a&gt;&lt;/P&gt;&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2026 10:06:39 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaq-p/14330507</guid>
      <dc:creator>MKM</dc:creator>
      <dc:date>2026-02-23T10:06:39Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AI160 JavaScript Exercise – /api/agent/trigger-agent returning HTML instead of JSON</title>
      <link>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14331874#M4937327</link>
      <description>Have you tried the request to the Generative AI Hub endpoint with CURL or REST Client? Does it behave the same way?</description>
      <pubDate>Thu, 19 Feb 2026 13:32:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14331874#M4937327</guid>
      <dc:creator>gregorw</dc:creator>
      <dc:date>2026-02-19T13:32:35Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AI160 JavaScript Exercise – /api/agent/tri...</title>
      <link>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14332789#M4937396</link>
      <description>&lt;P&gt;&lt;a href="https://community.sap.com/t5/user/viewprofilepage/user-id/12545"&gt;@gregorw&lt;/a&gt;&amp;nbsp; Curl works perfectly.. only&amp;nbsp;SAP AI Core deployment doesn't support&amp;nbsp;&lt;STRONG&gt;&lt;CODE&gt;/chat/completions&lt;/CODE&gt;&lt;/STRONG&gt;endpoint.&lt;/P&gt;&lt;LI-CODE lang="abap"&gt;curl -v -i -X POST \
  "https://api.ai.prod.eu-central-1.aws.ml.hana.ondemand.com/v2/inference/deployments/d48a78b0811caa3b/chat/completions" \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -H "AI-Resource-Group: &amp;lt;123&amp;gt;" \
  -H "X-Tenant: e125da77-03b4-4f88-ad8c-d5055c2cfaea" \
  -d '{"messages":[{"role":"user","content":"Hello!"}],"max_tokens":200}'&lt;/LI-CODE&gt;&lt;P&gt;When running the agent code (exercises/javascript/app/agent.ts or po-agents.js), I encounter this TypeScript compilation error:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;Argument of type 'BaseMessage&amp;lt;MessageStructure&amp;lt;MessageToolSet&amp;gt;, MessageType&amp;gt;[]' is not assignable to parameter of type 'BaseLanguageModelInput'. Type 'BaseMessage&amp;lt;MessageStructure&amp;lt;MessageToolSet&amp;gt;, MessageType&amp;gt;[]' is not assignable to type 'BaseMessageLike[]'. [... full error in comment below]&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;Error location:&lt;/P&gt;&lt;P&gt;&lt;CODE&gt;async function callModel({ messages }: typeof MessagesAnnotation.State) { const response = await modelWithTools.invoke(messages); // ❌ Error here return { messages: [response] }; }&lt;/CODE&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="MKM_0-1771590157842.png" style="width: 400px;"&gt;&lt;img src="https://community.sap.com/t5/image/serverpage/image-id/374752iABCFB9ADCF8306B7/image-size/medium?v=v2&amp;amp;px=400" role="button" title="MKM_0-1771590157842.png" alt="MKM_0-1771590157842.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Happy to provide more details or test fixes! Would love to see this resolved for productive SAP AI Core usage.&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Thanks for the great work!&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Manoj&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2026 12:25:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14332789#M4937396</guid>
      <dc:creator>MKM</dc:creator>
      <dc:date>2026-02-20T12:25:12Z</dc:date>
    </item>
    <item>
      <title>Re: Issue with AI160 JavaScript Exercise – /api/agent/tri...</title>
      <link>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14338317#M4937813</link>
      <description>&lt;P&gt;This question was resolved in &lt;A href="https://github.com/SAP-samples/teched2025-AI160/issues/26" target="_blank" rel="noopener"&gt;GitHub issue #26. &lt;/A&gt;&lt;/P&gt;&lt;P&gt;The problem was a port conflict with SAP Business Application Studio (3000/3001). The application already occupies those ports, so the UI proxy hits an HTML error page instead of the agent route.&lt;/P&gt;&lt;P&gt;The latest version of the demo on GitHub improves the error messaging to make port conflicts more obvious.&lt;/P&gt;&lt;P&gt;To resolve the conflict, update the ports used by the mock server and agent server.&lt;/P&gt;&lt;OL class=""&gt;&lt;LI&gt;Update the &lt;CODE&gt;exercises/javascript/app/mock-server/src/server.ts&lt;/CODE&gt; file to set the mock server port to 3005 (or another free port).&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;// exercises/javascript/app/mock-server/src/server.ts&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;-const port = process.env.PORT || 3001;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;+const port = process.env.PORT || 3005;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;OL class=""&gt;&lt;LI&gt;Update the &lt;CODE&gt;exercises/javascript/app/agent/src/setup.ts&lt;/CODE&gt; file to point the base URL to port 3005.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;&lt;SPAN class=""&gt;// exercises/javascript/app/agent/src/setup.ts&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;export&lt;/SPAN&gt; &lt;SPAN class=""&gt;const&lt;/SPAN&gt; BASE_URL_API_PURCHASEORDER_PROCESS_SRV &lt;SPAN class=""&gt;=&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;`http://localhost:3005/sap/opu/odata/sap/API_PURCHASEORDER_PROCESS_SRV/`&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;OL class=""&gt;&lt;LI&gt;Update the &lt;CODE&gt;exercises/javascript/app/agent/src/server.ts&lt;/CODE&gt; file to set the agent server port to 3006 (or another free port).&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;// exercises/javascript/app/agent/src/server.ts&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;-const port = process.env.PORT || 3001;&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;+const port = process.env.PORT || 3006;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;OL class=""&gt;&lt;LI&gt;Update the &lt;CODE&gt;exercises/javascript/app/ui/vite.config.ts&lt;/CODE&gt; file to point the UI proxy to port 3006.&lt;/LI&gt;&lt;/OL&gt;&lt;DIV class=""&gt;&lt;PRE&gt;&lt;CODE&gt;&lt;SPAN&gt;// exercises/javascript/app/ui/vite.config.ts&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;- target: 'http://localhost:3001',&lt;/SPAN&gt;&lt;/SPAN&gt;
&lt;SPAN&gt;&lt;SPAN class=""&gt;+ target: 'http://localhost:3006',&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;/DIV&gt;&lt;P&gt;After these changes, the preview endpoint should route correctly, and the agent call should stop returning “HTML/404”.&lt;/P&gt;</description>
      <pubDate>Fri, 27 Feb 2026 14:40:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/technology-q-a/issue-with-ai160-javascript-exercise-api-agent-trigger-agent-returning-html/qaa-p/14338317#M4937813</guid>
      <dc:creator>david_knaack</dc:creator>
      <dc:date>2026-02-27T14:40:38Z</dc:date>
    </item>
  </channel>
</rss>

