stratus

Getting Started

Install Stratus and run your first agent

Installation

bun add @usestratus/sdk zod@4

Zod 4 is a peer dependency used for tool parameter schemas and structured output.

Prerequisites

You need an Azure OpenAI resource with a deployed model. You'll need:

  • Endpoint - Your Azure OpenAI endpoint URL
  • API Key or Entra ID credentials - See Authentication for both options
  • Deployment - The name of your deployed model (e.g. gpt-5.2)

Create a Model

The fastest way — set your env vars and call createModel():

.env
AZURE_OPENAI_ENDPOINT=https://your-resource.openai.azure.com
AZURE_OPENAI_API_KEY=your-api-key
AZURE_OPENAI_DEPLOYMENT=gpt-5.2
model.ts
import { createModel } from "@usestratus/sdk";

const model = createModel();
model.ts
import { AzureResponsesModel } from "@usestratus/sdk";

const model = new AzureResponsesModel({
  endpoint: process.env.AZURE_ENDPOINT!,
  apiKey: process.env.AZURE_API_KEY!,
  deployment: "gpt-5.2",
});
model.ts
import { AzureResponsesModel } from "@usestratus/sdk";
import { DefaultAzureCredential, getBearerTokenProvider } from "@azure/identity";

const tokenProvider = getBearerTokenProvider(
  new DefaultAzureCredential(),
  "https://cognitiveservices.azure.com/.default",
);

const model = new AzureResponsesModel({
  endpoint: process.env.AZURE_ENDPOINT!,
  azureAdTokenProvider: tokenProvider,
  deployment: "gpt-5.2",
});

Your First Agent

The simplest approach - send a message and get a result:

one-shot.ts
import { prompt } from "@usestratus/sdk/core";

const result = await prompt("What is 2 + 2?", { model });
console.log(result.output); // "4"

For multi-turn conversations, use createSession():

session.ts
import { createSession } from "@usestratus/sdk/core";

await using session = createSession({
  model,
  instructions: "You are a helpful assistant.",
});

session.send("Hello!");
for await (const event of session.stream()) {
  if (event.type === "content_delta") process.stdout.write(event.content);
}

// Or skip the stream and just get the result
session.send("What did I just say?");
const result = await session.wait();
console.log(result.output);

For lower-level control, create an Agent and use run() or stream() directly:

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

const agent = new Agent({
  name: "assistant",
  model,
  instructions: "You are a helpful assistant.",
});

const result = await run(agent, "What is the capital of France?");
console.log(result.output); // "The capital of France is Paris."

Next Steps

Edit on GitHub

Last updated on

On this page