name: jules-rest-api-operations
description: Automate Jules using the official Jules REST API (https://jules.googleapis.com/v1alpha) with API-key authentication, including creating/listing/deleting sessions, sending follow-up messages, approving plans, reading activities, and resolving source metadata. Use for API-driven orchestration, integrations, service-to-service workflows, or scripted Jules operations outside the CLI.
Jules REST API Operations
Execute the API Workflow
- Load API key from environment (
JULES_API_KEY). - Discover source repositories with
GET /v1alpha/sources. - Create a scoped session with
POST /v1alpha/sessions. - Poll session and activity state until terminal outcome.
- Send follow-up instructions with
:sendMessagewhen needed. - Approve plans with
:approvePlanwhenrequirePlanApproval=true. - Return links and outputs (for example PR URLs) from session results.
Apply Safety and Reliability Rules
- Keep prompts specific and bounded before creating sessions.
- Use
pageSizeandpageTokenfor list pagination. - Treat
FAILEDsessions as actionable diagnostics, not silent completion. - Handle documented error codes (
400,401,403,404,429,500) with retries or user-facing remediation.
Use Bundled Automation
- Use
scripts/jules_api.shfor consistent authenticated requests. - Start with
--dry-runto validate request shape before live API calls.
Load References on Demand
- Load
references/endpoints.mdfor endpoint-level semantics. - Load
references/states-and-artifacts.mdfor lifecycle and activity interpretation.