Launch Week 3: Five days of launches

Report Templates

Overview

The Confident AI SDK exposes every Report Template method on the platform. This page documents how to call these methods in all supported languages. See the introduction to install the SDK and set your API key.

Methods

List Report Templates

Lists the report templates in your Confident AI project one page at a time, oldest first. Retrieve a single template for its cadence and its sections.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.report_templates.list(page=1, page_size=25)

For async mode, call a_list and await it as shown below:

result = await client.report_templates.a_list(...)

Parameters

ParameterTypeDescription
pageOptional[int]The page to return. Defaults to 1.
page_sizeOptional[int]The number of results per page, at most 100. Defaults to 25.

Returns

This method returns an object of type ReportTemplateList.

Create Report Template

Creates a report template in your Confident AI project and returns its id. The description is the question the report answers; send templateSections to fix its structure, and a cadence to control when it generates. Without a cadence it repeats every 1 day.

from confident_ai import ConfidentAI
from confident_ai.report_templates import ReportTemplateSectionConfig
from confident_ai.report_templates import ReportTemplateSectionContent
from confident_ai.report_templates import ReportTemplateSectionSeverity
from confident_ai.report_templates import ReportTemplateSectionType
from confident_ai.common import ScheduleIntervalUnit
from confident_ai.common import ScheduleRecurrenceType

client = ConfidentAI()

result = client.report_templates.create(
    name="Weekly Health Check",
    description="Give me an overall health check for the last week: request volume, error rate, latency, total cost and user activity.",
    template_sections=[
        ReportTemplateSectionConfig(
            id="<REPORT-TEMPLATE-SECTION-ID>",
            type=ReportTemplateSectionType.CONTENT,
            heading="What's Failing",
            use_ai=True,
            prompt="Summarize the dominant failure modes in 2-4 sentences, citing error counts.",
            content=ReportTemplateSectionContent(
                text="Generated daily for the platform team.",
                severity=ReportTemplateSectionSeverity.INFO
            ),
            start_on_new_page=False
        )
    ],
    enabled=True,
    recurrence=ScheduleRecurrenceType.ONCE,
    repeat_every=1,
    repeat_unit=ScheduleIntervalUnit.MINUTE,
    start_at="2025-02-01T09:00:00+00:00",
    max_runs=12,
    end_at="2025-12-31T23:59:59+00:00",
)

For async mode, call a_create and await it as shown below:

result = await client.report_templates.a_create(...)

Parameters

ParameterTypeDescription
namestrRequired. The template's name, also used as the report's title.
descriptionOptional[str]The question the report should answer, written as a question. Supply this even when providing sections — it drives the single data retrieval that serves them all.
template_sectionsOptional[List[ReportTemplateSectionConfig]]The report's exact sections, in render order. Omit it to let the generator choose the structure from description. See ReportTemplateSectionConfig.
enabledOptional[bool]Whether to start generating on the schedule. Defaults to true; send false to create the template without scheduling it.
recurrenceOptional[ScheduleRecurrenceType]See ScheduleRecurrenceType.
repeat_everyOptional[int]How many repeatUnits apart the runs are, for an INTERVAL schedule. Send null to clear it.
repeat_unitOptional[ScheduleIntervalUnit]The unit repeatEvery counts, for an INTERVAL schedule. Send null to clear it. See ScheduleIntervalUnit.
start_atOptional[str]When the schedule first runs, as an ISO 8601 datetime. Send null to start it immediately.
max_runsOptional[int]How many times the schedule runs before it stops. Send null to let it run indefinitely.
end_atOptional[str]When the schedule stops running, as an ISO 8601 datetime. Send null to leave it open-ended.

Returns

This method returns an object of type ReportTemplateRef.

Get Report Template

Retrieves a report template by id, with its generation cadence and all of its section definitions.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.report_templates.get(
    report_template_id="<REPORT-TEMPLATE-ID>",
)

For async mode, call a_get and await it as shown below:

result = await client.report_templates.a_get(...)

Parameters

ParameterTypeDescription
report_template_idstrRequired. The id of the report template.

Returns

This method returns an object of type ReportTemplate.

Update Report Template

Updates a report template and returns it. Only the fields you send are changed, and templateSections replaces the whole list. Set enabled to false to pause generation, or send cadence fields to retime it.

from confident_ai import ConfidentAI
from confident_ai.report_templates import ReportTemplateSectionConfig
from confident_ai.report_templates import ReportTemplateSectionContent
from confident_ai.report_templates import ReportTemplateSectionSeverity
from confident_ai.report_templates import ReportTemplateSectionType
from confident_ai.common import ScheduleIntervalUnit
from confident_ai.common import ScheduleRecurrenceType

client = ConfidentAI()

result = client.report_templates.update(
    report_template_id="<REPORT-TEMPLATE-ID>",
    name="Weekly Production Health",
    description="How did production do this week compared with the week before?",
    template_sections=[
        ReportTemplateSectionConfig(
            id="<REPORT-TEMPLATE-SECTION-ID>",
            type=ReportTemplateSectionType.CONTENT,
            heading="What's Failing",
            use_ai=True,
            prompt="Summarize the dominant failure modes in 2-4 sentences, citing error counts.",
            content=ReportTemplateSectionContent(
                text="Generated daily for the platform team.",
                severity=ReportTemplateSectionSeverity.INFO
            ),
            start_on_new_page=False
        )
    ],
    enabled=False,
    recurrence=ScheduleRecurrenceType.ONCE,
    repeat_every=1,
    repeat_unit=ScheduleIntervalUnit.MINUTE,
    start_at="2025-02-01T09:00:00+00:00",
    max_runs=12,
    end_at="2025-12-31T23:59:59+00:00",
)

For async mode, call a_update and await it as shown below:

result = await client.report_templates.a_update(...)

Parameters

ParameterTypeDescription
report_template_idstrRequired. The id of the report template.
nameOptional[str]The template's new name, also used as the report's title.
descriptionOptional[str]The question the report should answer, which drives what data the generator retrieves. Send null to clear it.
template_sectionsOptional[List[ReportTemplateSectionConfig]]The report's exact sections, in render order. The list replaces the template's current sections, so a section you leave out is removed; omit the field to leave them alone. See ReportTemplateSectionConfig.
enabledOptional[bool]Whether scheduled generation runs. False pauses it while keeping past reports readable. A schedule that has hit its maxRuns or endAt can only be re-enabled by a request that also raises or clears them.
recurrenceOptional[ScheduleRecurrenceType]See ScheduleRecurrenceType.
repeat_everyOptional[int]How many repeatUnits apart the runs are, for an INTERVAL schedule. Send null to clear it.
repeat_unitOptional[ScheduleIntervalUnit]The unit repeatEvery counts, for an INTERVAL schedule. Send null to clear it. See ScheduleIntervalUnit.
start_atOptional[str]When the schedule first runs, as an ISO 8601 datetime. Send null to start it immediately.
max_runsOptional[int]How many times the schedule runs before it stops. Send null to let it run indefinitely.
end_atOptional[str]When the schedule stops running, as an ISO 8601 datetime. Send null to leave it open-ended.

Returns

This method returns an object of type ReportTemplate.

Delete Report Template

Permanently deletes a report template and the schedule that generates it. This cannot be undone, and every report it generated becomes unreachable — set enabled to false instead to pause generation while keeping past reports readable.

from confident_ai import ConfidentAI

client = ConfidentAI()

result = client.report_templates.delete(
    report_template_id="<REPORT-TEMPLATE-ID>",
)

For async mode, call a_delete and await it as shown below:

result = await client.report_templates.a_delete(...)

Parameters

ParameterTypeDescription
report_template_idstrRequired. The id of the report template.

Returns

This method returns an object of type ReportTemplateRef.

Types

ReportTemplate

A recurring report definition, generated on the schedule you set — every 1 day unless you say otherwise.

class ReportTemplate:
    id: str
    name: str
    description: Optional[str]
    type: Optional[ReportTemplateType]
    enabled: bool
    created_at: str = Field(alias="createdAt")
    schedule: Optional[ReportTemplateSchedule]
    template_sections: List[ReportTemplateSection] = Field(alias="templateSections")

idstrRequired

The id of the report template, generated by Confident AI.

Example: "<REPORT-TEMPLATE-ID>"

namestrRequired

The template's name, also used as the report's title.

Example: "Weekly Health Check"

descriptionOptional[str]Required

The question the generated report answers, which drives what data the generator retrieves.

Example: "Give me an overall health check for the last week: request volume, error rate, latency, total cost and user activity."

typeOptional[ReportTemplateType]Required

The kind of report this template generates.

See ReportTemplateType.

enabledboolRequired

Whether scheduled generation is running. A disabled template generates nothing.

Example: true

created_atstrRequired

When the report template was created.

Example: "2025-01-01T00:00:00+00:00"

scheduleOptional[ReportTemplateSchedule]Required

The template's generation cadence, including how many times it has run, or null when it has no schedule.

See ReportTemplateSchedule.

template_sectionsList[ReportTemplateSection]Required

The template's sections, in render order. Empty when the generator chooses the structure from description.

See ReportTemplateSection.

ReportTemplateList

One page of report templates, with the total across all pages.

class ReportTemplateList:
    report_templates: List[ReportTemplateSummary] = Field(alias="reportTemplates")
    total_report_templates: int = Field(alias="totalReportTemplates")
    page: int
    page_size: int = Field(alias="pageSize")

report_templatesList[ReportTemplateSummary]Required

The report templates for the current page, oldest first.

See ReportTemplateSummary.

total_report_templatesintRequired

The total number of report templates in this project.

Example: 3

pageintRequired

The page this response covers.

Example: 1

page_sizeintRequired

The number of report templates per page.

Example: 25

ReportTemplateRef

A reference to a report template by its id.

class ReportTemplateRef:
    id: str

idstrRequired

The id of the report template, generated by Confident AI.

Example: "<REPORT-TEMPLATE-ID>"

ReportTemplateSchedule

When a report template generates, and how far it has got: the cadence you set, plus the read-only progress against it.

class ReportTemplateSchedule:
    recurrence: ScheduleRecurrenceType
    repeat_every: Optional[int] = Field(alias="repeatEvery")
    repeat_unit: Optional[ScheduleIntervalUnit] = Field(alias="repeatUnit")
    start_at: Optional[str] = Field(alias="startAt")
    max_runs: Optional[int] = Field(alias="maxRuns")
    end_at: Optional[str] = Field(alias="endAt")
    run_count: int = Field(alias="runCount")
    last_run_at: Optional[str] = Field(alias="lastRunAt")

recurrenceScheduleRecurrenceTypeRequired

repeat_everyOptional[int]Required

How many repeatUnits pass between runs — the 2 in "every 2 weeks". Always set on an INTERVAL schedule, null on a ONCE one.

Example: 1

repeat_unitOptional[ScheduleIntervalUnit]Required

The unit repeatEvery counts in. Always set on an INTERVAL schedule, null on a ONCE one.

See ScheduleIntervalUnit.

start_atOptional[str]Required

When the first run was scheduled for, or null when it started immediately.

Example: "2025-01-08T09:00:00+00:00"

max_runsOptional[int]Required

The number of generations after which the schedule stops, or null for no cap.

Example: 12

end_atOptional[str]Required

The time after which the schedule stops, or null for no end date.

run_countintRequired

How many reports this template has generated, counted against maxRuns.

Example: 3

last_run_atOptional[str]Required

When the template last generated a report, or null when it never has.

Example: "2025-01-22T09:00:00+00:00"

ReportTemplateSection

A stored section of a report template.

class ReportTemplateSection:
    id: str
    type: ReportTemplateSectionType
    heading: Optional[str]
    order: int
    use_ai: bool = Field(alias="useAI")
    prompt: Optional[str]
    content: Optional[ReportTemplateSectionContent]
    start_on_new_page: bool = Field(alias="startOnNewPage")

idstrRequired

The id of the template section.

Example: "<REPORT-TEMPLATE-SECTION-ID>"

typeReportTemplateSectionTypeRequired

headingOptional[str]Required

The heading rendered above the section, or null when it has none.

Example: "What's Failing"

orderintRequired

The section's position in the report, starting at 0.

Example: 0

use_aiboolRequired

Whether the generator authors this section from prompt.

Example: true

promptOptional[str]Required

The directive handed to the generator for this section, or null when the section is hardcoded.

Example: "Summarize the dominant failure modes in 2-4 sentences, citing error counts."

contentOptional[ReportTemplateSectionContent]Required

The static content rendered for a hardcoded section, or null when the section is AI-authored.

See ReportTemplateSectionContent.

start_on_new_pageboolRequired

Whether the section starts on a new page in the exported report.

Example: false

ReportTemplateSectionConfig

One section of a report template. Either AI-authored (useAI true, with a prompt) or hardcoded (useAI false, with static content). STAT_CARDS, TABLE and GRAPH must be AI-authored; CONTENT and ADMONITION can be either. A section's position in templateSections sets the order it renders in.

class ReportTemplateSectionConfig:
    id: Optional[str] = None
    type: ReportTemplateSectionType
    heading: Optional[str] = None
    use_ai: Optional[bool] = Field(default=None, alias="useAI")
    prompt: Optional[str] = None
    content: Optional[ReportTemplateSectionContent] = None
    start_on_new_page: Optional[bool] = Field(default=None, alias="startOnNewPage")

idOptional[str]

The id of the section. Send the id a section was read back with to keep its creation time across a rewrite; omit it and Confident AI assigns one.

Example: "<REPORT-TEMPLATE-SECTION-ID>"

typeReportTemplateSectionTypeRequired

headingOptional[str]

The heading rendered above the section. Omit it for an unheaded section.

Example: "What's Failing"

use_aiOptional[bool]

Whether the generator authors this section from prompt. Defaults to false, which renders content verbatim instead.

Example: true

promptOptional[str]

Required when useAI is true: a single directive for what this section must cover.

Example: "Summarize the dominant failure modes in 2-4 sentences, citing error counts."

contentOptional[ReportTemplateSectionContent]

The static content of a hardcoded section. Required for a CONTENT section with useAI false, and ignored when useAI is true.

See ReportTemplateSectionContent.

start_on_new_pageOptional[bool]

Whether the section starts on a new page in the exported report. Defaults to false.

Example: false

ReportTemplateSectionContent

The static content of a hardcoded (non-AI) template section. Null for AI-authored sections, which are written by the generator from their prompt.

class ReportTemplateSectionContent:
    text: Optional[str] = None
    severity: Optional[ReportTemplateSectionSeverity] = None

textOptional[str]

The section's literal text, written verbatim into every generated report.

Example: "Generated daily for the platform team."

severityOptional[ReportTemplateSectionSeverity]

ADMONITION sections only: the callout style. Defaults to INFO when omitted.

See ReportTemplateSectionSeverity.

ReportTemplateSectionSeverity

The callout style of an ADMONITION section, from an informational note to a danger warning.

class ReportTemplateSectionSeverity(Enum):
    INFO = "INFO"
    SUCCESS = "SUCCESS"
    WARNING = "WARNING"
    DANGER = "DANGER"

INFO · SUCCESS · WARNING · DANGER

ReportTemplateSectionType

What a section renders as. STAT_CARDS, TABLE and GRAPH must be AI-authored; CONTENT and ADMONITION can be either AI-authored or hardcoded.

class ReportTemplateSectionType(Enum):
    CONTENT = "CONTENT"
    STAT_CARDS = "STAT_CARDS"
    TABLE = "TABLE"
    GRAPH = "GRAPH"
    ADMONITION = "ADMONITION"

CONTENT · STAT_CARDS · TABLE · GRAPH · ADMONITION

ReportTemplateSummary

A report template as it appears in a list. Retrieve one by id for its cadence and its sections.

class ReportTemplateSummary:
    id: str
    name: str
    description: Optional[str]
    type: Optional[ReportTemplateType]
    enabled: bool
    created_at: str = Field(alias="createdAt")

idstrRequired

The id of the report template, generated by Confident AI.

Example: "<REPORT-TEMPLATE-ID>"

namestrRequired

The template's name, also used as the report's title.

Example: "Weekly Health Check"

descriptionOptional[str]Required

The question the generated report answers, which drives what data the generator retrieves.

Example: "Give me an overall health check for the last week: request volume, error rate, latency, total cost and user activity."

typeOptional[ReportTemplateType]Required

The kind of report this template generates.

See ReportTemplateType.

enabledboolRequired

Whether scheduled generation is running. A disabled template generates nothing.

Example: true

created_atstrRequired

When the report template was created.

Example: "2025-01-01T00:00:00+00:00"

ReportTemplateType

The kind of report a template generates. Templates you create over the API generate executive reports; RISK_ASSESSMENT_REPORT belongs to the reports Confident AI generates for a risk assessment.

class ReportTemplateType(Enum):
    RISK_ASSESSMENT_REPORT = "RISK_ASSESSMENT_REPORT"
    EXECUTIVE_REPORT = "EXECUTIVE_REPORT"

RISK_ASSESSMENT_REPORT · EXECUTIVE_REPORT

ScheduleIntervalUnit

The unit repeatEvery counts for an INTERVAL schedule.

class ScheduleIntervalUnit(Enum):
    MINUTE = "MINUTE"
    HOUR = "HOUR"
    DAY = "DAY"
    WEEK = "WEEK"
    MONTH = "MONTH"

MINUTE · HOUR · DAY · WEEK · MONTH

ScheduleRecurrenceType

How often a schedule fires: ONCE runs a single time at startAt, INTERVAL repeats every repeatEvery repeatUnits.

class ScheduleRecurrenceType(Enum):
    ONCE = "ONCE"
    INTERVAL = "INTERVAL"

ONCE · INTERVAL

Building a production pipeline?Design a scalable API workflow for evals, datasets, traces, and promptsTalk to an engineer

Last updated on

Built byConfident AI