Class: HermesAgent::Client::Entities::Job

Inherits:
HermesAgent::Client::Entity show all
Defined in:
lib/hermes_agent/client/entities/job.rb

Overview

A scheduled background job from the Jobs API (/api/jobs): a cron-like recurring task, a one-shot deferred task, or a watchdog script. The same object is returned by create, get, list, update, pause, resume, and trigger.

Note the timestamp fields (#created_at / #next_run_at / #last_run_at / #paused_at) are ISO-8601 strings with an offset, not the epoch floats the runs and responses APIs use; they are exposed verbatim with no Time parsing. The override slots (#model / #provider / #base_url / #workdir / #profile / #context_from) are read-only here — the HTTP API ignores them on create/update, so they are surfaced as readers but are not create/update parameters.

Field readers are best-effort; HermesAgent::Client::Entity#to_h remains the source of truth.

Instance Method Summary collapse

Methods inherited from HermesAgent::Client::Entity

#==, #[], #eql?, #hash, #to_h

Instance Method Details

#base_urlString?

The per-job base URL override. Read-only via this API; nil = the profile's configured base URL.

Returns:

  • (String, nil)


200
201
202
# File 'lib/hermes_agent/client/entities/job.rb', line 200

def base_url
  self["base_url"]
end

#context_fromString?

The source to pull run context from. Read-only via this API.

Returns:

  • (String, nil)


227
228
229
# File 'lib/hermes_agent/client/entities/job.rb', line 227

def context_from
  self["context_from"]
end

#created_atString?

When the job was created, as an ISO-8601 string with offset.

Returns:

  • (String, nil)


296
297
298
# File 'lib/hermes_agent/client/entities/job.rb', line 296

def created_at
  self["created_at"]
end

#deliverString?

The delivery target, e.g. "local", "origin", "telegram", or "platform:chat_id". Defaults to "local".

Returns:

  • (String, nil)


350
351
352
# File 'lib/hermes_agent/client/entities/job.rb', line 350

def deliver
  self["deliver"]
end

#enabled?boolean?

Whether the job is enabled (false while paused).

Returns:

  • (boolean, nil)


262
263
264
# File 'lib/hermes_agent/client/entities/job.rb', line 262

def enabled?
  self["enabled"]
end

#enabled_toolsetsObject?

The toolset allowlist, passed through raw; nil = the default set. Expected to be a plain array of names if populated (never observed), so it is not wrapped.

Returns:

  • (Object, nil)


370
371
372
# File 'lib/hermes_agent/client/entities/job.rb', line 370

def enabled_toolsets
  self["enabled_toolsets"]
end

#idString?

The job id: 12 lowercase hex characters (no run_-style prefix).

Returns:

  • (String, nil)


138
139
140
# File 'lib/hermes_agent/client/entities/job.rb', line 138

def id
  self["id"]
end

#last_delivery_errorString?

The error detail from the last delivery attempt, or nil on success.

Returns:

  • (String, nil)


341
342
343
# File 'lib/hermes_agent/client/entities/job.rb', line 341

def last_delivery_error
  self["last_delivery_error"]
end

#last_errorString?

The error detail from the last execution when #last_status is "error", or nil on success. The message is prefixed with the failing exception class, e.g. "RuntimeError: Gemini HTTP 400 …".

Returns:

  • (String, nil)


333
334
335
# File 'lib/hermes_agent/client/entities/job.rb', line 333

def last_error
  self["last_error"]
end

#last_run_atString?

When the job last ran, as an ISO-8601 string with offset; nil until the first execution.

Returns:

  • (String, nil)


314
315
316
# File 'lib/hermes_agent/client/entities/job.rb', line 314

def last_run_at
  self["last_run_at"]
end

#last_statusString?

The outcome of the most recent run: "ok" on success or "error" when the run failed; nil before the first run.

Returns:

  • (String, nil)


323
324
325
# File 'lib/hermes_agent/client/entities/job.rb', line 323

def last_status
  self["last_status"]
end

#modelString?

The per-job model override. Read-only via this API (ignored on create/update); nil means the profile's configured model is used.

Returns:

  • (String, nil)


182
183
184
# File 'lib/hermes_agent/client/entities/job.rb', line 182

def model
  self["model"]
end

#nameString?

The human-friendly job name (required on create).

Returns:

  • (String, nil)


146
147
148
# File 'lib/hermes_agent/client/entities/job.rb', line 146

def name
  self["name"]
end

#next_run_atString?

When the job is next scheduled to run, as an ISO-8601 string with offset.

Returns:

  • (String, nil)


305
306
307
# File 'lib/hermes_agent/client/entities/job.rb', line 305

def next_run_at
  self["next_run_at"]
end

#no_agent?boolean

Whether the LLM is skipped entirely: the #script runs and its stdout is delivered verbatim (the watchdog pattern). Defaults to false (the agent runs) when the field is absent.

Returns:

  • (boolean)


219
220
221
# File 'lib/hermes_agent/client/entities/job.rb', line 219

def no_agent?
  !!self["no_agent"]
end

#originObject?

The originating channel info (for deliver: "origin"), passed through raw; nil for locally created jobs. Its populated shape was never observed, so it is not wrapped — use HermesAgent::Client::Entity#to_h / HermesAgent::Client::Entity#[] if a shape appears.

Returns:

  • (Object, nil)


360
361
362
# File 'lib/hermes_agent/client/entities/job.rb', line 360

def origin
  self["origin"]
end

#paused_atString?

When the job was paused, as an ISO-8601 string; nil when not paused.

Returns:

  • (String, nil)


280
281
282
# File 'lib/hermes_agent/client/entities/job.rb', line 280

def paused_at
  self["paused_at"]
end

#paused_reasonString?

The optional reason the job was paused; nil for a manual pause.

Returns:

  • (String, nil)


288
289
290
# File 'lib/hermes_agent/client/entities/job.rb', line 288

def paused_reason
  self["paused_reason"]
end

#profileString?

The Hermes profile the job runs under. Read-only via this API; nil = the scheduler's existing profile.

Returns:

  • (String, nil)


388
389
390
# File 'lib/hermes_agent/client/entities/job.rb', line 388

def profile
  self["profile"]
end

#promptString?

The task instruction given to the agent each run. nil for a no_agent script job, which needs none.

Returns:

  • (String, nil)


155
156
157
# File 'lib/hermes_agent/client/entities/job.rb', line 155

def prompt
  self["prompt"]
end

#providerString?

The per-job provider override. Read-only via this API; nil = the profile's configured provider.

Returns:

  • (String, nil)


191
192
193
# File 'lib/hermes_agent/client/entities/job.rb', line 191

def provider
  self["provider"]
end

#repeatJobRepeat?

The repeat policy, wrapped in a HermesAgent::Client::Entities::JobRepeat. Returns nil when absent.

Returns:



253
254
255
256
# File 'lib/hermes_agent/client/entities/job.rb', line 253

def repeat
  raw = self["repeat"]
  raw.is_a?(::Hash) ? JobRepeat.new(raw) : nil
end

#scheduleJobSchedule?

The schedule, wrapped in a HermesAgent::Client::Entities::JobSchedule. Returns nil when absent.

Returns:



235
236
237
238
# File 'lib/hermes_agent/client/entities/job.rb', line 235

def schedule
  raw = self["schedule"]
  raw.is_a?(::Hash) ? JobSchedule.new(raw) : nil
end

#schedule_displayString?

A human-readable rendering of the schedule (mirrors HermesAgent::Client::Entities::JobSchedule#display).

Returns:

  • (String, nil)


245
246
247
# File 'lib/hermes_agent/client/entities/job.rb', line 245

def schedule_display
  self["schedule_display"]
end

#scriptString?

The path of a script (under ~/.hermes/scripts/) run each execution; by default its stdout is injected into the agent prompt.

Returns:

  • (String, nil)


209
210
211
# File 'lib/hermes_agent/client/entities/job.rb', line 209

def script
  self["script"]
end

#skillString?

The single attached skill (a scalar slot separate from #skills); nil when unused.

Returns:

  • (String, nil)


173
174
175
# File 'lib/hermes_agent/client/entities/job.rb', line 173

def skill
  self["skill"]
end

#skillsArray<String>?

The attached skill names. The singular #skill is a separate scalar slot.

Returns:

  • (Array<String>, nil)


164
165
166
# File 'lib/hermes_agent/client/entities/job.rb', line 164

def skills
  self["skills"]
end

#stateString?

The lifecycle state, e.g. "scheduled" or "paused". (There is no terminal state — an exhausted one-shot or capped job is deleted by the server.)

Returns:

  • (String, nil)


272
273
274
# File 'lib/hermes_agent/client/entities/job.rb', line 272

def state
  self["state"]
end

#workdirString?

The absolute working directory for the run. Read-only via this API; nil = no project context.

Returns:

  • (String, nil)


379
380
381
# File 'lib/hermes_agent/client/entities/job.rb', line 379

def workdir
  self["workdir"]
end