Azure AI Agents Persistent SDK for Java. Low-level SDK for creating and managing AI agents with threads, messages, runs, and tools.
77%
Does it follow best practices?
Run evals on this skill
Adds up to 20 points to the overall score
Passed
No findings from the security scan
Fix and improve this skill with Tessl
tessl review fix ./skills/antigravity-azure-ai-agents-persistent-java/SKILL.mdThe canonical home for this skill is azure-ai-agents-persistent-java in sickn33/agentic-awesome-skills
Low-level SDK for creating and managing persistent AI agents with threads, messages, runs, and tools.
<dependency>
<groupId>com.azure</groupId>
<artifactId>azure-ai-agents-persistent</artifactId>
<version>1.0.0-beta.2</version>
</dependency>export PROJECT_ENDPOINT="https://<resource>.services.ai.azure.com/api/projects/<project>"
export MODEL_DEPLOYMENT_NAME="gpt-4o-mini"import com.azure.ai.agents.persistent.PersistentAgentsClient;
import com.azure.ai.agents.persistent.PersistentAgentsClientBuilder;
import com.azure.ai.agents.persistent.*;
import com.azure.ai.agents.persistent.models.*;
import com.azure.core.http.rest.PagedIterable;
import com.azure.identity.DefaultAzureCredentialBuilder;
String endpoint = System.getenv("PROJECT_ENDPOINT");
PersistentAgentsClient client = new PersistentAgentsClientBuilder()
.endpoint(endpoint)
.credential(new DefaultAzureCredentialBuilder().build())
.buildClient();
String modelDeploymentName = System.getenv("MODEL_DEPLOYMENT_NAME");
PersistentAgentsAdministrationClient administration = client.getPersistentAgentsAdministrationClient();
ThreadsClient threads = client.getThreadsClient();
MessagesClient messageClient = client.getMessagesClient();
RunsClient runs = client.getRunsClient();The Azure AI Agents Persistent SDK provides a low-level API for managing persistent agents that can be reused across sessions.
| Client | Purpose |
|---|---|
PersistentAgentsClient | Sync client for agent operations |
PersistentAgentsAsyncClient | Async client for agent operations |
// Create agent with tools
PersistentAgent agent = administration.createAgent(
new CreateAgentOptions(modelDeploymentName)
.setName("Math Tutor")
.setInstructions("You are a personal math tutor.")
);PersistentAgentThread thread = threads.createThread();messageClient.createMessage(
thread.getId(),
MessageRole.USER,
"I need help with equations."
);ThreadRun run = runs.createRun(new CreateRunOptions(thread.getId(), agent.getId()));
// Bound polling; a terminal non-success state is not a completed answer.
long deadline = System.nanoTime() + java.util.concurrent.TimeUnit.SECONDS.toNanos(60);
while (run.getStatus() == RunStatus.QUEUED || run.getStatus() == RunStatus.IN_PROGRESS) {
if (System.nanoTime() > deadline) {
throw new IllegalStateException("Run polling timed out; inspect/cancel the owned run separately");
}
Thread.sleep(500);
run = runs.getRun(thread.getId(), run.getId());
}Check the resulting status before reading a final response: requires_action needs an authorized tool-output handler; failed, cancelled, expired or other non-success states must be reported explicitly. A polling timeout does not cancel the cloud run.
PagedIterable<ThreadMessage> messages = messageClient.listMessages(thread.getId());
for (ThreadMessage message : messages) {
System.out.println("Message role: " + message.getRole()); // Do not log retained prompt/response payloads.
}threads.deleteThread(thread.getId());
administration.deleteAgent(agent.getId());import com.azure.core.exception.HttpResponseException;
try {
PersistentAgent exampleAgent = administration.createAgent(
new CreateAgentOptions(modelDeploymentName).setName("Example").setInstructions("Answer briefly"));
} catch (HttpResponseException e) {
System.err.println("Error: " + e.getResponse().getStatusCode() + " - " + e.getMessage());
}Use when implementing or maintaining Java persistent-agent threads, messages, runs and administration with the preview SDK. The reviewed example uses beta.2 subclients, not direct CRUD methods on PersistentAgentsClient.
boisenoise/skills-collections
7bf2279
Canonical home
since Feb 20, 2026
Also appears in
last in sync Apr 19, 2026
last in sync Apr 19, 2026
last in sync Apr 19, 2026
last in sync Mar 6, 2026
last in sync Mar 6, 2026
last in sync Mar 6, 2026
If you maintain this skill, you can claim it as your own. Once claimed, you can manage eval scenarios, bundle related skills, attach documentation or rules, and ensure cross-agent compatibility.