name: jules-sdk-operations
description: Implement and maintain integrations with the official Jules TypeScript SDK ecosystem from google-labs-code/jules-sdk, including @google/jules-sdk plus companion packages (@google/jules-mcp, @google/jules-merge, @google/jules-fleet). Use when requests involve SDK-native session orchestration, stream monitoring, cache/query features, or package-based automation; use REST wrappers only when TypeScript SDK use is not possible.
Jules SDK Operations
Prefer Official SDK Packages
- Use
@google/jules-sdkas the primary integration surface. - Use companion packages when relevant:
@google/jules-mcpfor MCP tool exposure.@google/jules-mergefor conflict detection workflows.@google/jules-fleetfor scheduled analyze/dispatch/merge orchestration.
- Use
scripts/jules_sdk.pyonly for non-TypeScript or REST-compatibility fallback paths.
Execute a TypeScript SDK Workflow
- Install package(s):
npm i @google/jules-sdk. - Configure
JULES_API_KEYin environment. - Pick session mode:
- Automated:
jules.run(config)for fire-and-forget runs. - Interactive:
await jules.session(config)for guided workflows. - Rehydrate existing session:
jules.session(sessionId).
- Automated:
- Observe progress via
session.stream()and state gates viasession.waitFor(...). - Approve plan when needed:
session.approve(). - Finalize with
session.result()and inspectgeneratedFiles(),changeSet(), and PR outputs.
Use Higher-Level SDK Features
- Use
jules.all(items, mapper, options)for controlled parallel dispatch. - Use
jules.sessions(options)for paginated session cursors. - Use
jules.sources(...)andjules.sources.get({ github: 'owner/repo' })for source resolution. - Use
jules.select(query)to query local session/activity cache. - Use
jules.with(options)to create scoped clients (API key, polling, timeout, base URL).
Load References on Demand
- Load
references/sdk-status.mdfor repository verification and versions. - Load
references/typescript-sdk-api.mdfor method-level behavior and defaults. - Load
references/sdk-design-pattern.mdfor implementation policy. - Load
references/companion-packages.mdfor MCP/merge/fleet package usage boundaries.