Skip to content
Konstera
Capability catalogue
evidenceread

db.jobs.history

Get SQL Agent job history

Recent SQL Agent job runs and step results from msdb (newest first, at most 200). Needs SQLAgentReaderRole in msdb; not available on Azure SQL Database. Internal evidence: for understanding only, never quoted.

Effect
read
Fanout
no
Cache TTL
none
Traits
internal_evidence, read_only

Request arguments

Passed as the args parameter to ctx.capability.call("db.jobs.history", …).

FieldTypeRequiredDescription
daysintegerno
default: 7 · min: 1 · max: 30
jobNamePatternstringnoLIKE pattern for the job name; default % (all jobs)

Response

Returned by ctx.capability.call("db.jobs.history", …).

Array; each element is an object with the following fields.

FieldTypeRequiredDescription
jobstringyes
stepstringyesStep name; (job outcome) for the overall result row
runAtstring | nullnoServer local time, ISO-8601 without offset
statusstringyes
enum: ["succeeded","failed","retry","canceled","in_progress","unknown"]
messagestring | nullnoCapped at 1000 characters
durationSecondsintegerno

Example call

From inside your agent's handle(). The kernel resolves db.jobs.history to the tenant's connector binding at invocation time.

response = await ctx.capability.call(
    "db.jobs.history",
    args={
        "days": 7,
        "jobNamePattern": "...",
    },
)

See SDK quickstart for the full agent handler template; code examples covers invocation patterns including fanout and error handling.