Skip to content
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@anduril-industries/lattice-sdk",
"version": "3.0.0",
"version": "3.1.0",
"private": false,
"repository": "github:anduril/lattice-sdk-javascript",
"license": "See LICENSE",
Expand Down
100 changes: 93 additions & 7 deletions reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,25 @@ await client.entities.longPollEntityEvents({
<dl>
<dd>

Establishes a persistent connection to stream entity events as they occur.
Establishes a server-sent events (SSE) connection that streams entity data in real-time.
This is a one-way connection from server to client that follows the SSE protocol with text/event-stream content type.

This endpoint enables clients to maintain a real-time view of the common operational picture (COP)
by first streaming all pre-existing entities that match filter criteria, then continuously delivering
updates as entities are created, modified, or deleted.

The server first sends events with type PREEXISTING for all live entities matching the filter that existed before the stream was open,
then streams CREATE events for newly created entities, UPDATE events when existing entities change, and DELETED events when entities are removed. The stream remains open
indefinitely unless preExistingOnly is set to true.

Heartbeat messages can be configured to maintain connection health and detect disconnects by setting the heartbeatIntervalMS
parameter. These heartbeats help keep the connection alive and allow clients to verify the server is still responsive.

Clients can optimize bandwidth usage by specifying which entity components they need populated using the componentsToInclude parameter.
This allows receiving only relevant data instead of complete entities.

The connection automatically recovers from temporary disconnections, resuming the stream where it left off. Unlike polling approaches,
this provides real-time updates with minimal latency and reduced server load.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -426,8 +444,14 @@ for await (const item of response) {
<dl>
<dd>

Submit a request to create a task and schedule it for delivery. Tasks, once delivered, will
be asynchronously updated by their destined agent.
Creates a new Task in the system with the specified parameters.

This method initiates a new task with a unique ID (either provided or auto-generated),
sets the initial task state to STATUS_CREATED, and establishes task ownership. The task
can be assigned to a specific agent through the Relations field.

Once created, a task enters the lifecycle workflow and can be tracked, updated, and managed
through other Tasks API endpoints.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -482,6 +506,27 @@ await client.tasks.createTask();
<dl>
<dd>

#### 📝 Description

<dl>
<dd>

<dl>
<dd>

Retrieves a specific Task by its ID, with options to select a particular task version or view.

This method returns detailed information about a task including its current status,
specification, relations, and other metadata. The response includes the complete Task object
with all associated fields.

By default, the method returns the latest definition version of the task from the manager's
perspective.
</dd>
</dl>
</dd>
</dl>

#### 🔌 Usage

<dl>
Expand Down Expand Up @@ -539,7 +584,17 @@ await client.tasks.getTask("taskId");
<dl>
<dd>

Update the status of a task.
Updates the status of a Task as it progresses through its lifecycle.

This method allows agents or operators to report the current state of a task,
which could include changes to task status, and error information.

Each status update increments the task's status_version. When updating status,
clients must provide the current version to ensure consistency. The system rejects
updates with mismatched versions to prevent race conditions.

Terminal states (`STATUS_DONE_OK` and `STATUS_DONE_NOT_OK`) are permanent; once a task
reaches these states, no further updates are allowed.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -610,7 +665,21 @@ await client.tasks.updateTaskStatus("taskId");
<dl>
<dd>

Query for tasks by a specified search criteria.
Searches for Tasks that match specified filtering criteria and returns matching tasks in paginated form.

This method allows filtering tasks based on multiple criteria including:
- Parent task relationships
- Task status (with inclusive or exclusive filtering)
- Update time ranges
- Task view (manager or agent perspective)
- Task assignee
- Task type (via exact URL matches or prefix matching)

Results are returned in pages. When more results are available than can be returned in a single
response, a page_token is provided that can be used in subsequent requests to retrieve the next
set of results.

By default, this returns the latest task version for each matching task from the manager's perspective.
</dd>
</dl>
</dd>
Expand Down Expand Up @@ -673,8 +742,25 @@ await client.tasks.queryTasks();
<dl>
<dd>

This is a long polling API that will block until a new task is ready for delivery. If no new task is
available then the server will hold on to your request for up to 5 minutes, after that 5 minute timeout
Establishes a server streaming connection that delivers tasks to taskable agents for execution.

This method creates a persistent connection from Tasks API to an agent, allowing the server
to push tasks to the agent as they become available. The agent receives a stream of tasks that
match its selector criteria (entity IDs).

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

This is the primary method for taskable agents to receive and process tasks in real-time.
Agents should maintain this connection 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.

This is a long polling API that will block until a new task is ready for delivery. If no new task is
available then the server will hold on to your request for up to 5 minutes, after that 5 minute timeout
period you will be expected to reinitiate a new request.
</dd>
</dl>
Expand Down
4 changes: 2 additions & 2 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ export class LatticeClient {
{
"X-Fern-Language": "JavaScript",
"X-Fern-SDK-Name": "@anduril-industries/lattice-sdk",
"X-Fern-SDK-Version": "3.0.0",
"User-Agent": "@anduril-industries/lattice-sdk/3.0.0",
"X-Fern-SDK-Version": "3.1.0",
"User-Agent": "@anduril-industries/lattice-sdk/3.1.0",
"X-Fern-Runtime": core.RUNTIME.type,
"X-Fern-Runtime-Version": core.RUNTIME.version,
},
Expand Down
20 changes: 19 additions & 1 deletion src/api/resources/entities/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -476,7 +476,25 @@ export class Entities {
}

/**
* Establishes a persistent connection to stream entity events as they occur.
* Establishes a server-sent events (SSE) connection that streams entity data in real-time.
* This is a one-way connection from server to client that follows the SSE protocol with text/event-stream content type.
*
* This endpoint enables clients to maintain a real-time view of the common operational picture (COP)
* by first streaming all pre-existing entities that match filter criteria, then continuously delivering
* updates as entities are created, modified, or deleted.
*
* The server first sends events with type PREEXISTING for all live entities matching the filter that existed before the stream was open,
* then streams CREATE events for newly created entities, UPDATE events when existing entities change, and DELETED events when entities are removed. The stream remains open
* indefinitely unless preExistingOnly is set to true.
*
* Heartbeat messages can be configured to maintain connection health and detect disconnects by setting the heartbeatIntervalMS
* parameter. These heartbeats help keep the connection alive and allow clients to verify the server is still responsive.
*
* Clients can optimize bandwidth usage by specifying which entity components they need populated using the componentsToInclude parameter.
* This allows receiving only relevant data instead of complete entities.
*
* The connection automatically recovers from temporary disconnections, resuming the stream where it left off. Unlike polling approaches,
* this provides real-time updates with minimal latency and reduced server load.
*/
public streamEntities(
request: Lattice.EntityStreamRequest = {},
Expand Down
64 changes: 60 additions & 4 deletions src/api/resources/tasks/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,14 @@ export class Tasks {
}

/**
* Submit a request to create a task and schedule it for delivery. Tasks, once delivered, will
* be asynchronously updated by their destined agent.
* Creates a new Task in the system with the specified parameters.
*
* This method initiates a new task with a unique ID (either provided or auto-generated),
* sets the initial task state to STATUS_CREATED, and establishes task ownership. The task
* can be assigned to a specific agent through the Relations field.
*
* Once created, a task enters the lifecycle workflow and can be tracked, updated, and managed
* through other Tasks API endpoints.
*
* @param {Lattice.TaskCreation} request
* @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
Expand Down Expand Up @@ -106,6 +112,15 @@ export class Tasks {
}

/**
* Retrieves a specific Task by its ID, with options to select a particular task version or view.
*
* This method returns detailed information about a task including its current status,
* specification, relations, and other metadata. The response includes the complete Task object
* with all associated fields.
*
* By default, the method returns the latest definition version of the task from the manager's
* perspective.
*
* @param {string} taskId - ID of task to return
* @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
*
Expand Down Expand Up @@ -182,7 +197,17 @@ export class Tasks {
}

/**
* Update the status of a task.
* Updates the status of a Task as it progresses through its lifecycle.
*
* This method allows agents or operators to report the current state of a task,
* which could include changes to task status, and error information.
*
* Each status update increments the task's status_version. When updating status,
* clients must provide the current version to ensure consistency. The system rejects
* updates with mismatched versions to prevent race conditions.
*
* Terminal states (`STATUS_DONE_OK` and `STATUS_DONE_NOT_OK`) are permanent; once a task
* reaches these states, no further updates are allowed.
*
* @param {string} taskId - ID of task to update status of
* @param {Lattice.TaskStatusUpdate} request
Expand Down Expand Up @@ -271,7 +296,21 @@ export class Tasks {
}

/**
* Query for tasks by a specified search criteria.
* Searches for Tasks that match specified filtering criteria and returns matching tasks in paginated form.
*
* This method allows filtering tasks based on multiple criteria including:
* - Parent task relationships
* - Task status (with inclusive or exclusive filtering)
* - Update time ranges
* - Task view (manager or agent perspective)
* - Task assignee
* - Task type (via exact URL matches or prefix matching)
*
* Results are returned in pages. When more results are available than can be returned in a single
* response, a page_token is provided that can be used in subsequent requests to retrieve the next
* set of results.
*
* By default, this returns the latest task version for each matching task from the manager's perspective.
*
* @param {Lattice.TaskQuery} request
* @param {Tasks.RequestOptions} requestOptions - Request-specific configuration.
Expand Down Expand Up @@ -355,6 +394,23 @@ export class Tasks {
}

/**
* Establishes a server streaming connection that delivers tasks to taskable agents for execution.
*
* This method creates a persistent connection from Tasks API to an agent, allowing the server
* to push tasks to the agent as they become available. The agent receives a stream of tasks that
* match its selector criteria (entity IDs).
*
* 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
*
* This is the primary method for taskable agents to receive and process tasks in real-time.
* Agents should maintain this connection 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.
*
* This is a long polling API that will block until a new task is ready for delivery. If no new task is
* available then the server will hold on to your request for up to 5 minutes, after that 5 minute timeout
* period you will be expected to reinitiate a new request.
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/tasks/client/requests/TaskCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export interface TaskCreation {
displayName?: string;
/** Longer, free form human readable description of this Task. */
description?: string;
/** Full set of task parameters. */
/** The path for the Protobuf task definition, and the complete task data. */
specification?: Lattice.GoogleProtobufAny;
author?: Lattice.Principal;
/**
Expand Down
2 changes: 1 addition & 1 deletion src/api/resources/tasks/client/requests/TaskQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export interface TaskQuery {
pageToken?: string;
/**
* If present matches Tasks with this parent Task ID.
* Note: this is mutually exclusive with all other query parameters, i.e., either provide parent Task ID, or
* Note: this is mutually exclusive with all other query parameters, for example, either provide parent task ID, or
* any of the remaining parameters, but not both.
*/
parentTaskId?: string;
Expand Down
2 changes: 1 addition & 1 deletion src/api/types/Agent.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file was auto-generated by Fern from our API Definition.

/**
* Represents an Agent in the COP.
* Represents an agent capable of processing tasks.
*/
export interface Agent {
/** Entity ID of the agent. */
Expand Down
12 changes: 12 additions & 0 deletions src/api/types/AgentRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@

import type * as Lattice from "../index.js";

/**
* Response streamed to an agent containing task actions to perform.
*
* This message is streamed from Tasks API to agents and contains one of three
* possible requests: execute a task, cancel a task, or complete a task. The agent
* should process these requests according to its capabilities and report status
* updates back to Tasks API using the UpdateStatus endpoint.
*
* Multiple responses may be sent for different tasks, and the agent should maintain
* the connection to receive ongoing task requests. The connection may also be used
* for heartbeat messages to ensure the agent is still responsive.
*/
export interface AgentRequest {
executeRequest?: Lattice.ExecuteRequest;
cancelRequest?: Lattice.CancelRequest;
Expand Down
4 changes: 2 additions & 2 deletions src/api/types/Allocation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import type * as Lattice from "../index.js";

/**
* Allocation contains a list of agents allocated to a Task.
* Allocation contains a list of agents allocated to a task.
*/
export interface Allocation {
/** Agents actively being utilized in a Task. */
/** Agents actively being utilized in a task. */
activeAgents?: Lattice.Agent[];
}
5 changes: 3 additions & 2 deletions src/api/types/CancelRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
import type * as Lattice from "../index.js";

/**
* Request to Cancel a Task.
* The request to cancel a task.
* Contains the task, and the assignee of the request to cancel the task.
*/
export interface CancelRequest {
/** ID of the Task to cancel. */
/** The unique task ID of the task to cancel. */
taskId?: string;
/**
* The assignee of the Task. Useful for agent routing where an endpoint owns multiple agents,
Expand Down
3 changes: 2 additions & 1 deletion src/api/types/CompleteRequest.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// This file was auto-generated by Fern from our API Definition.

/**
* Request to Complete a Task.
* The request to complete a task.
* Contains the unique ID of the task to complete.
*/
export interface CompleteRequest {
/** ID of the task to complete. */
Expand Down
4 changes: 2 additions & 2 deletions src/api/types/Entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import type * as Lattice from "../index.js";
*/
export interface Entity {
/**
* A Globally Unique Identifier (GUID) for your entity. If this field is empty, the Entity Manager API
* automatically generates an ID when it creates the entity.
* A Globally Unique Identifier (GUID) for your entity. This is a required
* field.
*/
entityId?: string;
/**
Expand Down
5 changes: 3 additions & 2 deletions src/api/types/ExecuteRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@
import type * as Lattice from "../index.js";

/**
* Request to execute a Task.
* The request to execute a task.
* Contains the unique ID of the task to execute.
*/
export interface ExecuteRequest {
/** Task to execute. */
/** The task to execute. */
task?: Lattice.Task;
}
Loading