| name | azure-ai-projects-ts |
| description | High-level SDK for Azure AI Foundry projects with agents, connections, deployments, and evaluations. |
| risk | unknown |
| source | community |
| date_added | 2026-02-27 |
Azure AI Projects SDK for TypeScript
High-level SDK for Azure AI Foundry projects with agents, connections, deployments, and evaluations.
Installation
npm install @azure/ai-projects @azure/identity
For tracing:
npm install @azure/monitor-opentelemetry @opentelemetry/api
Environment Variables
AZURE_AI_PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project>
MODEL_DEPLOYMENT_NAME=gpt-4o
Authentication
import { AIProjectClient } from "@azure/ai-projects";
import { DefaultAzureCredential } from "@azure/identity";
const client = new AIProjectClient(
process.env.AZURE_AI_PROJECT_ENDPOINT!,
new DefaultAzureCredential()
);
Operation Groups
| Group | Purpose |
|---|
client.agents | Create and manage AI agents |
client.connections | List connected Azure resources |
client.deployments | List model deployments |
client.datasets | Upload and manage datasets |
client.indexes | Create and manage search indexes |
client.evaluators | Manage evaluation metrics |
client.memoryStores | Manage agent memory |
Getting OpenAI Client
const openAIClient = await client.getOpenAIClient();
const response = await openAIClient.responses.create({
model: "gpt-4o",
input: "What is the capital of France?"
});
const conversation = await openAIClient.conversations.create({
items: [{ type: "message", role: "user", content: "Hello!" }]
});
Agents
Create Agent
const agent = await client.agents.createVersion("my-agent", {
kind: "prompt",
model: "gpt-4o",
instructions: "You are a helpful assistant."
});
Agent with Tools
const agent = await client.agents.createVersion("code-agent", {
kind: "prompt",
model: "gpt-4o",
instructions: "You can execute code.",
tools: [{ type: "code_interpreter", container: { type: "auto" } }]
});
const agent = await client.agents.createVersion("search-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{ type: "file_search", vector_store_ids: [vectorStoreId] }]
});
const agent = await client.agents.createVersion("web-agent", {
kind: "prompt",
model: "gpt-4o",
tools: [{
type: "web_search_preview",
user_location: { type: "approximate", country: "US", city: "Seattle" }
}]
});
agent = client..(, {
: ,
: ,
: [{
: ,
: {
: [{
: connectionId,
: ,
:
}]
}
}]
});
agent = client..(, {
: ,
: ,
: [{
: ,
: {
: ,
: ,
: ,
: {
: ,
: { : { : } },
: []
}
}
}]
});
agent = client..(, {
: ,
: ,
: [{
: ,
: ,
: ,
:
}]
});
Run Agent
const openAIClient = await client.getOpenAIClient();
const conversation = await openAIClient.conversations.create({
items: [{ type: "message", role: "user", content: "Hello!" }]
});
const response = await openAIClient.responses.create(
{ conversation: conversation.id },
{ body: { agent: { name: agent.name, type: "agent_reference" } } }
);
await openAIClient.conversations.delete(conversation.id);
await client.agents.deleteVersion(agent.name, agent.version);
Connections
for await (const conn of client.connections.list()) {
console.log(conn.name, conn.type);
}
const conn = await client.connections.get("my-connection");
const connWithCreds = await client.connections.getWithCredentials("my-connection");
const defaultAzureOpenAI = await client.connections.getDefault("AzureOpenAI", true);
Deployments
for await (const deployment of client.deployments.list()) {
if (deployment.type === "ModelDeployment") {
console.log(deployment.name, deployment.modelName);
}
}
for await (const d of client.deployments.list({ modelPublisher: "OpenAI" })) {
console.log(d.name);
}
const deployment = await client.deployments.get("gpt-4o");
Datasets
const dataset = await client.datasets.uploadFile(
"my-dataset",
"1.0",
"./data/training.jsonl"
);
const dataset = await client.datasets.uploadFolder(
"my-dataset",
"2.0",
"./data/documents/"
);
const ds = await client.datasets.get("my-dataset", "1.0");
for await (const version of client.datasets.listVersions("my-dataset")) {
console.log(version);
}
await client.datasets.delete("my-dataset", "1.0");
Indexes
import { AzureAISearchIndex } from "@azure/ai-projects";
const indexConfig: AzureAISearchIndex = {
name: "my-index",
type: "AzureSearch",
version: "1",
indexName: "my-index",
connectionName: "search-connection"
};
const index = await client.indexes.createOrUpdate("my-index", "1", indexConfig);
for await (const idx of client.indexes.list()) {
console.log(idx.name);
}
await client.indexes.delete("my-index", "1");
Key Types
import {
AIProjectClient,
AIProjectClientOptionalParams,
Connection,
ModelDeployment,
DatasetVersionUnion,
AzureAISearchIndex
} from "@azure/ai-projects";
Best Practices
- Use getOpenAIClient() - For responses, conversations, files, and vector stores
- Version your agents - Use
createVersion for reproducible agent definitions
- Clean up resources - Delete agents, conversations when done
- Use connections - Get credentials from project connections, don't hardcode
- Filter deployments - Use
modelPublisher filter to find specific models
When to Use
This skill is applicable to execute the workflow or actions described in the overview.