Package com.ants.platform.client
Class AntsPlatformClient
java.lang.Object
com.ants.platform.client.AntsPlatformClient
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Supplier<AnnotationQueuesClient>protected final ClientOptionsprotected final Supplier<CommentsClient>protected final Supplier<DatasetItemsClient>protected final Supplier<DatasetRunItemsClient>protected final Supplier<DatasetsClient>protected final Supplier<HealthClient>protected final Supplier<IngestionClient>protected final Supplier<MediaClient>protected final Supplier<MetricsClient>protected final Supplier<ModelsClient>protected final Supplier<ObservationsClient>protected final Supplier<OrganizationsClient>protected final Supplier<ProjectsClient>protected final Supplier<PromptsClient>protected final Supplier<PromptVersionClient>protected final Supplier<ScimClient>protected final Supplier<ScoreClient>protected final Supplier<ScoreConfigsClient>protected final Supplier<ScoreV2Client>protected final Supplier<SessionsClient>protected final Supplier<TraceClient> -
Constructor Summary
ConstructorsConstructorDescriptionAntsPlatformClient(ClientOptions clientOptions) Legacy constructor for backward compatibility.AntsPlatformClient(ClientOptions clientOptions, String publicKey) SDK v3.4.0: Constructor with public key for agent identification. -
Method Summary
Modifier and TypeMethodDescriptionstatic AntsPlatformClientBuilderbuilder()comments()datasets()generateAgentId(String agentName) SDK v3.4.0: Generate a deterministic agent ID from an agent name.generateAgentId(String agentName, String projectId) SDK v3.4.0: Generate a deterministic agent ID from an agent name and project ID.SDK v3.4.0: Get the project ID fetched from the API.health()media()metrics()models()projects()prompts()scim()score()scoreV2()sessions()setProjectId(String projectId) SDK v3.4.0: Manually set the project ID.trace()booleanupdateAgentDisplayName(String agentId, String displayName) SDK v3.4.0: Updates the mutable display name for an agent.
-
Field Details
-
clientOptions
-
annotationQueuesClient
-
commentsClient
-
datasetItemsClient
-
datasetRunItemsClient
-
datasetsClient
-
healthClient
-
ingestionClient
-
mediaClient
-
metricsClient
-
modelsClient
-
observationsClient
-
organizationsClient
-
projectsClient
-
promptVersionClient
-
promptsClient
-
scimClient
-
scoreConfigsClient
-
scoreV2Client
-
scoreClient
-
sessionsClient
-
traceClient
-
-
Constructor Details
-
AntsPlatformClient
Legacy constructor for backward compatibility. -
AntsPlatformClient
SDK v3.4.0: Constructor with public key for agent identification.
-
-
Method Details
-
getProjectId
SDK v3.4.0: Get the project ID fetched from the API. This returns the actual project ID from the Ants Platform API, not the UUID from the public key. This ensures consistent agent_id generation across Python, JS, and Java SDKs.- Returns:
- the project ID, or null if not available
-
setProjectId
SDK v3.4.0: Manually set the project ID. Use this method when the API fetch fails or when you want to explicitly set the project ID. This is useful for: - Environments where the API is not accessible during initialization - Testing scenarios - When you know the project ID in advance- Parameters:
projectId- the project ID to use for agent_id generation- Returns:
- this client instance for method chaining
-
generateAgentId
SDK v3.4.0: Generate a deterministic agent ID from an agent name. Uses BLAKE2b-64 hash of (agentName + projectId) to produce a 16-char hex ID.This method handles all the complexity of agent ID generation internally:
- Extracts project_id from the public key provided during client construction
- Computes BLAKE2b-64 hash of agentName + projectId
- Returns a deterministic 16-character hex string
Example:
AntsPlatformClient client = AntsPlatformClient.builder() .credentials(publicKey, secretKey) .url("http://localhost:3000") .build(); String agentId = client.generateAgentId("qa_agent"); // Returns: "1fdb77db0603771f" (deterministic 16-char hex)- Parameters:
agentName- the agent name (immutable identifier)- Returns:
- the generated agent ID (16-char hex string)
- Throws:
IllegalStateException- if project ID is not availableIllegalArgumentException- if agentName is null or empty
-
generateAgentId
SDK v3.4.0: Generate a deterministic agent ID from an agent name and project ID. This overload allows you to explicitly provide the project ID, which is useful when: - The automatic project ID fetch failed - You want to use a specific project ID - You're testing with a known project ID- Parameters:
agentName- the agent name (immutable identifier)projectId- the project ID to use for agent_id generation- Returns:
- the generated agent ID (16-char hex string)
- Throws:
IllegalArgumentException- if agentName or projectId is null or empty
-
updateAgentDisplayName
SDK v3.4.0: Updates the mutable display name for an agent.The display name is a user-friendly label shown in the UI, while the agent ID (derived from agent_name + project_id) remains immutable. This allows renaming agents without breaking historical trace associations.
Example:
AntsPlatformClient client = AntsPlatformClient.builder() .credentials(publicKey, secretKey) .url("http://localhost:3000") .build(); // Update display name using the agent's immutable ID client.updateAgentDisplayName("5d15c8e8b4aee83a", "QA Agent v2.0");- Parameters:
agentId- the immutable agent identifier (16-character hex string from generateAgentId)displayName- the new UI-friendly display name for the agent- Returns:
- true if the update was successful, false otherwise
- Throws:
IllegalArgumentException- if agentId is invalid or displayName is empty/null
-
annotationQueues
-
comments
-
datasetItems
-
datasetRunItems
-
datasets
-
health
-
ingestion
-
media
-
metrics
-
models
-
observations
-
organizations
-
projects
-
promptVersion
-
prompts
-
scim
-
scoreConfigs
-
scoreV2
-
score
-
sessions
-
trace
-
builder
-