Commit 44d9159
committed
Add the Agent Factories authoring surface
Agent Factories let a trusted extension declare a JavaScript closure that
orchestrates a fleet of subagents, and invoke it by name. The runtime half
shipped in copilot-agent-runtime#12953 and #13077; this is the SDK half.
The feature is dark behind the runtime's `agent_factories` flag plus its
billing gate, and every public type is marked `@experimental`.
RPC surface
- Bumps `@github/copilot` to ^1.0.75, the first published runtime whose
schemas carry the full factory surface, and regenerates every language.
- Generated wire types for the factory session methods (`run`, `resume`,
`getRun`, `listRuns`, `getRunDetail`, `getRunProgress`, `cancel`), the
reverse `factory.execute` / `factory.abort` calls, run envelopes,
registration metadata, and the observability DTOs.
- Fixes opaque-JSON codegen so a factory's args and result can be any JSON
value rather than an object alone, which also lets a void factory
complete without a result.
Authoring harness
- `defineFactory({ meta, run })` returns an opaque handle; an extension
registers it through `joinSession({ factories: [...] })`. Only metadata
crosses to the runtime — the closure stays in the extension process and
is invoked over the reverse `factory.execute` RPC.
- The `run()` context: `args`, the extension's full `session`, a per-run
`signal`, `runId`, plus `agent()` (one single-turn subagent, optionally
schema-constrained), `step()` (journal-backed memoization), `parallel()`,
`pipeline()`, and `phase()` / `log()` progress markers. `factory()`
throws, because nesting is forbidden.
- `session.factory.*` friendly wrappers, including `resume(runId)`, which
reuses the persisted name, arguments, journal, and accounting so a caller
never re-sends them.
- Declared limits (`maxConcurrentSubagents`, `maxTotalSubagents`,
`timeoutSeconds`, `maxAiCredits`) validated at the authoring boundary.
- Strict JSON validation shared by factory results and journaled `step()`
producers, so a lossy value is rejected rather than silently mutating on
a resumed replay.
`run()` and `resume()` resolve with the run envelope for every outcome —
completed, error, halted, or cancelled — and reject only when no run
exists (an unknown factory, a declined approval, an already-active
session). This keeps the signature stable for the planned background-only
execution mode, which changes a run's timing and status but not its shape.
Authoring documentation lives in `nodejs/docs/factories.md`, with a
pattern library in `nodejs/docs/factory-patterns.md`.1 parent 0015a98 commit 44d9159
32 files changed
Lines changed: 15338 additions & 1366 deletions
File tree
- dotnet/src/Generated
- go
- rpc
- nodejs
- docs
- src
- generated
- test
- e2e
- python/copilot/generated
- rust/src/generated
- scripts/codegen
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
0 commit comments