Skip to content

feat: library / embedded mode - #4355

Merged
mnafees merged 73 commits into
mainfrom
nafees/library-mode
Jul 22, 2026
Merged

feat: library / embedded mode#4355
mnafees merged 73 commits into
mainfrom
nafees/library-mode

Conversation

@mnafees

@mnafees mnafees commented Jul 5, 2026

Copy link
Copy Markdown
Member

Description

Adds the ability to spawn an embedded Hatchet engine from a Go SDK client simply by providing a URL to a PostgreSQL DB.

import (
    hatchet "github.com/hatchet-dev/hatchet/sdks/go"

    _ "github.com/hatchet-dev/hatchet/embed"
)

client, err := hatchet.NewClient(hatchet.WithEmbeddedPostgres(databaseURL))
if err != nil {
    return err
}
defer func() { _ = client.Close(context.Background()) }()

This runs a full Hatchet engine (no UI) in-process with the Go binary it is embedded in.

Partially resolves #3680

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

Changes have been:

  • Tested (unit, integration, or manually with steps specified)
  • Linted and formatted

🤖 AI Disclosure
  • I acknowledge that an LLM was used in the creation of this Pull Request, in accordance with Hatchet's AI_POLICY.md.
  • Details: [e.g. generating tests, writing docs]

@mnafees mnafees self-assigned this Jul 5, 2026
@vercel

vercel Bot commented Jul 5, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hatchet-docs Ready Ready Preview, Comment Jul 21, 2026 3:34pm

Request Review

@github-actions github-actions Bot added github_actions Pull requests that update GitHub Actions code sdk-go Related to the Go SDK labels Jul 5, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Optional test failure: The load-deadlock job failed on this PR (optimistic-scheduling=true). This check is non-mandatory and does not block merging, but may be worth investigating. View logs

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Optional test failure: The load-deadlock job failed on this PR (optimistic-scheduling=true). This check is non-mandatory and does not block merging, but may be worth investigating. View logs

@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Optional test failure: The load-deadlock job failed on this PR (optimistic-scheduling=false). This check is non-mandatory and does not block merging, but may be worth investigating. View logs

Comment thread cmd/hatchet-engine/main.go Outdated
Comment thread embed/example/trigger/main.go Outdated
Comment thread pkg/repository/task.go Outdated
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Optional test failure: The load-deadlock job failed on this PR (optimistic-scheduling=false). This check is non-mandatory and does not block merging, but may be worth investigating. View logs

Comment thread embed/example/trigger/main.go Outdated
Comment thread embed/keyset.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just flagging that there's pretty much no benefit to encryption in this case, so we should likely print a warning to the console (at the very least) when running in this mode.

Comment thread embed/keyset.go Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also wonder if we want to move the embedded keyset management into its own package, and design it similarly to how we did with the pgoutbox schema: https://github.com/hatchet-dev/pgoutbox/blob/main/migrate.go

Comment thread sdks/go/examples/embedded/go.mod
Comment thread examples/go/embedded/trigger/main.go
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Jul 21, 2026
@mnafees
mnafees merged commit 1ed744f into main Jul 22, 2026
60 checks passed
@mnafees
mnafees deleted the nafees/library-mode branch July 22, 2026 11:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation engine Related to the core Hatchet engine github_actions Pull requests that update GitHub Actions code sdk-go Related to the Go SDK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEAT] Library-only mode and optional authentication

3 participants