Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/fabric-core/src/agent_execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ fn agent_run_result_schema(schema: &mut Schema) {
"properties": {"status": {"const": "succeeded"}},
"required": ["status"]
},
"then": {"not": {"required": ["error"]}}
"then": {"properties": {"error": {"type": "null"}}}
}
]),
);
Expand Down
9 changes: 9 additions & 0 deletions crates/fabric-core/src/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -447,6 +447,15 @@ mod tests {
"output": null,
"error": {"code": "target_error", "message": "target failed"}
})));
assert!(validator.is_valid(&serde_json::json!({
"status": "succeeded",
"output": null
})));
assert!(validator.is_valid(&serde_json::json!({
"status": "succeeded",
"output": null,
"error": null
})));
Comment thread
zhongxuanwang-nv marked this conversation as resolved.
for path in [
" \t",
"nested/../output",
Expand Down
8 changes: 4 additions & 4 deletions docs/adapter-contract/results.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,10 @@ Use the generated
[`AgentRunResult` JSON Schema](https://github.com/NVIDIA/NeMo-Fabric/blob/main/schemas/adapter-contract/agent-run-result.schema.json)
for exact fields and constraints.

A failed result must contain `error`. A succeeded result must not contain
`error`. Do not infer status from arbitrary fields in `output`. Exactly one
terminal result is produced for an invocation, and its status is immutable
once returned.
A failed result must contain `error`. A succeeded result can omit `error` or
set it to `null`; it must not contain a non-null error. Do not infer status
from arbitrary fields in `output`. Exactly one terminal result is produced for
an invocation, and its status is immutable once returned.

## Failure Classes

Expand Down
8 changes: 4 additions & 4 deletions schemas/adapter-contract/agent-run-result.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@
]
},
"then": {
"not": {
"required": [
"error"
]
"properties": {
"error": {
"type": "null"
}
Comment thread
zhongxuanwang-nv marked this conversation as resolved.
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,10 +199,10 @@
]
},
"then": {
"not": {
"required": [
"error"
]
"properties": {
"error": {
"type": "null"
}
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions typescript/adapter-contract/scripts/generate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -282,10 +282,10 @@ export type AgentRunResult =
| AgentRunFailed
| AgentRunCancelled;

/** Successful terminal result. Successful results cannot carry an error. */
/** Successful terminal result. Successful results can carry only a null error. */
export interface AgentRunSucceeded extends AgentRunResultCommon {
status: "succeeded";
error?: never;
error?: null;
}

/** Failed terminal result. Failed results must carry a non-null error. */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const supportedRunResultConditionals = [
properties: { status: { const: "succeeded" } },
required: ["status"],
},
then: { not: { required: ["error"] } },
then: { properties: { error: { type: "null" } } },
},
];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ export type AgentRunResult =
| AgentRunFailed
| AgentRunCancelled;

/** Successful terminal result. Successful results cannot carry an error. */
/** Successful terminal result. Successful results can carry only a null error. */
export interface AgentRunSucceeded extends AgentRunResultCommon {
status: "succeeded";
error?: never;
error?: null;
}

/** Failed terminal result. Failed results must carry a non-null error. */
Expand Down
1 change: 1 addition & 0 deletions typescript/adapter-contract/test/execution.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const requests: AgentRunRequest[] = [

const results: AgentRunResult[] = [
{ output: null, status: "succeeded" },
{ error: null, output: null, status: "succeeded" },
{
error: { code: "target_error", message: "target failed" },
output: { partial: true },
Expand Down
Loading