SDKs
OpenAI Agents SDK
The OpenAI Agents SDK (JS , Python ) talks to the model through an OpenAI client, so the same trick works: override the default client to point at AI Gateway and run your agents unchanged.
agent.ts
import OpenAI from "openai";
import {
Agent,
run,
setDefaultOpenAIClient,
setOpenAIAPI,
} from "@openai/agents";
setDefaultOpenAIClient(
new OpenAI({
apiKey: process.env.CARONTE_API_KEY!,
baseURL: process.env.CARONTE_BASE_URL ?? "https://<your-caronte>/v1",
}),
);
// Use the Responses API (default) or "chat_completions".
setOpenAIAPI("responses");
const triage = new Agent({
name: "Triage",
instructions: "Classify the ticket and respond in one sentence.",
model: "gpt-4o-mini",
});
const result = await run(triage, "App keeps crashing on launch.");
console.log(result.finalOutput);Add hosted Code Interpreter to an agent
Agents that need the sandboxed runtime can declare code_execution as a hosted tool — the SDK forwards the marker into the Responses tools[] array verbatim, which is exactly what the proxy expects.
agent-with-code-exec.ts
import { Agent, hostedTool } from "@openai/agents";
const analyst = new Agent({
name: "Analyst",
instructions: "Use Python to compute statistics when asked.",
model: "gpt-4o-mini",
tools: [
hostedTool({
name: "code_execution",
providerData: { type: "caronte:code_execution" },
}),
],
});