MR
Mayur Rathi
@mayurrathi
⭐ 40.7k GitHub stars

Azure Ai Agents Persistent Java

Azure Ai Agents Persistent Java is an data AI skill with a core value of |. It helps developers solve real-world problems in the data domain, boosting efficiency, automating repetitive tasks, and optimizing workflows.

|

Last verified on: 2026-07-08

Quick Facts

Category data
Works With Claude
Source sickn33/antigravity-awesome-skills
Stars ⭐ 40.7k
Last Verified 2026-07-08
Risk Level Low
mkdir -p ./skills/azure-ai-agents-persistent-java && curl -sfL https://raw.githubusercontent.com/sickn33/antigravity-awesome-skills/main/skills/azure-ai-agents-persistent-java/SKILL.md -o ./skills/azure-ai-agents-persistent-java/SKILL.md

Run in terminal / PowerShell. Requires curl (Unix) or PowerShell 5+ (Windows).

Skill Content

# Azure AI Agents Persistent SDK for Java


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


Installation


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

Environment Variables


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

Authentication


java
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


| Client | Purpose |

|--------|---------|

| `PersistentAgentsClient` | Sync client for agent operations |

| `PersistentAgentsAsyncClient` | Async client for agent operations |


Core Workflow


1. Create Agent


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

2. Create Thread


java
PersistentAgentThread thread = client.createThread();

3. Add Message


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

4. Run Agent


java
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


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

6. Cleanup


java
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


java
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


| Resource | URL |

|----------|-----|

| Maven Package | https://central.sonatype.com/artifact/com.azure/azure-ai-agents-persistent |

| GitHub Source | https://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.

🎯 Best For

  • Claude users
  • Data professionals
  • Analytics teams
  • Researchers

💡 Use Cases

  • Data pipeline auditing
  • Query optimization

📖 How to Use This Skill

  1. 1

    Install the Skill

    Copy the install command from the Terminal tab and run it. The SKILL.md file downloads to your local skills directory.

  2. 2

    Load into Your AI Assistant

    Open Claude and reference the skill. Paste the SKILL.md content or use the system prompt tab.

  3. 3

    Apply Azure Ai Agents Persistent Java to Your Work

    Provide context for your task — paste source material, describe your audience, or share existing work to guide the AI.

  4. 4

    Review and Refine

    Edit the AI output for accuracy, tone, and completeness. Add human insight where the AI lacks context.

❓ Frequently Asked Questions

How do I install Azure Ai Agents Persistent Java?

Copy the install command from the Terminal tab and run it. The skill downloads to ./skills/azure-ai-agents-persistent-java/SKILL.md, ready to use.

Can I customize this skill for my team?

Absolutely. Edit the SKILL.md file to add team-specific instructions, examples, or workflows.

⚠️ Common Mistakes to Avoid

Ignoring data quality

AI analysis inherits all data quality issues — profile your data first.

🔗 Related Skills