Skip to content

latticeHQ/latticeSDK

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Lattice SDK

The complete Go SDK for Lattice Runtime.

429 functions across 29 packages — full API parity with the platform. Build Department Stacks and custom agents without touching Runtime source code.


What is a Department Stack?

A Department Stack is a vertical AI application built on top of Lattice Runtime's horizontal coordination layer. Think of it like building a Shopify app on the Shopify platform — you get identity, authorization, audit trails, budgets, and cross-stack coordination for free.

Examples:

  • HR Stack — AI agents for recruiting, onboarding, and employee support
  • Legal Stack — Contract review, compliance monitoring, regulatory tracking
  • Finance Stack — Expense approval, forecasting, audit automation

Install

go get github.com/latticehq/latticesdk@latest

Quick Start

package main

import (
    "context"
    "fmt"
    "os"

    "github.com/latticehq/latticesdk/stack"
)

func main() {
    ctx := context.Background()

    s, err := stack.New(stack.Config{
        RuntimeURL:   os.Getenv("LATTICE_RUNTIME_URL"),
        APIKey:       os.Getenv("LATTICE_API_KEY"),
        StackName:    "hr-stack",
        StackVersion: "0.1.0",
    })
    if err != nil {
        panic(err)
    }

    // Full platform access through typed services
    agents, _, _ := s.Agents.ListAgents(ctx, nil)
    fmt.Printf("Found %d agents\n", len(agents))

    templates, _ := s.Templates.ListTemplates(ctx, nil)
    fmt.Printf("Found %d templates\n", len(templates))

    allowed, _ := s.Authz.Can(ctx, "update", "agent", "some-id")
    fmt.Printf("Allowed: %v\n", allowed)

    // Run with heartbeats and graceful shutdown
    s.Run(ctx)
}

Packages

Core Coordination

Package Funcs Description
client 22 HTTP client — auth, retries, SSE, pagination, error handling
types Shared domain types — agents, users, orgs, templates, roles
stack 8 High-level bootstrap — all 25 services pre-wired with Run()

Identity & Access

Package Funcs Description
identity 25 Identity management — agents, users, organizations, tokens
users 38 Full user lifecycle — create, auth, roles, password, org membership
authz 5 Authorization — permission checks, RBAC, site/org roles
groups 17 Group management — CRUD, IDP sync settings
oauth2 12 OAuth2 provider apps — secrets, revocation
externalauth 8 External auth providers — device auth, link/unlink

Agents & Sessions

Package Funcs Description
agents 44 Complete agent management — CRUD, builds, proxies, sidecars, port shares
sessions 45 Complete session management — CRUD, builds, sidecars, real-time
templates 39 Template management — CRUD, versions, ACL, parameters, dry runs

Platform Operations

Package Funcs Description
deployments 23 Deployment config, stats, appearance, entitlements, experiments
tasks 12 AI task management — CRUD, send messages, logs
evals 13 Evaluation framework — runs, comparisons, passes, parameters
insights 9 Usage analytics — latency, activity, template insights
notifications 8 Notification settings, templates, user preferences
provisioners 10 Provisioner daemons and key management
licenses 8 License management — add, list, delete

Coordination & Lifecycle

Package Funcs Description
coordination 6 Cross-stack messaging — pub/sub, shared state, escalation
lifecycle 7 Stack lifecycle — registration, health, heartbeats, metadata
audit 4 Audit trail — query logs, emit custom events
budget 4 Budget control — quotas, cost reporting

Agent-Side SDK

Package Funcs Description
agentsdk 23 Agent-to-sidecar connectivity — connections, PTY, file ops, debug
sidecarsdk 13 Sidecar-to-Runtime communication — cloud auth, lifecycle, logs, stats
toolsdk 7+32 AI tool definitions — 32 typed tools with handler infrastructure
healthsdk 6 Deployment health checks — DERP, database, websocket, provisioners

Utilities

Package Funcs Description
files 4 File upload and download
gitsshkeys 3 Git SSH key management
replicas 2 Replica information

Architecture

┌──────────────────────┐     ┌──────────────────────┐
│  Your Department Stack│     │  Your Custom Agent    │
│  (HR, Legal, Finance) │     │  (runs in workspace)  │
├──────────────────────┤     ├──────────────────────┤
│      latticeSDK       │     │      latticeSDK       │
│  ┌────────┐ ┌───────┐│     │  ┌──────────────────┐│
│  │ agents │ │ authz ││     │  │   sidecarsdk     ││
│  │ users  │ │ audit ││     │  │   agentsdk       ││
│  │ tasks  │ │budget ││     │  │   toolsdk        ││
│  │ evals  │ │coord. ││     │  │   healthsdk      ││
│  └────────┘ └───────┘│     │  └──────────────────┘│
│       client          │     │       client          │
├──────────────────────┤     ├──────────────────────┤
│                Lattice Runtime API                  │
│           access.latticeruntime.com                 │
└─────────────────────────────────────────────────────┘

Zero dependency on Runtime source code. Only external dependency: github.com/google/uuid.

Using Individual Services

You don't have to use the stack bootstrap. Each service works independently:

import (
    "github.com/latticehq/latticesdk/client"
    "github.com/latticehq/latticesdk/agents"
    "github.com/latticehq/latticesdk/templates"
)

c, _ := client.New("https://access.latticeruntime.com", client.WithAPIKey("..."))

agentSvc := agents.New(c)
tmplSvc := templates.New(c)

// Use directly
myAgents, _, _ := agentSvc.ListAgents(ctx, nil)
myTemplates, _ := tmplSvc.ListTemplates(ctx, nil)

Building a Custom Agent

Use sidecarsdk and toolsdk to build agents that report back to Runtime:

import (
    "github.com/latticehq/latticesdk/client"
    "github.com/latticehq/latticesdk/sidecarsdk"
    "github.com/latticehq/latticesdk/toolsdk"
)

c, _ := client.New(os.Getenv("LATTICE_RUNTIME_URL"), client.WithSessionToken(token))

sidecar := sidecarsdk.New(c)

// Report lifecycle state
sidecar.PostStartup(ctx, sidecarsdk.PostStartupRequest{Version: "1.0.0"})
sidecar.PostLifecycle(ctx, sidecarsdk.PostLifecycleRequest{State: sidecarsdk.LifecycleReady})

// Send logs
sidecar.PatchLogs(ctx, sidecarsdk.PatchLogsRequest{
    LogSourceID: sourceID,
    Logs: []sidecarsdk.Log{{Output: "Agent ready", Level: sidecarsdk.LogLevelInfo}},
})

// Use AI tools
tools := toolsdk.AllTools()
deps := toolsdk.NewDeps(c)

The Ecosystem

Component What it does License
Runtime Coordination layer — identity, authorization, audit, budget, networking Apache 2.0
SDK Go SDK for building Department Stacks and custom agents (429 functions, 29 packages) Apache 2.0
Workbench Reference Engineering Stack — multi-model agent workspace MIT
Inference Local AI serving — MLX on Apple Silicon, zero-config clustering Apache 2.0
Operator Self-hosted deployment management for Lattice infrastructure Apache 2.0
Registry Community ecosystem — Terraform modules, templates, department stacks Apache 2.0
Terraform Provider Infrastructure as code for Lattice deployments MPL 2.0
Toolbox macOS app manager for Lattice products MIT
Homebrew One-line install on macOS and Linux MIT
Enterprise Enterprise administration and governance Coming soon

Links


Your agents. Your coordination. Your rules. Your infrastructure.

About

Go SDK for building Department Stacks on Lattice Runtime — identity, authorization, audit, budget, and coordination

Topics

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors