Skip to main content

How to test workflows on Maxim?

Test AI agents using workflows that are configured and stored on the Maxim platform. This approach leverages the With Workflow ID function to execute pre-configured workflows without needing to handle HTTP calls manually.
Before using this approach, ensure your workflow is configured on the Maxim platform with “output” and “context” fields configured properly.This is needed to know how to parse the response from the endpoint to get output and context.

Basic Workflow Testing

Use the With Workflow ID function to test agents configured as workflows on the Maxim platform:
from maxim import Maxim

# Initialize Maxim SDK

maxim = Maxim({"api_key": "your-api-key"})

# Create and run the test using a Maxim workflow

result = (
    maxim.create_test_run(
        name="Agent Workflow Test", in_workspace_id="your-workspace-id"
    )
    .with_data_structure(
        {
            "input": "INPUT",
            "expected_output": "EXPECTED_OUTPUT",
            "context": "CONTEXT_TO_EVALUATE",
        }
    )
    .with_data("your-dataset-id")
    .with_evaluators("Bias")
    .with_workflow_id("your-workflow-id")
    .run()
)

print(f"Test run completed! View results: {result.test_run_result.link}")

Using Presets

If you have saved test configuration presets on the Maxim platform, you can use them to automatically load datasets, evaluators, and other settings without specifying them manually:
Python
from maxim import Maxim

maxim = Maxim({"api_key": "your-api-key"})

# Test using a saved preset — dataset, evaluators, and context
# settings are loaded from the preset automatically
result = (
    maxim.create_test_run(
        name="Workflow Test with Preset",
        in_workspace_id="your-workspace-id",
    )
    .with_workflow_id("your-workflow-id")
    .with_preset("My Saved Preset")
    .run()
)

print(f"Test completed! View results: {result.test_run_result.link}")
Any values you set explicitly via other builder methods will take priority over the preset defaults:
Python
result = (
    maxim.create_test_run(
        name="Workflow Test with Preset Override",
        in_workspace_id="your-workspace-id",
    )
    .with_workflow_id("your-workflow-id")
    .with_preset("My Saved Preset")
    .with_data("different-dataset-id")  # Overrides the preset's dataset
    .run()
)
If the preset includes human evaluators, you must also call with_human_evaluation_config to provide the reviewer emails.

Next Steps