use retab::models::{ AssertionSpec, ContainCondition, CreateWorkflowEvalRequest, OutputTarget, RunStepWorkflowEvalSource, WorkflowEvalBlockTarget,};use retab::resources::workflow_evals::CreateParams;use retab::Retab;#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Retab::new(std::env::var("RETAB_API_KEY")?); let mut source = RunStepWorkflowEvalSource::new("wfrun_def456"); source.step_id = Some("block_extract_invoice".into()); let mut target = OutputTarget::new("output-json-0"); target.path = Some("vendor.name".into()); let condition = ContainCondition { kind: None, expected: serde_json::json!("Acme"), }; let body = CreateWorkflowEvalRequest::new( "wf_abc123xyz", WorkflowEvalBlockTarget::new("block_extract_invoice"), source.into(), AssertionSpec::new(target, condition.into()), ); let workflow_eval = client .workflows() .evals() .create(CreateParams::new(body)) .await?; println!("Eval created: {}", workflow_eval.id); Ok(())}
<?phprequire 'vendor/autoload.php';use Retab\Client;use Retab\Resource\AssertionSpec;use Retab\Resource\ExistCondition;use Retab\Resource\JsonHandleInput;use Retab\Resource\ManualWorkflowEvalSource;use Retab\Resource\OutputTarget;use Retab\Resource\WorkflowEvalBlockTarget;$client = new Client(apiKey: getenv('RETAB_API_KEY'));$result = $client->workflows()->evals()->create( workflowId: 'wf_abc123', target: new WorkflowEvalBlockTarget(blockId: 'block_extract_invoice'), source: new ManualWorkflowEvalSource(handleInputs: [ 'input-json-0' => new JsonHandleInput(data: ['invoice_number' => 'INV-001']), ]), assertion: new AssertionSpec( target: new OutputTarget(outputHandleId: 'output-json-0', path: 'invoice_number'), condition: new ExistCondition(), ), name: 'Invoice number exists',);print_r($result);
using Retab;using RetabClient = Retab.Retab;var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;var client = new RetabClient(apiKey);var result = await client.Workflows.Evals.CreateAsync(new WorkflowEvalsCreateOptions());Console.WriteLine(result);
import com.retab.RetabClient;import com.retab.workflowevals.WorkflowEvalsApi;public final class Example { public static void main(String[] args) throws Exception { RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY")); var result = new WorkflowEvalsApi(client).create("wf_abc123", null, null, "Invoice Processing", null); System.out.println(result); }}
{ "detail": "assertion is required for workflow evals."}
{ "detail": "Workflow eval not found: <block_id>"}
Evals
Create Workflow Eval
Create a workflow eval.
Pins an expected outcome for one block in a workflow. Provide the
workflow_id, the target block, an assertion describing the expected
output, and a source of eval inputs (explicit handle inputs or a capture
from a prior run/step). Returns the created eval with status 201.
use retab::models::{ AssertionSpec, ContainCondition, CreateWorkflowEvalRequest, OutputTarget, RunStepWorkflowEvalSource, WorkflowEvalBlockTarget,};use retab::resources::workflow_evals::CreateParams;use retab::Retab;#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Retab::new(std::env::var("RETAB_API_KEY")?); let mut source = RunStepWorkflowEvalSource::new("wfrun_def456"); source.step_id = Some("block_extract_invoice".into()); let mut target = OutputTarget::new("output-json-0"); target.path = Some("vendor.name".into()); let condition = ContainCondition { kind: None, expected: serde_json::json!("Acme"), }; let body = CreateWorkflowEvalRequest::new( "wf_abc123xyz", WorkflowEvalBlockTarget::new("block_extract_invoice"), source.into(), AssertionSpec::new(target, condition.into()), ); let workflow_eval = client .workflows() .evals() .create(CreateParams::new(body)) .await?; println!("Eval created: {}", workflow_eval.id); Ok(())}
<?phprequire 'vendor/autoload.php';use Retab\Client;use Retab\Resource\AssertionSpec;use Retab\Resource\ExistCondition;use Retab\Resource\JsonHandleInput;use Retab\Resource\ManualWorkflowEvalSource;use Retab\Resource\OutputTarget;use Retab\Resource\WorkflowEvalBlockTarget;$client = new Client(apiKey: getenv('RETAB_API_KEY'));$result = $client->workflows()->evals()->create( workflowId: 'wf_abc123', target: new WorkflowEvalBlockTarget(blockId: 'block_extract_invoice'), source: new ManualWorkflowEvalSource(handleInputs: [ 'input-json-0' => new JsonHandleInput(data: ['invoice_number' => 'INV-001']), ]), assertion: new AssertionSpec( target: new OutputTarget(outputHandleId: 'output-json-0', path: 'invoice_number'), condition: new ExistCondition(), ), name: 'Invoice number exists',);print_r($result);
using Retab;using RetabClient = Retab.Retab;var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;var client = new RetabClient(apiKey);var result = await client.Workflows.Evals.CreateAsync(new WorkflowEvalsCreateOptions());Console.WriteLine(result);
import com.retab.RetabClient;import com.retab.workflowevals.WorkflowEvalsApi;public final class Example { public static void main(String[] args) throws Exception { RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY")); var result = new WorkflowEvalsApi(client).create("wf_abc123", null, null, "Invoice Processing", null); System.out.println(result); }}
{ "detail": "assertion is required for workflow evals."}
{ "detail": "Workflow eval not found: <block_id>"}
Create a new workflow eval against a single block in the workflow. A workflow eval
freezes a set of inputs (either captured from a previous run or provided
manually) and asserts something about the block’s output the next time it runs.The create route is flat: send workflow_id in the request body.The request body has three parts:
target — the block the eval runs against.
source — where the inputs come from. manual carries an explicit
handle_inputs map; run_step references a previous workflow run plus the
optional step inside it whose inputs to capture.
assertion — required. One assertion per eval against one declared
output handle (see Workflow Evals for the assertion
shape and the available operators).
use retab::models::{ AssertionSpec, ContainCondition, CreateWorkflowEvalRequest, OutputTarget, RunStepWorkflowEvalSource, WorkflowEvalBlockTarget,};use retab::resources::workflow_evals::CreateParams;use retab::Retab;#[tokio::main]async fn main() -> Result<(), Box<dyn std::error::Error>> { let client = Retab::new(std::env::var("RETAB_API_KEY")?); let mut source = RunStepWorkflowEvalSource::new("wfrun_def456"); source.step_id = Some("block_extract_invoice".into()); let mut target = OutputTarget::new("output-json-0"); target.path = Some("vendor.name".into()); let condition = ContainCondition { kind: None, expected: serde_json::json!("Acme"), }; let body = CreateWorkflowEvalRequest::new( "wf_abc123xyz", WorkflowEvalBlockTarget::new("block_extract_invoice"), source.into(), AssertionSpec::new(target, condition.into()), ); let workflow_eval = client .workflows() .evals() .create(CreateParams::new(body)) .await?; println!("Eval created: {}", workflow_eval.id); Ok(())}
<?phprequire 'vendor/autoload.php';use Retab\Client;use Retab\Resource\AssertionSpec;use Retab\Resource\ExistCondition;use Retab\Resource\JsonHandleInput;use Retab\Resource\ManualWorkflowEvalSource;use Retab\Resource\OutputTarget;use Retab\Resource\WorkflowEvalBlockTarget;$client = new Client(apiKey: getenv('RETAB_API_KEY'));$result = $client->workflows()->evals()->create( workflowId: 'wf_abc123', target: new WorkflowEvalBlockTarget(blockId: 'block_extract_invoice'), source: new ManualWorkflowEvalSource(handleInputs: [ 'input-json-0' => new JsonHandleInput(data: ['invoice_number' => 'INV-001']), ]), assertion: new AssertionSpec( target: new OutputTarget(outputHandleId: 'output-json-0', path: 'invoice_number'), condition: new ExistCondition(), ), name: 'Invoice number exists',);print_r($result);
using Retab;using RetabClient = Retab.Retab;var apiKey = Environment.GetEnvironmentVariable("RETAB_API_KEY")!;var client = new RetabClient(apiKey);var result = await client.Workflows.Evals.CreateAsync(new WorkflowEvalsCreateOptions());Console.WriteLine(result);
import com.retab.RetabClient;import com.retab.workflowevals.WorkflowEvalsApi;public final class Example { public static void main(String[] args) throws Exception { RetabClient client = new RetabClient(System.getenv("RETAB_API_KEY")); var result = new WorkflowEvalsApi(client).create("wf_abc123", null, null, "Invoice Processing", null); System.out.println(result); }}
Execution status and verdict outcome are exposed as separate fields.
The summary is written on terminal-state transitions, so in practice
status is one of completed | error | cancelled and outcome is
populated when status == "completed".
Execution status and verdict outcome are exposed as separate fields.
The summary is written on terminal-state transitions, so in practice
status is one of completed | error | cancelled and outcome is
populated when status == "completed".
Execution status and verdict outcome are exposed as separate fields.
The summary is written on terminal-state transitions, so in practice
status is one of completed | error | cancelled and outcome is
populated when status == "completed".