# Export Formats

This page documents the file format for each resource export type. All JSON exports include a standard envelope with export_type, software_version, account_id, and exported_at fields. JSONL exports contain one record per line. CSV exports use the same fields as column headers.

Export files can be downloaded from the UI or via the [API](https://seclai.com/docs/api-introduction) and [MCP tools](https://seclai.com/docs/mcp).

## Agent Definition (single agent)

A standalone, portable snapshot of one agent — workflow, trigger, alerts, evaluation criteria, governance policies, and the resolved dependency manifest. Different in shape from the bulk resource exports below: there's no top-level `export_type` or `account_id` envelope; the snapshot is rooted at the `agent` object with sibling sections for the trigger and extras.

This is the format produced by `GET /api/agents/{id}/export` and the `export_agent` MCP tool, and consumed by the matching `agent_definition` field on the create/update endpoints. See the [Agents documentation](https://seclai.com/docs/agents#exporting-agents) for end-to-end usage and the [Importing Agents](https://seclai.com/docs/agents#importing-agents) section for round-trip behavior.

**Formats:** JSON only.

### Top-level shape

| Field                   | Type           | Description                                                                                                                                                                       |
| ----------------------- | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **export_version**      | string         | Schema version of the export format. Currently `"2"`. Forward-compatible: imports ignore unknown top-level fields, so older Seclai deployments can usually consume newer exports. |
| **exported_at**         | string         | ISO-8601 timestamp of when the export was generated.                                                                                                                              |
| **software_version**    | string         | Application version that produced this export.                                                                                                                                    |
| **agent**               | object         | Agent metadata + the full step workflow. See [Agent block](#agent-definition-agent).                                                                                              |
| **trigger**             | object \| null | Trigger config (input template, content type, schedules). See [Trigger](#agent-definition-trigger).                                                                               |
| **alert_configs**       | array \| null  | Alert configurations attached to the agent.                                                                                                                                       |
| **evaluation_criteria** | array \| null  | Per-step evaluation criteria.                                                                                                                                                     |
| **governance_policies** | array \| null  | Agent-scoped governance policies, including KB attachment names.                                                                                                                  |
| **dependencies**        | object \| null | Resolved manifest mapping every external UUID referenced in the workflow to a human-readable name (and email for users, source_count for KBs).                                    |
| **solutions**           | array \| null  | Solutions the agent belonged to in the source account. On import, matched by name in the target account; unmatched names are skipped with an `import_warnings` entry.             |

### Agent block

| Field                                   | Type           | Description                                                                              |
| --------------------------------------- | -------------- | ---------------------------------------------------------------------------------------- |
| **name**                                | string         | Agent name.                                                                              |
| **description**                         | string \| null | Agent description.                                                                       |
| **definition**                          | object         | Full workflow definition: `name`, `description`, `tags`, and the recursive `steps` tree. |
| **schema_version**                      | string         | Workflow schema version.                                                                 |
| **default_evaluation_tier**             | string \| null | `fast`, `balanced`, `thorough`, or null (use account default).                           |
| **evaluation_mode**                     | string \| null | `output_expectation`, `eval_and_retry`, or `sample_and_flag`.                            |
| **sampling_config**                     | object \| null | Per-rule sampling configuration when `evaluation_mode = "sample_and_flag"`.              |
| **max_retries**                         | int            | Retry budget for `eval_and_retry` mode.                                                  |
| **retry_on_failure**                    | bool           | Whether evaluation failures trigger a retry.                                             |
| **prompt_model_auto_upgrade_strategy**  | string         | `none`, `early_adopter`, `middle_of_road`, or `cautious_adopter`.                        |
| **prompt_model_auto_rollback_enabled**  | bool           | Whether automatic model rollback is enabled.                                             |
| **prompt_model_auto_rollback_triggers** | array \| null  | Failure signals that fire rollback (e.g. `agent_eval_fail`, `governance_block`).         |
| **created_at**, **updated_at**          | string         | ISO-8601 timestamps.                                                                     |

### Trigger block

| Field                  | Type           | Description                                                                                                                                                                                 |
| ---------------------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **trigger_type**       | string         | One of `dynamic_input`, `template_input`, `content_added`, `content_updated`, `agent_run_completed`.                                                                                        |
| **name**               | string \| null | Display name for template_input triggers.                                                                                                                                                   |
| **input**              | string \| null | Input template (for `template_input`) or default input.                                                                                                                                     |
| **input_content_type** | string \| null | MIME type of the input.                                                                                                                                                                     |
| **allow_empty_input**  | bool           | Whether an empty input is allowed at run time.                                                                                                                                              |
| **default_input**      | string \| null | Default value when no input is supplied.                                                                                                                                                    |
| **metadata\_**         | object \| null | Free-form metadata attached to the trigger.                                                                                                                                                 |
| **knowledge_base_id**  | string \| null | UUID of the linked KB for content-triggered agents (matched by name on import via `dependencies.knowledge_bases`).                                                                          |
| **schedules**          | array \| null  | One entry per schedule (only valid on `template_input` triggers). Each: `frequency`, `repeat_interval`, `day_of_week`, `day_of_month`, `hour_of_day`, `minute_of_hour`, `weekday_of_month`. |

### Extras and dependencies

The remaining sections (`alert_configs`, `evaluation_criteria`, `governance_policies`, `dependencies`, `solutions`) carry agent extras and the resolved cross-account name lookup table. The full schema is enforced by the import validator at [src/api/services/agent_definition_import.py](https://github.com/anthropics/seclai/blob/main/backend/api/src/api/services/agent_definition_import.py); a 422 response from the create/update endpoints lists any per-field problems with line/column anchors against a canonical pretty-printed echo.

**On a cross-account import**, items that don't resolve in the target account are silently skipped (never error) and reported in the response's `import_warnings` array — one entry per skipped item with `category`, `message`, and category-specific `details`. The frontend modal lists these inline; the API and MCP responses include them in the JSON body.

## Governance Policies

Exports all governance policies for the account, including scope assignments, thresholds, and linked knowledge bases.

**Formats:** JSON, JSONL.

**Available filters:**

- category — Policy category (e.g. content_safety, pii).
- enabled — Only enabled (true) or disabled (false) policies.
- account_wide_only — Exclude agent/source-scoped overrides.

### Envelope Fields

| Field                | Type                            | Description                                                          |
| -------------------- | ------------------------------- | -------------------------------------------------------------------- |
| **export_type**      | string                          | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string                          | Application version that produced this export.                       |
| **account_id**       | string                          | UUID of the account that owns the exported data.                     |
| **exported_at**      | string                          | ISO-8601 timestamp of when the export was generated.                 |
| **policy_count**     | integer                         | Total number of policies in this export.                             |
| **policies**         | array of GovernancePolicyRecord | Array of policy records.                                             |

### Record Fields

| Field                    | Type                    | Description                                                                                           |
| ------------------------ | ----------------------- | ----------------------------------------------------------------------------------------------------- |
| **id**                   | string                  | UUID of the policy.                                                                                   |
| **policy_name**          | string                  | Human-readable policy name.                                                                           |
| **policy_text**          | string                  | Full policy text evaluated by the AI screener.                                                        |
| **category**             | string or null          | Policy category (content_safety, pii, bias, legal, brand).                                            |
| **enabled**              | boolean                 | Whether the policy is currently active.                                                               |
| **flag_threshold**       | number                  | Score at or above which content is flagged for review (0.0–1.0).                                      |
| **block_threshold**      | number                  | Score at or above which content is blocked (0.0–1.0).                                                 |
| **review_input**         | boolean                 | Whether this policy screens agent inputs.                                                             |
| **review_output**        | boolean                 | Whether this policy screens agent/step outputs.                                                       |
| **enforcement_level**    | string or null          | How child scopes can modify this policy (flexible, required, locked).                                 |
| **inheritance_mode**     | string or null          | How a scoped policy relates to its parent (inherit, merge, disable). Null for account-level policies. |
| **knowledge_base_names** | array of string or null | Names of linked knowledge bases used for evidence-based evaluation.                                   |
| **agent_id**             | string or null          | UUID of the agent this policy is scoped to, or null for account-wide.                                 |
| **agent_step_id**        | string or null          | Agent step ID this policy is scoped to.                                                               |
| **source_connection_id** | string or null          | UUID of the source connection this policy is scoped to.                                               |
| **created_at**           | string                  | ISO-8601 creation timestamp.                                                                          |
| **updated_at**           | string                  | ISO-8601 last-update timestamp.                                                                       |

---

## Governance Evaluations

Exports governance evaluation records — the screening results generated when content is checked against governance policies.

**Formats:** JSON, JSONL, CSV.

**Available filters:**

- agent_id — Scope to a specific agent.
- source_connection_id — Scope to a specific content source.
- policy_id — Filter by governance policy.
- verdict — pass, flag, or block.
- screening_point — source_content, agent_input, step_output, or policy_test.
- unresolved_only — Only unresolved evaluations.

### Envelope Fields

| Field                | Type                          | Description                                                          |
| -------------------- | ----------------------------- | -------------------------------------------------------------------- |
| **export_type**      | string                        | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string                        | Application version that produced this export.                       |
| **account_id**       | string                        | UUID of the account that owns the exported data.                     |
| **exported_at**      | string                        | ISO-8601 timestamp of when the export was generated.                 |
| **item_count**       | integer                       | Total number of evaluation records in this export.                   |
| **items**            | array of GovernanceEvalRecord | Array of evaluation records.                                         |

### Record Fields

| Field                    | Type           | Description                                                                            |
| ------------------------ | -------------- | -------------------------------------------------------------------------------------- |
| **id**                   | string         | UUID of the evaluation.                                                                |
| **policy_id**            | string         | UUID of the governance policy that was evaluated.                                      |
| **policy_name**          | string or null | Human-readable name of the policy.                                                     |
| **screening_point**      | string         | Where the evaluation occurred (source_content, agent_input, step_output, policy_test). |
| **verdict**              | string         | Evaluation verdict (pass, flag, block).                                                |
| **score**                | number         | AI confidence score (0.0–1.0).                                                         |
| **flag_threshold_used**  | number         | Flag threshold applied for this evaluation.                                            |
| **block_threshold_used** | number         | Block threshold applied for this evaluation.                                           |
| **explanation**          | string or null | AI-generated explanation of why the content matched (or didn't match) the policy.      |
| **content_excerpt**      | string or null | Excerpt of the evaluated content.                                                      |
| **agent_id**             | string or null | UUID of the agent (if the evaluation was on agent input/output).                       |
| **agent_run_id**         | string or null | UUID of the agent run.                                                                 |
| **source_connection_id** | string or null | UUID of the source connection (if the evaluation was on source content).               |
| **content_version_id**   | string or null | UUID of the content version that was evaluated.                                        |
| **resolved_at**          | string or null | ISO-8601 timestamp when the evaluation was resolved, or null.                          |
| **resolved_by**          | string or null | UUID of the user who resolved the evaluation.                                          |
| **resolution_note**      | string or null | Note left by the reviewer when resolving.                                              |
| **created_at**           | string         | ISO-8601 creation timestamp.                                                           |

---

## Knowledge Base

Exports a knowledge base with all linked sources and their content items, including full text.

**Formats:** JSON only (nested structure).

**Available filters:**

- from_date — Only content published after this ISO-8601 date.
- to_date — Only content published before this ISO-8601 date.

### Envelope Fields

| Field                   | Type                    | Description                                                          |
| ----------------------- | ----------------------- | -------------------------------------------------------------------- |
| **export_type**         | string                  | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version**    | string                  | Application version that produced this export.                       |
| **account_id**          | string                  | UUID of the account that owns the exported data.                     |
| **exported_at**         | string                  | ISO-8601 timestamp of when the export was generated.                 |
| **knowledge_base**      | KBMetadata              | Knowledge base configuration.                                        |
| **source_count**        | integer                 | Number of content sources.                                           |
| **total_content_items** | integer                 | Total content items across all sources.                              |
| **sources**             | array of KBSourceRecord | Array of sources with content items.                                 |

### Knowledge base metadata

| Field                       | Type            | Description                                     |
| --------------------------- | --------------- | ----------------------------------------------- |
| **id**                      | string          | UUID of the knowledge base.                     |
| **name**                    | string          | Knowledge base name.                            |
| **description**             | string or null  | Optional description.                           |
| **reranker_model**          | string or null  | Reranker model used for search result scoring.  |
| **default_top_n**           | integer or null | Maximum results from the initial vector search. |
| **default_top_k**           | integer or null | Results kept after reranking.                   |
| **default_score_threshold** | number or null  | Minimum relevance score for results (0.0–1.0).  |
| **created_at**              | string or null  | ISO-8601 creation timestamp.                    |
| **updated_at**              | string or null  | ISO-8601 last-update timestamp.                 |

### Source record

| Field                    | Type                   | Description                               |
| ------------------------ | ---------------------- | ----------------------------------------- |
| **source_connection_id** | string                 | UUID of the source connection.            |
| **source_name**          | string or null         | Human-readable source name.               |
| **source_url**           | string or null         | The source's URL (RSS feed or website).   |
| **polling**              | string or null         | Polling frequency (e.g. hourly, daily).   |
| **polling_action**       | string or null         | What to do on poll (add, replace).        |
| **polling_max_items**    | integer or null        | Maximum items to fetch per poll.          |
| **seed**                 | string or null         | Seed strategy for initial content.        |
| **retention_days**       | integer or null        | Content retention period in days.         |
| **crawl_limit**          | integer or null        | Maximum pages to crawl (websites only).   |
| **crawl_depth**          | integer or null        | Maximum crawl depth (websites only).      |
| **content_item_count**   | integer                | Number of content items from this source. |
| **content_items**        | array of KBContentItem | Array of content items.                   |

### Content item

| Field            | Type            | Description                                 |
| ---------------- | --------------- | ------------------------------------------- |
| **id**           | string          | UUID of the content version.                |
| **title**        | string or null  | Content title (e.g. article headline).      |
| **text**         | string or null  | Full text content (read from storage).      |
| **url**          | string or null  | Source URL of the content item.             |
| **status**       | string or null  | Indexing status (indexed, pending, failed). |
| **word_count**   | integer or null | Number of words in the content.             |
| **token_count**  | integer or null | Number of tokens in the content.            |
| **published_at** | string or null  | ISO-8601 publication timestamp.             |
| **created_at**   | string or null  | ISO-8601 creation timestamp.                |

---

## Memory Bank

Exports a memory bank with its configuration (compaction settings, embedding config) and all entries.

**Formats:** JSON only (nested structure).

### Envelope Fields

| Field                | Type                     | Description                                                          |
| -------------------- | ------------------------ | -------------------------------------------------------------------- |
| **export_type**      | string                   | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string                   | Application version that produced this export.                       |
| **account_id**       | string                   | UUID of the account that owns the exported data.                     |
| **exported_at**      | string                   | ISO-8601 timestamp of when the export was generated.                 |
| **memory_bank**      | MemoryBankMetadata       | Memory bank configuration.                                           |
| **entry_count**      | integer                  | Total number of entries.                                             |
| **entries**          | array of MemoryBankEntry | Array of memory bank entries.                                        |

### Memory bank metadata

| Field                 | Type            | Description                                                   |
| --------------------- | --------------- | ------------------------------------------------------------- |
| **id**                | string          | UUID of the memory bank.                                      |
| **name**              | string          | Memory bank name.                                             |
| **description**       | string or null  | Optional description.                                         |
| **type**              | string or null  | Bank type (conversation or general).                          |
| **mode**              | string or null  | Embedding mode (fast_cheap, balanced, slow_thorough, custom). |
| **compaction_prompt** | string or null  | Prompt used to summarize entries during compaction.           |
| **max_age_days**      | integer or null | Compaction trigger: compact entries older than this.          |
| **max_size_tokens**   | integer or null | Compaction trigger: compact when total tokens exceed this.    |
| **max_turns**         | integer or null | Compaction trigger: compact when entry count exceeds this.    |
| **embedding_model**   | string or null  | Embedding model identifier.                                   |
| **dimensions**        | integer or null | Vector embedding dimensions.                                  |
| **chunk_size**        | integer or null | Text chunk size for embedding.                                |
| **chunk_overlap**     | integer or null | Overlap between text chunks.                                  |
| **created_at**        | string or null  | ISO-8601 creation timestamp.                                  |
| **updated_at**        | string or null  | ISO-8601 last-update timestamp.                               |

### Entry record

| Field                | Type           | Description                                                                   |
| -------------------- | -------------- | ----------------------------------------------------------------------------- |
| **id**               | string         | UUID of the content version.                                                  |
| **title**            | string or null | Entry title.                                                                  |
| **text**             | string or null | Full text content.                                                            |
| **published_at**     | string or null | ISO-8601 publication timestamp.                                               |
| **created_at**       | string or null | ISO-8601 creation timestamp.                                                  |
| **metadata**         | object or null | Source-connection metadata (may include key, speaker for conversation banks). |
| **content_metadata** | object or null | Content-version metadata.                                                     |

---

## Solution

Exports a solution with all linked agents, knowledge bases, content sources, and memory banks. Optionally includes full content.

**Formats:** JSON only (nested structure).

**Available filters:**

- include_content — When true, embeds full content items for sources and memory bank entries alongside the resource metadata. Default false (configuration only).

### Envelope Fields

| Field                  | Type                              | Description                                                          |
| ---------------------- | --------------------------------- | -------------------------------------------------------------------- |
| **export_type**        | string                            | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version**   | string                            | Application version that produced this export.                       |
| **account_id**         | string                            | UUID of the account that owns the exported data.                     |
| **exported_at**        | string                            | ISO-8601 timestamp of when the export was generated.                 |
| **solution**           | SolutionMetadata                  | Solution configuration.                                              |
| **agents**             | array of SolutionAgentRecord      | Agents in the solution.                                              |
| **knowledge_bases**    | array of SolutionKBRecord         | Knowledge bases in the solution.                                     |
| **source_connections** | array of SolutionSourceRecord     | Content sources in the solution.                                     |
| **memory_banks**       | array of SolutionMemoryBankRecord | Memory banks in the solution.                                        |

### Solution metadata

| Field           | Type           | Description                     |
| --------------- | -------------- | ------------------------------- |
| **id**          | string         | UUID of the solution.           |
| **name**        | string         | Solution name.                  |
| **description** | string or null | Description.                    |
| **created_at**  | string or null | ISO-8601 creation timestamp.    |
| **updated_at**  | string or null | ISO-8601 last-update timestamp. |

### Agent record

| Field                       | Type            | Description                         |
| --------------------------- | --------------- | ----------------------------------- |
| **id**                      | string          | UUID of the agent.                  |
| **name**                    | string          | Agent name.                         |
| **description**             | string or null  | Agent description.                  |
| **evaluation_mode**         | string or null  | Evaluation mode (if configured).    |
| **default_evaluation_tier** | string or null  | Default governance evaluation tier. |
| **max_retries**             | integer or null | Maximum evaluation retries.         |
| **created_at**              | string or null  | ISO-8601 creation timestamp.        |
| **updated_at**              | string or null  | ISO-8601 last-update timestamp.     |

### Knowledge base record

| Field                       | Type            | Description                        |
| --------------------------- | --------------- | ---------------------------------- |
| **id**                      | string          | UUID of the knowledge base.        |
| **name**                    | string          | Knowledge base name.               |
| **description**             | string or null  | Description.                       |
| **reranker_model**          | string or null  | Reranker model.                    |
| **default_top_n**           | integer or null | Top N initial search results.      |
| **default_top_k**           | integer or null | Top K after reranking.             |
| **default_score_threshold** | number or null  | Minimum relevance score (0.0–1.0). |
| **created_at**              | string or null  | ISO-8601 creation timestamp.       |
| **updated_at**              | string or null  | ISO-8601 last-update timestamp.    |

### Source connection record

| Field                 | Type                    | Description                                                                                          |
| --------------------- | ----------------------- | ---------------------------------------------------------------------------------------------------- |
| **id**                | string                  | UUID of the source connection.                                                                       |
| **name**              | string or null          | Source name.                                                                                         |
| **source_url**        | string or null          | Source URL.                                                                                          |
| **polling**           | string or null          | Polling frequency.                                                                                   |
| **polling_action**    | string or null          | Polling action.                                                                                      |
| **polling_max_items** | integer or null         | Maximum items per poll.                                                                              |
| **seed**              | string or null          | Seed strategy.                                                                                       |
| **retention_days**    | integer or null         | Retention period in days.                                                                            |
| **crawl_limit**       | integer or null         | Maximum pages to crawl.                                                                              |
| **crawl_depth**       | integer or null         | Maximum crawl depth.                                                                                 |
| **created_at**        | string or null          | ISO-8601 creation timestamp.                                                                         |
| **updated_at**        | string or null          | ISO-8601 last-update timestamp.                                                                      |
| **content_items**     | array of object or null | Content items (only when include_content is true). Each item has id, title, text, url, published_at. |

### Memory bank record

| Field                 | Type                    | Description                                                                                                                   |
| --------------------- | ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| **id**                | string                  | UUID of the memory bank.                                                                                                      |
| **name**              | string                  | Memory bank name.                                                                                                             |
| **description**       | string or null          | Description.                                                                                                                  |
| **type**              | string or null          | Bank type (conversation or general).                                                                                          |
| **mode**              | string or null          | Embedding mode.                                                                                                               |
| **compaction_prompt** | string or null          | Compaction prompt.                                                                                                            |
| **max_age_days**      | integer or null         | Compaction trigger: max age in days.                                                                                          |
| **max_size_tokens**   | integer or null         | Compaction trigger: max tokens.                                                                                               |
| **max_turns**         | integer or null         | Compaction trigger: max turns.                                                                                                |
| **embedding_model**   | string or null          | Embedding model.                                                                                                              |
| **dimensions**        | integer or null         | Vector dimensions.                                                                                                            |
| **chunk_size**        | integer or null         | Chunk size.                                                                                                                   |
| **chunk_overlap**     | integer or null         | Chunk overlap.                                                                                                                |
| **created_at**        | string or null          | ISO-8601 creation timestamp.                                                                                                  |
| **updated_at**        | string or null          | ISO-8601 last-update timestamp.                                                                                               |
| **entries**           | array of object or null | Memory bank entries (only when include_content is true). Each entry has id, title, text, published_at, and optional metadata. |

---

## Agent Traces

Exports agent run traces with step-level execution detail, including inputs, outputs, attempts, timing, and error information.

**Formats:** JSON, JSONL.

**Available filters:**

- status — Filter runs by status (e.g. completed, failed).
- limit — Maximum number of runs to export.
- include_step_io — Include step input/output content (default true).

### Envelope Fields

| Field                | Type                      | Description                                                          |
| -------------------- | ------------------------- | -------------------------------------------------------------------- |
| **export_type**      | string                    | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string                    | Application version that produced this export.                       |
| **account_id**       | string                    | UUID of the account that owns the exported data.                     |
| **exported_at**      | string                    | ISO-8601 timestamp of when the export was generated.                 |
| **item_count**       | integer                   | Total number of agent run traces.                                    |
| **items**            | array of AgentTraceRecord | Array of agent run traces.                                           |

### Record Fields

| Field           | Type                        | Description                                          |
| --------------- | --------------------------- | ---------------------------------------------------- |
| **id**          | string                      | UUID of the agent run.                               |
| **status**      | string or null              | Run status (completed, failed, pending, processing). |
| **error_count** | integer or null             | Total errors across all steps.                       |
| **priority**    | integer or null             | Run priority.                                        |
| **call_depth**  | integer or null             | Nesting depth for sub-agent calls.                   |
| **created_at**  | string or null              | ISO-8601 creation timestamp.                         |
| **updated_at**  | string or null              | ISO-8601 last-update timestamp.                      |
| **step_count**  | integer                     | Number of step runs.                                 |
| **steps**       | array of AgentStepRunRecord | Step-level execution records.                        |
| **usages**      | array of object             | Credit usage records for this run.                   |

### Step run record

| Field                   | Type                      | Description                                         |
| ----------------------- | ------------------------- | --------------------------------------------------- |
| **id**                  | string                    | UUID of the step run.                               |
| **step_id**             | string                    | Step identifier within the agent definition.        |
| **step_type**           | string or null            | Step type (e.g. prompt_call, retrieval, gate).      |
| **status**              | string or null            | Step run status (completed, failed, pending).       |
| **error_count**         | integer or null           | Number of errors encountered.                       |
| **input_checksum**      | string or null            | Checksum of the step input.                         |
| **output_content_type** | string or null            | MIME type of the step output.                       |
| **created_at**          | string or null            | ISO-8601 creation timestamp.                        |
| **attempts**            | array of AgentStepAttempt | Execution attempts for this step.                   |
| **input**               | string or null            | Step input content (when include_step_io is true).  |
| **output**              | string or null            | Step output content (when include_step_io is true). |

### Step attempt record

| Field           | Type           | Description                         |
| --------------- | -------------- | ----------------------------------- |
| **id**          | string         | UUID of the attempt.                |
| **status**      | string or null | Attempt status (completed, failed). |
| **started_at**  | string or null | ISO-8601 start timestamp.           |
| **ended_at**    | string or null | ISO-8601 end timestamp.             |
| **duration**    | number or null | Duration in seconds.                |
| **error**       | string or null | Error message (if failed).          |
| **cache_stats** | object or null | Cache statistics for this attempt.  |

---

## Agent Evaluations

Exports agent evaluation results with criteria metadata. Each record joins a criteria definition to its evaluation result.

**Formats:** JSON, JSONL, CSV.

**Available filters:**

- criteria_id — Export results for a single criteria.
- status — Filter results by status (passed, failed, error).

### Envelope Fields

| Field                | Type                     | Description                                                          |
| -------------------- | ------------------------ | -------------------------------------------------------------------- |
| **export_type**      | string                   | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string                   | Application version that produced this export.                       |
| **account_id**       | string                   | UUID of the account that owns the exported data.                     |
| **exported_at**      | string                   | ISO-8601 timestamp of when the export was generated.                 |
| **item_count**       | integer                  | Total number of evaluation results.                                  |
| **items**            | array of AgentEvalRecord | Array of evaluation results.                                         |

### Record Fields

| Field                       | Type            | Description                                                            |
| --------------------------- | --------------- | ---------------------------------------------------------------------- |
| **criteria_id**             | string          | UUID of the evaluation criteria.                                       |
| **criteria_step_id**        | string          | Agent step ID targeted by the criteria.                                |
| **criteria_mode**           | string or null  | Evaluation mode (output_expectation, eval_and_retry, sample_and_flag). |
| **criteria_enabled**        | boolean         | Whether the criteria is currently enabled.                             |
| **criteria_pass_threshold** | number or null  | Minimum score to pass (0.0–1.0).                                       |
| **result_id**               | string          | UUID of the evaluation result.                                         |
| **agent_run_id**            | string          | UUID of the agent run that was evaluated.                              |
| **agent_step_run_id**       | string or null  | UUID of the specific step run.                                         |
| **status**                  | string or null  | Result status (passed, failed, pending, skipped, error).               |
| **score**                   | number or null  | Evaluation score (0.0–1.0).                                            |
| **details**                 | object or null  | Evaluation-specific details (JSON).                                    |
| **retry_triggered**         | boolean or null | Whether this result triggered a retry.                                 |
| **retry_count**             | integer or null | Number of retries attempted so far.                                    |
| **flagged**                 | boolean or null | Whether the run was flagged for review.                                |
| **evaluated_at**            | string or null  | ISO-8601 timestamp of the evaluation.                                  |
| **created_at**              | string or null  | ISO-8601 creation timestamp.                                           |

---

## Common Envelope Fields

Every JSON export file includes these top-level fields:

| Field                | Type   | Description                                                          |
| -------------------- | ------ | -------------------------------------------------------------------- |
| **export_type**      | string | Resource type identifier (e.g. governance_policies, knowledge_base). |
| **software_version** | string | Application version that produced this export.                       |
| **account_id**       | string | UUID of the account that owns the exported data.                     |
| **exported_at**      | string | ISO-8601 timestamp of when the export was generated.                 |

JSONL and CSV exports do not include envelope fields — each line or row contains only record-level data.
