Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .fern/metadata.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"cliVersion": "3.40.0",
"cliVersion": "3.51.2",
"generatorName": "fernapi/fern-java-sdk",
"generatorVersion": "3.29.1",
"generatorConfig": {
"client-class-name": "Lattice",
"package-prefix": "com.anduril"
},
"sdkVersion": "5.1.0"
"sdkVersion": "5.2.0"
}
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ The Lattice SDK Java library provides convenient access to the Lattice SDK APIs
- [Installation](#installation)
- [Support](#support)
- [Usage](#usage)
- [Authentication](#authentication)
- [Environments](#environments)
- [Base Url](#base-url)
- [Exception Handling](#exception-handling)
Expand Down Expand Up @@ -52,7 +53,7 @@ Add the dependency in your `pom.xml` file:
<dependency>
<groupId>com.anduril</groupId>
<artifactId>lattice-sdk</artifactId>
<version>5.1.0</version>
<version>5.2.0</version>
</dependency>
```

Expand Down Expand Up @@ -111,6 +112,32 @@ Lattice client = Lattice.builder()
.build();
```

## Authentication

This SDK supports two authentication methods:

### Option 1: Direct Bearer Token

If you already have a valid access token, you can use it directly:

```java
Lattice client = Lattice.builder()
.token("your-access-token")
.url("https://api.example.com")
.build();
```

### Option 2: OAuth Client Credentials

The SDK can automatically handle token acquisition and refresh:

```java
Lattice client = Lattice.builder()
.credentials("client-id", "client-secret")
.url("https://api.example.com")
.build();
```

## Environments

This SDK allows you to configure different environments for API requests.
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ java {

group = 'com.anduril'

version = '5.1.0'
version = '5.2.0'

jar {
dependsOn(":generatePomFileForMavenPublication")
Expand Down Expand Up @@ -78,7 +78,7 @@ publishing {
maven(MavenPublication) {
groupId = 'com.anduril'
artifactId = 'lattice-sdk'
version = '5.1.0'
version = '5.2.0'
from components.java
pom {
name = 'Anduril Industries, Inc.'
Expand Down
181 changes: 177 additions & 4 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,97 @@ any of the remaining parameters, but not both.
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.tasks.streamTasks(request) -> Iterable&amp;lt;StreamTasksResponse&amp;gt;</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Establishes a server streaming connection that delivers task updates in real-time using Server-Sent Events (SSE).

The stream delivers all existing non-terminal tasks when first connected, followed by real-time
updates for task creation and status changes. Additionally, heartbeat messages are sent periodically to maintain the connection.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```java
client.tasks().streamTasks(
TaskStreamRequest
.builder()
.build()
);
```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**heartbeatIntervalMs:** `Optional<Integer>` — The time interval, in milliseconds, that determines the frequency at which to send heartbeat events. Defaults to 30000 (30 seconds).

</dd>
</dl>

<dl>
<dd>

**rateLimit:** `Optional<Integer>`

The time interval, in milliseconds, after an update for a given task before another one will be sent for the same task.
If set, value must be >= 250.

</dd>
</dl>

<dl>
<dd>

**excludePreexistingTasks:** `Optional<Boolean>`

Optional flag to only include tasks created or updated after the stream is initiated, and not any previous preexisting tasks.
If unset or false, the stream will include any new tasks and task updates, as well as all preexisting tasks.

</dd>
</dl>

<dl>
<dd>

**taskType:** `Optional<TaskStreamRequestTaskType>` — Optional filter that only returns tasks with specific types. If not provided, all task types will be streamed.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down Expand Up @@ -909,6 +1000,88 @@ client.tasks().listenAsAgent(
</dl>


</dd>
</dl>
</details>

<details><summary><code>client.tasks.streamAsAgent(request) -> Iterable&amp;lt;StreamAsAgentResponse&amp;gt;</code></summary>
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Establishes a server streaming connection that delivers tasks to taskable agents for execution
using Server-Sent Events (SSE).

This method creates a connection from the Tasks API to an agent that streams relevant tasks to the listener agent. The agent receives a stream of tasks that match the entities specified by the tasks' selector criteria.

The stream delivers three types of requests:
- `ExecuteRequest`: Contains a new task for the agent to execute
- `CancelRequest`: Indicates a task should be canceled
- `CompleteRequest`: Indicates a task should be completed

Additionally, heartbeat messages are sent periodically to maintain the connection.

This is recommended method for taskable agents to receive and process tasks in real-time.
Agents should maintain connection to this stream and process incoming tasks according to their capabilities.

When an agent receives a task, it should update the task status using the `UpdateStatus` endpoint
to provide progress information back to Tasks API.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
<dd>

<dl>
<dd>

```java
client.tasks().streamAsAgent(
AgentStreamRequest
.builder()
.build()
);
```
</dd>
</dl>
</dd>
</dl>

#### ⚙️ Parameters

<dl>
<dd>

<dl>
<dd>

**agentSelector:** `Optional<EntityIdsSelector>` — The selector criteria to determine which tasks the agent receives.

</dd>
</dl>

<dl>
<dd>

**heartbeatIntervalMs:** `Optional<Integer>` — The time interval, defined in seconds, that determines the frequency at which to send heartbeat events. Defaults to 30s.

</dd>
</dl>
</dd>
</dl>


</dd>
</dl>
</details>
Expand Down Expand Up @@ -1243,8 +1416,8 @@ client.objects().getObjectMetadata(
</dl>
</details>

## OAuth2
<details><summary><code>client.oAuth2.getToken(request) -> GetTokenResponse</code></summary>
## oauth
<details><summary><code>client.oauth.getToken(request) -> GetTokenResponse</code></summary>
<dl>
<dd>

Expand All @@ -1256,7 +1429,7 @@ client.objects().getObjectMetadata(
<dl>
<dd>

Support the client credentials authorization flow
Gets a new short-lived token using the specified client credentials
</dd>
</dl>
</dd>
Expand All @@ -1271,7 +1444,7 @@ Support the client credentials authorization flow
<dd>

```java
client.oAuth2().getToken(
client.oauth().getToken(
GetTokenRequest
.builder()
.build()
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/anduril/AsyncLattice.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.anduril.core.ClientOptions;
import com.anduril.core.Suppliers;
import com.anduril.resources.entities.AsyncEntitiesClient;
import com.anduril.resources.oauth2.AsyncOAuth2Client;
import com.anduril.resources.oauth.AsyncOauthClient;
import com.anduril.resources.objects.AsyncObjectsClient;
import com.anduril.resources.tasks.AsyncTasksClient;
import java.util.function.Supplier;
Expand All @@ -20,14 +20,14 @@ public class AsyncLattice {

protected final Supplier<AsyncObjectsClient> objectsClient;

protected final Supplier<AsyncOAuth2Client> oAuth2Client;
protected final Supplier<AsyncOauthClient> oauthClient;

public AsyncLattice(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.entitiesClient = Suppliers.memoize(() -> new AsyncEntitiesClient(clientOptions));
this.tasksClient = Suppliers.memoize(() -> new AsyncTasksClient(clientOptions));
this.objectsClient = Suppliers.memoize(() -> new AsyncObjectsClient(clientOptions));
this.oAuth2Client = Suppliers.memoize(() -> new AsyncOAuth2Client(clientOptions));
this.oauthClient = Suppliers.memoize(() -> new AsyncOauthClient(clientOptions));
}

public AsyncEntitiesClient entities() {
Expand All @@ -42,8 +42,8 @@ public AsyncObjectsClient objects() {
return this.objectsClient.get();
}

public AsyncOAuth2Client oAuth2() {
return this.oAuth2Client.get();
public AsyncOauthClient oauth() {
return this.oauthClient.get();
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/com/anduril/AsyncLatticeBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.anduril.core.ClientOptions;
import com.anduril.core.Environment;
import com.anduril.core.OAuthTokenSupplier;
import com.anduril.resources.oauth2.OAuth2Client;
import com.anduril.resources.oauth.OauthClient;
import java.util.HashMap;
import java.util.Map;
import java.util.Optional;
Expand Down Expand Up @@ -249,7 +249,7 @@ public static final class _CredentialsAuth extends AsyncLatticeBuilder {
public AsyncLattice build() {
validateConfiguration();
ClientOptions baseOptions = buildClientOptions();
OAuth2Client authClient = new OAuth2Client(baseOptions);
OauthClient authClient = new OauthClient(baseOptions);
OAuthTokenSupplier oAuthTokenSupplier =
new OAuthTokenSupplier(this.clientId, this.clientSecret, authClient);
ClientOptions finalOptions = ClientOptions.Builder.from(baseOptions)
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/anduril/Lattice.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import com.anduril.core.ClientOptions;
import com.anduril.core.Suppliers;
import com.anduril.resources.entities.EntitiesClient;
import com.anduril.resources.oauth2.OAuth2Client;
import com.anduril.resources.oauth.OauthClient;
import com.anduril.resources.objects.ObjectsClient;
import com.anduril.resources.tasks.TasksClient;
import java.util.function.Supplier;
Expand All @@ -20,14 +20,14 @@ public class Lattice {

protected final Supplier<ObjectsClient> objectsClient;

protected final Supplier<OAuth2Client> oAuth2Client;
protected final Supplier<OauthClient> oauthClient;

public Lattice(ClientOptions clientOptions) {
this.clientOptions = clientOptions;
this.entitiesClient = Suppliers.memoize(() -> new EntitiesClient(clientOptions));
this.tasksClient = Suppliers.memoize(() -> new TasksClient(clientOptions));
this.objectsClient = Suppliers.memoize(() -> new ObjectsClient(clientOptions));
this.oAuth2Client = Suppliers.memoize(() -> new OAuth2Client(clientOptions));
this.oauthClient = Suppliers.memoize(() -> new OauthClient(clientOptions));
}

public EntitiesClient entities() {
Expand All @@ -42,8 +42,8 @@ public ObjectsClient objects() {
return this.objectsClient.get();
}

public OAuth2Client oAuth2() {
return this.oAuth2Client.get();
public OauthClient oauth() {
return this.oauthClient.get();
}

/**
Expand Down
Loading