feat(runs): the in-process agent loop, checkpointed as run steps, and the investigate workflow (#1977, #1889)
The agent model is an organisation setting in the new governance module. Every model and tool call is a journal step, so a killed run resumes without repeating either. Agents are offered connector lookups and read-only actions only, until judgement exists.
This commit is contained in:
16 files changed
+795
-23
No files matched your search
@@ -15,12 +15,15 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/samcharles93/ai-sdk/runtime"
|
||||
|
||||
"github.com/samcharles93/archie-core/internal/buildinfo"
|
||||
"github.com/samcharles93/archie-core/internal/platform/health"
|
||||
"github.com/samcharles93/archie-core/internal/platform/httpjson"
|
||||
"github.com/samcharles93/archie-core/internal/platform/pg"
|
||||
"github.com/samcharles93/archie-core/modules/connectors"
|
||||
"github.com/samcharles93/archie-core/modules/events"
|
||||
"github.com/samcharles93/archie-core/modules/governance"
|
||||
"github.com/samcharles93/archie-core/modules/runs"
|
||||
)
|
||||
|
||||
@@ -50,7 +53,9 @@ func Run(ctx context.Context, configPath string) error {
|
||||
mux := http.NewServeMux()
|
||||
checks.Routes(mux)
|
||||
|
||||
engine := runs.New(db, log.With("module", "runs"), runs.Options{Owner: owner()})
|
||||
runtime.RegisterBuiltinClasses()
|
||||
settings := governance.NewModule(db, log.With("module", "governance"), orgID)
|
||||
settings.Routes(mux, guard)
|
||||
|
||||
conns := connectors.NewModule(db, log.With("module", "connectors"), orgID)
|
||||
defer conns.Close()
|
||||
@@ -60,6 +65,11 @@ func Run(ctx context.Context, configPath string) error {
|
||||
checks.Register("connectors", conns.Ready)
|
||||
conns.Routes(mux, guard)
|
||||
|
||||
engine := runs.New(db, log.With("module", "runs"), runs.Options{Owner: owner()})
|
||||
// A workflow takes its context from the run handle, as a handler takes it
|
||||
// from the request.
|
||||
engine.Register("investigate", runs.Investigate(settings, conns)) //nolint:contextcheck // see above
|
||||
|
||||
hear := events.NewModule(db, log.With("module", "events"), orgID, conns, engine)
|
||||
hear.Routes(mux, guard)
|
||||
|
||||
@@ -79,7 +89,7 @@ func Run(ctx context.Context, configPath string) error {
|
||||
const orgID = "default"
|
||||
|
||||
// schemas are the module schemas the runtime role is granted DML on.
|
||||
var schemas = []string{"runs", "connectors", "events"}
|
||||
var schemas = []string{"runs", "connectors", "events", "governance"}
|
||||
|
||||
// owner names this process in run leases.
|
||||
func owner() string {
|
||||
|
||||
Reference in new issue
Block a user