For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Logo
ContactLearn More
GuidesReferenceSamplesLicenseChangelog
GuidesReferenceSamplesLicenseChangelog
ContactLearn More

Changelog

February 5, 2026
February 5, 2026
Was this page helpful?
Previous

January 15, 2026

Next

Server-sent events (SSE) for tasking

The Lattice SDK now supports two new APIs that use server-sent events (SSE) for real-time task monitoring in Lattice:

  1. StreamTasks - For monitoring all tasks across your Lattice environment.
  2. StreamAsAgent - For receiving tasks assigned to specific agents.

These new features provide instant updates on task creation, status changes, and completion without the need for polling, and replace the previous polling-based approach:

  • Filtering options: Focus on specific tasks using type prefix filtering.
  • Heartbeat mechanism: Verify connection health with configurable heartbeat intervals.
  • Comprehensive event data: Access full task details including status, description, and metadata.
  • Efficient resource usage: Reduce network traffic and server load compared to polling.

StreamTasks

The StreamTasks API enables centralized monitoring of all tasks in your Lattice environment regardless of the assigned agent.

Golang
1// Create task stream request
2request := &Lattice.TaskStreamRequest{
3 HeartbeatIntervalMs: Lattice.Int(10000),
4 ExcludePreexistingTasks: Lattice.Bool(false),
5 TaskType: &Lattice.TaskStreamRequestTaskType{
6 TaskStreamRequestTaskTypeTaskTypePrefix: &Lattice.TaskStreamRequestTaskTypeTaskTypePrefix{
7 TaskTypePrefix: "type.googleapis.com/<your-organization>.tasks",
8 },
9 },
10}
11
12// Start the task stream
13stream, err := LatticeClient.Tasks.StreamTasks(ctx, request)

StreamAsAgent

The StreamAsAgent API replaces the previous ListenAsAgent method, allowing agents to listen for tasks assigned specifically to them using server-sent events.

1// Create agent stream request
2agentRequest := &Lattice.AgentStreamRequest{
3 AgentSelector: &Lattice.EntityIdsSelector{
4 EntityIds: []string{entityId},
5 },
6}
7
8// Start streaming tasks for the agent
9agentStream, err := LatticeClient.Tasks.StreamAsAgent(ctx, agentRequest)

For more information about task monitoring, see Operate on tasks and Listen for tasks in the Lattice SDK guide.