An Elixir client library for the Jules API. Jules is an AI-powered coding assistant that can automate software development tasks.
- Complete API client for Jules API (sources, sessions, activities)
- Support for GitHub repository operations
- Session management with plan approval
- Activity tracking and messaging
- Environment-based configuration
- Comprehensive error handling
Add jules_ex to your list of dependencies in mix.exs:
def deps do
[
{:jules_ex, "~> 0.1.0"}
]
endSet your Jules API key as an environment variable:
export JULES_API_KEY="your-api-key-here"Alternatively, configure it in your application config:
config :jules_ex,
api_key: "your-api-key-here"# List all sources
{:ok, %{"sources" => sources}} = JulesEx.list_sources()
# With pagination
{:ok, response} = JulesEx.list_sources(page_size: 10, page_token: "token")# Create a new session
{:ok, session} = JulesEx.create_session(
prompt: "Fix the bug in the login function",
source: "sources/github/owner/repo",
title: "Bug Fix",
starting_branch: "main"
)
session_id = session["id"]
# List all sessions
{:ok, %{"sessions" => sessions}} = JulesEx.list_sessions()
# Get a specific session
{:ok, session} = JulesEx.get_session(session_id)
# Approve a plan (if requirePlanApproval was set to true)
{:ok, _} = JulesEx.approve_plan(session_id)
# Send a message to the agent
{:ok, _} = JulesEx.send_message(session_id, "Make it corgi themed!")# List activities in a session
{:ok, %{"activities" => activities}} = JulesEx.list_activities(session_id)
# With pagination
{:ok, response} = JulesEx.list_activities(session_id, page_size: 30)
# Get a specific activity
{:ok, activity} = JulesEx.get_activity(session_id, activity_id)The Jules API is organized around three core resources:
- Source: An input source for the agent (e.g., a GitHub repository)
- Session: A continuous unit of work within a specific context
- Activity: A single unit of work within a session
JulesEx- Main module with convenience functionsJulesEx.Client- Low-level HTTP clientJulesEx.Source- Source managementJulesEx.Session- Session managementJulesEx.Activity- Activity tracking
# Get all sources
{:ok, %{"sources" => sources}} = JulesEx.list_sources()
# Create sessions for multiple repos in parallel
tasks = Enum.map(sources, fn source ->
Task.async(fn ->
JulesEx.create_session(
prompt: "Update dependencies and fix any compatibility issues",
source: source["name"],
title: "Dependency Update"
)
end)
end)
# Wait for all sessions to be created
sessions = Task.await_many(tasks, :infinity)Run the test suite:
mix testGenerate documentation:
mix docsCopyright (c) 2025 nshkrdotcom
This project is licensed under the MIT License - see the LICENSE file for details.