New to Claude Skills? Learn how to install them →

sickn33 on GitHub

Azure AI Agents SDK for Java

Free

Manage persistent AI agents with ease using Java.

Get this skill

Free · Opens the source repo

What Azure AI Agents SDK for Java does

The Azure AI Agents Persistent SDK for Java provides a low-level API designed for developers looking to create and manage AI agents that maintain state across sessions. This SDK is particularly useful for applications requiring persistent interactions, such as tutoring systems, customer support bots, or any scenario where continuity of conversation is critical. With support for threading, messaging, and running agent tasks, it allows for a structured approach to building sophisticated AI-driven applications.

The SDK includes both synchronous and asynchronous clients, giving developers flexibility in how they implement agent interactions. The PersistentAgentsClient is designed for straightforward, blocking operations, while the PersistentAgentsAsyncClient caters to high-throughput scenarios where non-blocking calls are preferred. This dual-client architecture ensures that developers can choose the right approach based on their application's concurrency needs.

Installation is straightforward, requiring a simple Maven dependency. Once set up, users can authenticate using Azure's DefaultAzureCredential, making it easy to integrate into existing Azure-based applications. The SDK also emphasizes best practices, such as proper resource cleanup and error handling, ensuring that developers can build robust applications that manage resources effectively.

Overall, this SDK is targeted at Java developers who need to implement AI agents with persistent capabilities, offering a solid foundation for building interactive and engaging user experiences.

When to use it

Use this SDK when developing applications that require AI agents to maintain context and state over multiple interactions.

When not to use it

Avoid this SDK for simple, stateless interactions or when the application does not require persistent agent capabilities.

What you can build with it

Building a Math Tutoring Agent

Create an AI agent that acts as a personal math tutor, utilizing the SDK to maintain context across multiple tutoring sessions.

Customer Support Bot

Develop a customer support bot that can handle ongoing conversations, remembering user queries and responses over time.

Interactive Learning Application

Implement an interactive learning application where users can engage with an AI that retains information from previous interactions.

How to install Azure AI Agents SDK for Java

View source

1. Install with the skills CLI

npx skills add sickn33/agentic-awesome-skills/azure-ai-agents-persistent-java --agent claude-code

2. Or install it manually

Download the skill folder and drop it into ~/.claude/skills/ for all projects, or .claude/skills/ to scope it to one repo. Restart Claude Code so it picks up the new skill.

Anthropic's agentic coding CLI, and the reference implementation of Agent Skills. Drop a skill folder into ~/.claude/skills and Claude Code loads it automatically whenever a task matches the skill's description. Claude Code docs

Inside SKILL.md

Written by sickn33

Azure AI Agents Persistent SDK for Java

Low-level SDK for creating and managing persistent AI agents with threads, messages, runs, and tools.

Installation

<dependency>
    <groupId>com.azure</groupId>
    <artifactId>azure-ai-agents-persistent</artifactId>
    <version>1.0.0-beta.1</version>
</dependency>

Environment Variables

PROJECT_ENDPOINT=https://<resource>.services.ai.azure.com/api/projects/<project>
MODEL_DEPLOYMENT_NAME=gpt-4o-mini

Authentication

import com.azure.ai.agents.persistent.PersistentAgentsClient;
import com.azure.ai.agents.persistent.PersistentAgentsClientBuilder;
import com.azure.identity.DefaultAzureCredentialBuilder;

String endpoint = System.getenv("PROJECT_ENDPOINT");
PersistentAgentsClient client = new PersistentAgentsClientBuilder()
    .endpoint(endpoint)
    .credential(new DefaultAzureCredentialBuilder().build())
    .buildClient();

Key Concepts

The Azure AI Agents Persistent SDK provides a low-level API for managing persistent agents that can be reused across sessions.

Client Hierarchy

ClientPurpose
PersistentAgentsClientSync client for agent operations
PersistentAgentsAsyncClientAsync client for agent operations

Core Workflow

1. Create Agent

// Create agent with tools
PersistentAgent agent = client.createAgent(
    modelDeploymentName,
    "Math Tutor",
    "You are a personal math tutor."
);

2. Create Thread

PersistentAgentThread thread = client.createThread();

3. Add Message

client.createMessage(
    thread.getId(),
    MessageRole.USER,
    "I need help with equations."
);

4. Run Agent

ThreadRun run = client.createRun(thread.getId(), agent.getId());

// Poll for completion
while (run.getStatus() == RunStatus.QUEUED || run.getStatus() == RunStatus.IN_PROGRESS) {
    Thread.sleep(500);
    run = client.getRun(thread.getId(), run.getId());
}

5. Get Response

PagedIterable<PersistentThreadMessage> messages = client.listMessages(thread.getId());
for (PersistentThreadMessage message : messages) {
    System.out.println(message.getRole() + ": " + message.getContent());
}

6. Cleanup

client.deleteThread(thread.getId());
client.deleteAgent(agent.getId());

Best Practices

  1. Use DefaultAzureCredential for production authentication
  2. Poll with appropriate delays — 500ms recommended between status checks
  3. Clean up resources — Delete threads and agents when done
  4. Handle all run statuses — Check for RequiresAction, Failed, Cancelled
  5. Use async client for better throughput in high-concurrency scenarios

Error Handling

import com.azure.core.exception.HttpResponseException;

try {
    PersistentAgent agent = client.createAgent(modelName, name, instructions);
} catch (HttpResponseException e) {
    System.err.println("Error: " + e.getResponse().getStatusCode() + " - " + e.getMessage());
}

Reference Links

ResourceURL
Maven Packagehttps://central.sonatype.com/artifact/com.azure/azure-ai-agents-persistent
GitHub Sourcehttps://github.com/Azure/azure-sdk-for-java/tree/main/sdk/ai/azure-ai-agents-persistent

When to Use

This skill is applicable to execute the workflow or actions described in the overview.

Limitations

  • Use this skill only when the task clearly matches the scope described above.
  • Do not treat the output as a substitute for environment-specific validation, testing, or expert review.
  • Stop and ask for clarification if required inputs, permissions, safety boundaries, or success criteria are missing.

Frequently asked questions about Azure AI Agents SDK for Java

Similar skills