stratus

Built-in Tools

Server-side tools for web search, code execution, MCP, and image generation

Built-in tools run server-side on Azure's infrastructure. Unlike function tools that execute your TypeScript code, built-in tools are handled entirely by the API. No local execution, no tool loop overhead.

Built-in tools require AzureResponsesModel. They are not supported by AzureChatCompletionsModel.

Give your agent access to live web search results.

web-search.ts
import { AzureResponsesModel } from "@usestratus/sdk/azure";
import { Agent, run, webSearchTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "researcher",
  model,
  tools: [webSearchTool()],
});

const result = await run(agent, "What happened in the news today?");

Configuration

web-search-config.ts
webSearchTool({
  searchContextSize: "high", // "low" | "medium" | "high"
  userLocation: {
    type: "approximate",
    city: "Seattle",
    state: "WA",
    country: "US",
  },
});
OptionTypeDescription
searchContextSize"low" | "medium" | "high"How much search context to include. Higher values use more tokens but provide richer results.
userLocationobjectApproximate user location for location-aware results. All fields optional except type.

Code Interpreter

Let the model write and execute Python code in a sandboxed container.

code-interpreter.ts
import { Agent, run, codeInterpreterTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "analyst",
  model,
  tools: [codeInterpreterTool()],
});

const result = await run(agent, "Calculate the first 20 Fibonacci numbers");

Configuration

code-interpreter-config.ts
codeInterpreterTool({
  container: {
    type: "auto",
    file_ids: ["file-abc123", "file-def456"], // optional: pre-upload files to container
  },
});
OptionTypeDescription
container.typestringContainer type. Defaults to "auto".
container.file_idsstring[]File IDs to upload to the container. Files are available for the model to read/process.

MCP (Model Context Protocol)

Connect to remote MCP servers for dynamic tool discovery.

mcp.ts
import { Agent, run, mcpTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "connected-agent",
  model,
  tools: [
    mcpTool({
      serverLabel: "my-tools",
      serverUrl: "https://my-mcp-server.example.com/sse",
    }),
  ],
});

const result = await run(agent, "Use the available tools to help me");

Configuration

mcp-config.ts
mcpTool({
  serverLabel: "my-tools",               // required
  serverUrl: "https://example.com/sse",   // required
  requireApproval: "never",               // or "always" or { always: [...], never: [...] }
  headers: {                              // optional auth headers
    Authorization: "Bearer my-token",
  },
});
OptionTypeDescription
serverLabelstringRequired. Label for the MCP server
serverUrlstringRequired. URL of the MCP server
requireApproval"always" | "never" | objectTool approval policy. Object form: { always: string[], never: string[] }
headersRecord<string, string>Headers sent with requests to the MCP server

MCP Approval Flow

By default, the API requires explicit approval before sharing data with a remote MCP server. When requireApproval is not set to "never", the model returns an mcp_approval_request in outputItems instead of calling the tool. You inspect the request and approve or deny it by passing an mcp_approval_response back via rawInputItems.

See MCP approval flow for the full example.

Image Generation

Let the model generate images inline.

image-gen.ts
import { Agent, run, imageGenerationTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "creative",
  model,
  tools: [imageGenerationTool()],
});

const result = await run(agent, "Create an image of a sunset over mountains");

No configuration options. The API handles image generation server-side.

Search over uploaded files in vector stores.

file-search.ts
import { Agent, run, fileSearchTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "research-assistant",
  model,
  tools: [
    fileSearchTool({
      vectorStoreIds: ["vs_abc123"],
    }),
  ],
});

const result = await run(agent, "Find information about quarterly revenue");

Configuration

file-search-config.ts
fileSearchTool({
  vectorStoreIds: ["vs_abc123", "vs_def456"], // required
  maxNumResults: 10,                           // optional
});
OptionTypeDescription
vectorStoreIdsstring[]Required. IDs of the vector stores to search.
maxNumResultsnumberMaximum number of results to return.

Computer Use

Let the model control a virtual computer display (mouse, keyboard, screenshots).

computer-use.ts
import { Agent, run, computerUseTool } from "@usestratus/sdk/core";

const agent = new Agent({
  name: "browser-agent",
  model,
  tools: [
    computerUseTool({
      displayWidth: 1024,
      displayHeight: 768,
    }),
  ],
});

const result = await run(agent, "Take a screenshot of the homepage");

Configuration

computer-use-config.ts
computerUseTool({
  displayWidth: 1024,      // required
  displayHeight: 768,      // required
  environment: "linux",    // optional: "windows" | "mac" | "linux" (default: "linux")
});
OptionTypeDescription
displayWidthnumberRequired. Width of the virtual display in pixels.
displayHeightnumberRequired. Height of the virtual display in pixels.
environmentstringOS environment. Defaults to "linux".

Mixing Tool Types

Built-in tools and function tools work together. The agent sees all tools and picks the right ones.

mixed-tools.ts
import { Agent, run, tool, webSearchTool, codeInterpreterTool } from "@usestratus/sdk/core";
import { z } from "zod";

const saveResult = tool({
  name: "save_result",
  description: "Save a result to the database",
  parameters: z.object({ key: z.string(), value: z.string() }),
  execute: async (ctx, { key, value }) => {
    await ctx.db.set(key, value);
    return "Saved";
  },
});

const agent = new Agent({
  name: "research-assistant",
  model,
  tools: [
    webSearchTool(),           // server-side
    codeInterpreterTool(),     // server-side
    saveResult,                // local function
  ],
});

Function tools execute locally with hooks, tracing, and abort signal support. Built-in tools execute server-side and bypass the local tool loop entirely.

How It Works

Built-in tools use the HostedTool type internally. Each factory function returns a HostedTool with a definition object that's passed directly to the Azure Responses API.

type AgentTool = FunctionTool | HostedTool;

interface HostedTool {
  type: "hosted";
  name: string;
  definition: Record<string, unknown>;
}

You can use the type guards isHostedTool() and isFunctionTool() if you need to distinguish between tool types at runtime.

Built-in tools don't fire beforeToolCall or afterToolCall hooks since the SDK has no control over server-side execution. They also don't appear in tracing spans. Function tools continue to support all hook and tracing features.

Next steps

  • Tools — define local function tools
  • Code Mode — let LLMs write code that orchestrates tools
  • Azure OpenAI — model configuration
  • Hooks — intercept function tool calls
Edit on GitHub

Last updated on

On this page