Search agents available to the authenticated user by agent name.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.PlatformAgentsSearchRequest;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsSearchResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws PlatformProblemDetailException, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PlatformAgentsSearchRequest req = PlatformAgentsSearchRequest.builder()
.name("HR Policy Agent")
.build();
PlatformAgentsSearchResponse res = sdk.agents().search()
.request(req)
.call();
if (res.platformAgentsSearchResponse().isPresent()) {
System.out.println(res.platformAgentsSearchResponse().get());
}
}
}
PlatformAgentsSearchResponse
| Error Type |
Status Code |
Content Type |
| models/errors/PlatformProblemDetailException |
400, 401, 403, 404, 408, 413, 429 |
application/problem+json |
| models/errors/PlatformProblemDetailException |
500, 503 |
application/problem+json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Retrieve details for an agent available to the authenticated user.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsGetResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws PlatformProblemDetailException, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PlatformAgentsGetResponse res = sdk.agents().get()
.agentId("<id>")
.call();
if (res.platformAgentGetResponse().isPresent()) {
System.out.println(res.platformAgentGetResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
agentId |
String |
✔️ |
ID of the agent to retrieve. |
PlatformAgentsGetResponse
| Error Type |
Status Code |
Content Type |
| models/errors/PlatformProblemDetailException |
400, 401, 403, 404, 408, 429 |
application/problem+json |
| models/errors/PlatformProblemDetailException |
500, 503 |
application/problem+json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Retrieve an agent's input and output JSON schemas.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsGetSchemasResponse;
import java.lang.Exception;
public class Application {
public static void main(String[] args) throws PlatformProblemDetailException, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PlatformAgentsGetSchemasResponse res = sdk.agents().getSchemas()
.agentId("<id>")
.includeTools(false)
.call();
if (res.platformAgentSchemasResponse().isPresent()) {
System.out.println(res.platformAgentSchemasResponse().get());
}
}
}
| Parameter |
Type |
Required |
Description |
agentId |
String |
✔️ |
ID of the agent whose schemas should be retrieved. |
includeTools |
Optional<Boolean> |
➖ |
Whether to include tool metadata in the response. |
PlatformAgentsGetSchemasResponse
| Error Type |
Status Code |
Content Type |
| models/errors/PlatformProblemDetailException |
400, 401, 403, 404, 408, 429 |
application/problem+json |
| models/errors/PlatformProblemDetailException |
500, 503 |
application/problem+json |
| models/errors/APIException |
4XX, 5XX |
*/* |
Execute an agent run. Set stream to true to receive server-sent events; otherwise the response contains the final agent messages.
package hello.world;
import com.glean.api_client.glean_api_client.Glean;
import com.glean.api_client.glean_api_client.models.components.*;
import com.glean.api_client.glean_api_client.models.errors.PlatformProblemDetailException;
import com.glean.api_client.glean_api_client.models.operations.PlatformAgentsCreateRunResponse;
import java.lang.Exception;
import java.util.List;
public class Application {
public static void main(String[] args) throws PlatformProblemDetailException, Exception {
Glean sdk = Glean.builder()
.apiToken(System.getenv().getOrDefault("GLEAN_API_TOKEN", ""))
.build();
PlatformAgentsCreateRunResponse res = sdk.agents().createRun()
.agentId("<id>")
.platformAgentRunCreateRequest(PlatformAgentRunCreateRequest.builder()
.messages(List.of(
PlatformMessage.builder()
.role(PlatformMessageRole.USER)
.content(List.of())
.build()))
.build())
.call();
if (res.platformAgentRunWaitResponse().isPresent()) {
System.out.println(res.platformAgentRunWaitResponse().get());
}
}
}
PlatformAgentsCreateRunResponse
| Error Type |
Status Code |
Content Type |
| models/errors/PlatformProblemDetailException |
400, 401, 403, 404, 408, 409, 413, 429 |
application/problem+json |
| models/errors/PlatformProblemDetailException |
500, 503 |
application/problem+json |
| models/errors/APIException |
4XX, 5XX |
*/* |