from deeprails import DeepRailsDEEPRAILS_API_KEY = "YOUR_API_KEY"client = DeepRails( api_key=DEEPRAILS_API_KEY,)event_response = client.defend.submit_event( workflow_id="wkfl_xxxxxxxxxxxx", model_input={ "system_prompt": "You are a helpful tutor specializing in AP science classes.", "user_prompt": "Explain the difference between mitosis and meiosis in one sentence.", "context": [{"role": "user", "content": "I have an AP Bio exam tomorrow, can you help me study?"}, {"role": "tutor", "content": "Sure, I'll help you study."}] }, model_output="Mitosis produces two genetically identical diploid cells for growth and tissue repair, whereas meiosis generates four genetically varied haploid gametes for sexual reproduction.", model_used="gpt-4o-mini", run_mode="precision", nametag="test",)print(event_response)
Use this endpoint to submit a model input and output pair to a workflow for evaluation
POST
/
defend
/
{workflow_id}
/
events
Submit a Workflow Event
from deeprails import DeepRailsDEEPRAILS_API_KEY = "YOUR_API_KEY"client = DeepRails( api_key=DEEPRAILS_API_KEY,)event_response = client.defend.submit_event( workflow_id="wkfl_xxxxxxxxxxxx", model_input={ "system_prompt": "You are a helpful tutor specializing in AP science classes.", "user_prompt": "Explain the difference between mitosis and meiosis in one sentence.", "context": [{"role": "user", "content": "I have an AP Bio exam tomorrow, can you help me study?"}, {"role": "tutor", "content": "Sure, I'll help you study."}] }, model_output="Mitosis produces two genetically identical diploid cells for growth and tissue repair, whereas meiosis generates four genetically varied haploid gametes for sexual reproduction.", model_used="gpt-4o-mini", run_mode="precision", nametag="test",)print(event_response)
Workflow events represent individual LLM calls in your production use case. Whenever you receive a new LLM response, you can submit it, along with the input, to the workflow for evaluation and remediation. The model_input field in the request must be a dictionary (containing at least a system_prompt field or a user_prompt field), and the request must also include the model_used to generate the output (Ex. gpt-5-mini), the selected run_mode that determines speed/accuracy/cost for evaluation, and optionally a nametag for the workflow event.
The run mode determines which models power the evaluation (fastest to most thorough): - super_fast - High-speed lightweight checks - fast - Balanced speed and accuracy (default) - precision - Deep multi-model analysis - precision_codex - Code-optimized deep analysis - precision_max - Exhaustive multi-pass verification - precision_max_codex - Ultimate code-aware verification
Note:super_fast does not support Web Search or File Search capabilities. Requests using this mode on workflows with Web Search or File Search enabled will be rejected.
The event’s evaluations will be run with the guardrail metrics and improvement action configured in its associated workflow.
When you create a workflow event, you’ll receive an event ID. Use this ID to track the event’s progress and retrieve all evaluations and improvement results.
A dictionary of inputs sent to the LLM to generate output. The dictionary must contain a user_prompt field. For the ground_truth_adherence guardrail metric, ground_truth should be provided.
Run mode for the workflow event. The run mode allows the user to optimize for speed, accuracy, and cost by determining which models are used to evaluate the event. Available run modes (fastest to most thorough): super_fast, fast, precision, precision_codex, precision_max, and precision_max_codex. Defaults to fast. Note: super_fast does not support Web Search or File Search — if your workflow has these capabilities enabled, use a different run mode or edit the workflow to disable them.
{"docsConfig":{"theme":"mint","$schema":"https://mintlify.com/docs.json","name":"DeepRails","colors":{"primary":"#f2ca46","light":"#f2ca46","dark":"#c4990d"},"logo":{"light":"https://mintcdn.com/deeprails-479f3a7b/bbwR2lswB0faqCU8/logo/deeprails-gold.png?fit=max\u0026auto=format\u0026n=bbwR2lswB0faqCU8\u0026q=85\u0026s=f30c47f94d9c83f7345f61cf0bafdcb1","dark":"https://mintcdn.com/deeprails-479f3a7b/bbwR2lswB0faqCU8/logo/deeprails-gold.png?fit=max\u0026auto=format\u0026n=bbwR2lswB0faqCU8\u0026q=85\u0026s=f30c47f94d9c83f7345f61cf0bafdcb1"},"favicon":"https://mintcdn.com/deeprails-479f3a7b/bbwR2lswB0faqCU8/images/favicon-32x32.png?fit=max\u0026auto=format\u0026n=bbwR2lswB0faqCU8\u0026q=85\u0026s=2c44930664b6ca64cf1cff69a262631f","appearance":{"default":"dark","strict":true},"background":{"decoration":"gradient"},"navbar":{"links":[{"href":"https://www.deeprails.com/","label":"DeepRails Website"}],"primary":{"type":"button","label":"API Console Login","href":"https://console.deeprails.com/login"}},"footer":{"socials":{"linkedin":"https://linkedin.com/company/deeprails"}},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"Python SDK","icon":"python","href":"https://pypi.org/project/deeprails"},{"anchor":"TypeScript SDK","icon":"square-js","href":"https://www.npmjs.com/package/deeprails/"},{"anchor":"Ruby SDK","icon":"gem","href":"https://rubygems.org/gems/deeprails"},{"anchor":"Go SDK","icon":"golang","href":"https://pkg.go.dev/github.com/deeprails/deeprails-go-sdk"},{"anchor":"Contact","icon":"envelope","href":"mailto:support@deeprails.ai"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"deeprails-479f3a7b","hasAudioNarration":false,"actualSubdomain":"deeprails-479f3a7b","customDomains":["docs.deeprails.com"],"gitSource":{"type":"github","owner":"deeprails","repo":"docs2","deployBranch":"main","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"entitlements":{},"buildId":"6ae395a7b0143684c1ccab8b","clientVersion":"0.0.4111","searchFilterCounts":[{"language":"default","tag":"Documentation","count":17},{"language":"default","tag":"API Reference","count":12},{"language":"default","tag":"API Documentation","count":12},{"language":"default","tag":"Guardrail Metrics","count":7},{"language":"default","tag":"Defend","count":6},{"language":"default","tag":"Monitor","count":5},{"language":"default","tag":"Defend API","count":3},{"language":"default","tag":"Evaluation Engine","count":3},{"language":"default","tag":"Get Started","count":2},{"language":"default","tag":"Monitor API","count":2}]},"assistantConfig":{},"basePath":"","hasChatPermissions":false,"hasWebMcpPermissions":false,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-rbac-roles","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"rbac-expansion","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-metadata","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-serve","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"live-agents","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"style.css","content":".sidebar>.section{margin-bottom:0px}.sidebar .page{margin-bottom:0px}.sidebar .page a{padding:0px 0px}:target,h2[id]:target,h3[id]:target,h4[id]:target,h5[id]:target,div[id]:target{position:relative;background:linear-gradient(to left, #f2ca46, #2b2a2a00);animation:highlight-section 3s ease-in-out;scroll-margin-top:80px;padding:0.2rem;border-radius:8px;border-left:4px solid #f2ca46}@keyframes highlight-section{0%{background:linear-gradient(to left, #f2ca46, #2b2a2a00)}50%{background:linear-gradient(to left, #f2ca46, #2b2a2a00)}100%{background:linear-gradient(to left, #f2ca46, #2b2a2a00)}}.tight-section>h3{margin-bottom:0.25rem}table,.markdown table,.prose table,.mdx table{table-layout:fixed!important;width:800px!important;max-width:100%!important;text-align:center!important}table th,.markdown table th,.prose table th,.mdx table th{text-align:center!important}table th:first-child,table td:first-child{width:200px!important}table th:nth-child(2),table td:nth-child(2){width:100px!important}table th:nth-child(3),table td:nth-child(3){width:500px!important}[data-page=\"auto-tables\"] table,.run-modes-table{table-layout:auto!important;width:auto!important;max-width:none!important;text-align:left!important}[data-page=\"auto-tables\"] table th,[data-page=\"auto-tables\"] table td,.run-modes-table th,.run-modes-table td{width:auto!important;text-align:left!important;white-space:nowrap;padding:0.5rem 0.75rem!important}.run-modes-table td:nth-child(3),.run-modes-table td:nth-child(4),.run-modes-table td:nth-child(5),.run-modes-table td:nth-child(6),.run-modes-table th:nth-child(3),.run-modes-table th:nth-child(4),.run-modes-table th:nth-child(5),.run-modes-table th:nth-child(6){text-align:center!important;letter-spacing:1px}.competitor-table{table-layout:fixed!important;width:100%!important;max-width:100%!important;text-align:center!important}.competitor-table th,.competitor-table td{text-align:center!important;vertical-align:top;white-space:normal}.competitor-table th:nth-child(1),.competitor-table td:nth-child(1){width:18%!important}.competitor-table th:nth-child(2),.competitor-table td:nth-child(2){width:18%!important}.competitor-table th:nth-child(3),.competitor-table td:nth-child(3){width:24%!important}.competitor-table th:nth-child(4),.competitor-table td:nth-child(4){width:40%!important}.docs-auto-table{table-layout:auto!important;width:100%!important;max-width:100%!important;text-align:left!important}.docs-auto-table th,.docs-auto-table td{width:auto!important;text-align:left!important;vertical-align:top;white-space:normal}[data-page=\"defend-details\"] h2{margin-top:1.5rem;margin-bottom:0.45rem;font-weight:750}[data-page=\"defend-details\"] h3{margin-top:1rem;margin-bottom:0.35rem;font-weight:700}[data-page=\"defend-details\"] p{margin-top:0.45rem;margin-bottom:0.45rem;line-height:1.55}[data-page=\"defend-details\"] ul,[data-page=\"defend-details\"] ol{margin-top:0.4rem;margin-bottom:0.75rem}[data-page=\"defend-details\"] li{margin-bottom:0.2rem}[data-page=\"defend-details\"] hr{margin:1rem 0}[data-page=\"defend-details\"] strong{font-weight:700}[data-page=\"defend-details\"] table{table-layout:auto!important;width:auto!important;max-width:100%!important;text-align:left!important}[data-page=\"defend-details\"] table th,[data-page=\"defend-details\"] table td{width:auto!important;text-align:left!important;vertical-align:top;white-space:normal;padding:0.5rem 0.75rem!important}"}],"page":{"pagePath":"api-reference/defend/submit-a-workflow-event","slug":"/api-reference/defend/submit-a-workflow-event","pageMetadata":{"title":"Submit a Workflow Event","description":"Use this endpoint to submit a model input and output pair to a workflow for evaluation\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /defend/{workflow_id}/events","href":"/api-reference/defend/submit-a-workflow-event","autogeneratedByOpenApi":true},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Use this endpoint to submit a model input and output pair to a workflow for evaluation\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={code:`code`,p:`p`,..._provideComponents(),...props.components};return _jsxs(_components.p,{children:[`Workflow events represent individual LLM calls in your production use case. Whenever you receive a new LLM response, you can submit it, along with the input, to the workflow for evaluation and remediation. The `,_jsx(_components.code,{children:`model_input`}),` field in the request must be a dictionary (containing at least a `,_jsx(_components.code,{children:`system_prompt`}),` field or a `,_jsx(_components.code,{children:`user_prompt`}),` field), and the request must also include the `,_jsx(_components.code,{children:`model_used`}),` to generate the output (Ex. `,_jsx(_components.code,{children:`gpt-5-mini`}),`), the selected `,_jsx(_components.code,{children:`run_mode`}),` that determines speed/accuracy/cost for evaluation, and optionally a `,_jsx(_components.code,{children:`nametag`}),` for the workflow event.`,_jsx(`br`,{}),_jsx(`br`,{}),`The run mode determines which models power the evaluation (fastest to most thorough):`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`super_fast`}),` - High-speed lightweight checks`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`fast`}),` - Balanced speed and accuracy (default)`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`precision`}),` - Deep multi-model analysis`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`precision_codex`}),` - Code-optimized deep analysis`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`precision_max`}),` - Exhaustive multi-pass verification`,_jsx(`br`,{}),`- `,_jsx(_components.code,{children:`precision_max_codex`}),` - Ultimate code-aware verification`,_jsx(`br`,{}),_jsx(`br`,{}),_jsx(`strong`,{children:`Note:`}),` `,_jsx(_components.code,{children:`super_fast`}),` does not support Web Search or File Search capabilities. Requests using this mode on workflows with Web Search or File Search enabled will be rejected.`,_jsx(`br`,{}),_jsx(`br`,{}),`The event’s evaluations will be run with the guardrail metrics and improvement action configured in its associated workflow. `,_jsx(`br`,{}),_jsx(`br`,{}),`When you create a workflow event, you’ll receive an event ID. Use this ID to track the event’s progress and retrieve all evaluations and improvement results.`]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Submit a Workflow Event","description":"Use this endpoint to submit a model input and output pair to a workflow for evaluation\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /defend/{workflow_id}/events","href":"/api-reference/defend/submit-a-workflow-event","autogeneratedByOpenApi":true}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[],"codeExamples":{}},"jsLinks":[],"openApiReferenceData":{"operation":{"tags":["Defend"],"summary":"Submit a Workflow Event","description":"Use this endpoint to submit a model input and output pair to a workflow for evaluation\n","x-mint":{"content":"Workflow events represent individual LLM calls in your production use case. Whenever you receive a new LLM response, you can submit it, along with the input, to the workflow for evaluation and remediation. The `model_input` field in the request must be a dictionary (containing at least a `system_prompt` field or a `user_prompt` field), and the request must also include the `model_used` to generate the output (Ex. `gpt-5-mini`), the selected `run_mode` that determines speed/accuracy/cost for evaluation, and optionally a `nametag` for the workflow event.\u003cbr />\u003cbr />The run mode determines which models power the evaluation (fastest to most thorough):\u003cbr />- `super_fast` - High-speed lightweight checks\u003cbr />- `fast` - Balanced speed and accuracy (default)\u003cbr />- `precision` - Deep multi-model analysis\u003cbr />- `precision_codex` - Code-optimized deep analysis\u003cbr />- `precision_max` - Exhaustive multi-pass verification\u003cbr />- `precision_max_codex` - Ultimate code-aware verification\u003cbr />\u003cbr />\u003cstrong>Note:\u003c/strong> `super_fast` does not support Web Search or File Search capabilities. Requests using this mode on workflows with Web Search or File Search enabled will be rejected.\u003cbr />\u003cbr />The event's evaluations will be run with the guardrail metrics and improvement action configured in its associated workflow. \u003cbr />\u003cbr />When you create a workflow event, you'll receive an event ID. Use this ID to track the event's progress and retrieve all evaluations and improvement results."},"x-codeSamples":[{"lang":"python","label":"Submit a Workflow Event","source":"from deeprails import DeepRails\n\nDEEPRAILS_API_KEY = \"YOUR_API_KEY\"\n\nclient = DeepRails(\n api_key=DEEPRAILS_API_KEY,\n)\n\nevent_response = client.defend.submit_event(\n workflow_id=\"wkfl_xxxxxxxxxxxx\",\n model_input={\n \"system_prompt\": \"You are a helpful tutor specializing in AP science classes.\",\n \"user_prompt\": \"Explain the difference between mitosis and meiosis in one sentence.\",\n \"context\": [{\"role\": \"user\", \"content\": \"I have an AP Bio exam tomorrow, can you help me study?\"}, {\"role\": \"tutor\", \"content\": \"Sure, I'll help you study.\"}]\n },\n model_output=\"Mitosis produces two genetically identical diploid cells for growth and tissue repair, whereas meiosis generates four genetically varied haploid gametes for sexual reproduction.\",\n model_used=\"gpt-4o-mini\",\n run_mode=\"precision\",\n nametag=\"test\",\n)\nprint(event_response)\n"}],"security":["e4575812-b734-49c6-bad6-c3036303b1f8"],"parameters":["b007a24b-8097-4226-9185-a4b662c4b779"],"requestBody":"0d3cbdc2-b34f-4335-b4a0-020ae821b54f","responses":{"200":"80393e1b-4209-450a-991d-9bab122ce33b","400":"e864afc4-9346-4792-8300-c27ff17b718c","401":"f84932a1-c214-402c-b1b8-98c08b3ecd00","404":"05140ce6-14a0-41f4-acc3-bbf441ff8587"},"method":"post","type":"path","servers":["354ef262-08b5-467e-b0b8-a640a41a5637"],"path":"/defend/{workflow_id}/events","baseUrlOptions":["https://api.deeprails.com"],"title":"Submit a Workflow Event","codeSamples":[{"label":"Submit a Workflow Event","lang":"python","source":"from deeprails import DeepRails\n\nDEEPRAILS_API_KEY = \"YOUR_API_KEY\"\n\nclient = DeepRails(\n api_key=DEEPRAILS_API_KEY,\n)\n\nevent_response = client.defend.submit_event(\n workflow_id=\"wkfl_xxxxxxxxxxxx\",\n model_input={\n \"system_prompt\": \"You are a helpful tutor specializing in AP science classes.\",\n \"user_prompt\": \"Explain the difference between mitosis and meiosis in one sentence.\",\n \"context\": [{\"role\": \"user\", \"content\": \"I have an AP Bio exam tomorrow, can you help me study?\"}, {\"role\": \"tutor\", \"content\": \"Sure, I'll help you study.\"}]\n },\n model_output=\"Mitosis produces two genetically identical diploid cells for growth and tissue repair, whereas meiosis generates four genetically varied haploid gametes for sexual reproduction.\",\n model_used=\"gpt-4o-mini\",\n run_mode=\"precision\",\n nametag=\"test\",\n)\nprint(event_response)\n"}],"requiredOnlyExamples":false,"requestExampleType":"codeSamples","responseExampleType":"generated"},"dependencies":{"parameters":{"b007a24b-8097-4226-9185-a4b662c4b779":{"name":"workflow_id","in":"path","description":"Workflow ID associated with this event.","required":true,"schema":{"type":"string","isRequired":true,"description":"Workflow ID associated with this event.","uniqueKey":"","typeLabel":"string"}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"model_input":{"type":"object","description":"A dictionary of inputs sent to the LLM to generate output. The dictionary must contain a `user_prompt` field. For the ground_truth_adherence guardrail metric, `ground_truth` should be provided.\n","properties":{"user_prompt":{"type":"string","description":"The user prompt used to generate the output.","isRequired":true,"uniqueKey":"model_input.user_prompt","typeLabel":"string"},"system_prompt":{"type":"string","description":"The system prompt used to generate the output.","uniqueKey":"model_input.system_prompt","typeLabel":"string"},"ground_truth":{"type":"string","description":"The ground truth for evaluating the Ground Truth Adherence guardrail.","uniqueKey":"model_input.ground_truth","typeLabel":"string"},"context":{"type":"array","description":"Any structured information that directly relates to the model’s input and expected output—e.g., the recent turn-by-turn history between an AI tutor and a student, facts or state passed through an agentic workflow, or other domain-specific signals your system already knows and wants the model to condition on.","items":{"type":"object","properties":{"role":{"type":"string","description":"The role of the speaker.","example":"user","uniqueKey":"model_input.context.items.[INDEX].role","typeLabel":"string"},"content":{"type":"string","description":"The content of the message.","uniqueKey":"model_input.context.items.[INDEX].content","typeLabel":"string"}},"uniqueKey":"model_input.context.items.[INDEX]","typeLabel":"object"},"uniqueKey":"model_input.context","typeLabel":"object[]"}},"required":["user_prompt"],"additionalProperties":false,"isRequired":true,"uniqueKey":"model_input","typeLabel":"object"},"model_output":{"type":"string","description":"Output generated by the LLM to be evaluated.","isRequired":true,"uniqueKey":"model_output","typeLabel":"string"},"model_used":{"type":"string","description":"Model ID used to generate the output, like `gpt-4o` or `o3`.","isRequired":true,"uniqueKey":"model_used","typeLabel":"string"},"run_mode":{"type":"string","description":"Run mode for the workflow event. The run mode allows the user to optimize for speed, accuracy, and cost by determining which models are used to evaluate the event. Available run modes (fastest to most thorough): `super_fast`, `fast`, `precision`, `precision_codex`, `precision_max`, and `precision_max_codex`. Defaults to `fast`. Note: `super_fast` does not support Web Search or File Search — if your workflow has these capabilities enabled, use a different run mode or edit the workflow to disable them.\n","enum":["super_fast","fast","precision","precision_codex","precision_max","precision_max_codex"],"isRequired":true,"uniqueKey":"run_mode","typeLabel":"enum\u003cstring>"},"nametag":{"type":"string","description":"An optional, user-defined tag for the event.","uniqueKey":"nametag","typeLabel":"string"}},"required":["model_input","model_output","model_used","run_mode"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"model_input":{"user_prompt":"\u003cstring>","system_prompt":"\u003cstring>","ground_truth":"\u003cstring>","context":[{"role":"user","content":"\u003cstring>"}]},"model_output":"\u003cstring>","model_used":"\u003cstring>","nametag":"\u003cstring>"}}},"exampleType":"generated"}},"exampleType":"generated"},"responses":{"80393e1b-4209-450a-991d-9bab122ce33b":{"description":"Workflow event created successfully","content":{"application/json":{"schema":{"type":"object","properties":{"event_id":{"type":"string","description":"A unique workflow event ID.","example":"evt_xxxxxxxxxxxx","isRequired":true,"uniqueKey":"event_id","typeLabel":"string"},"workflow_id":{"type":"string","description":"Workflow ID associated with the event.","example":"wkfl_xxxxxxxxxxxx","isRequired":true,"uniqueKey":"workflow_id","typeLabel":"string"},"created_at":{"type":"string","format":"date-time","description":"The time the event was created in UTC.","example":"2025-11-10T01:32:44.591Z","isRequired":true,"uniqueKey":"created_at","typeLabel":"string\u003cdate-time>"},"status":{"type":"string","description":"Status of the event.","example":"In Progress","enum":["In Progress","Completed"],"isRequired":true,"uniqueKey":"status","typeLabel":"enum\u003cstring>"},"billing_request_id":{"type":"string","description":"The ID of the billing request for the event.","example":"bill_0123456789abcdefabcd","isRequired":true,"uniqueKey":"billing_request_id","typeLabel":"string"}},"required":["event_id","workflow_id","created_at","status","billing_request_id"],"uniqueKey":"","typeLabel":"object"},"examples":{"Example":{"title":"Example","value":{"event_id":"evt_xxxxxxxxxxxx","workflow_id":"wkfl_xxxxxxxxxxxx","created_at":"2025-11-10T01:32:44.591Z","status":"In Progress","billing_request_id":"bill_0123456789abcdefabcd"}}},"exampleType":"generated"}},"exampleType":"generated"},"e864afc4-9346-4792-8300-c27ff17b718c":{"description":"Invalid request","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"f84932a1-c214-402c-b1b8-98c08b3ecd00":{"description":"Unauthorized","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}},"05140ce6-14a0-41f4-acc3-bbf441ff8587":{"description":"Workflow not found","content":{"_mintlify/placeholder":{"schema":{"type":"object","description":""}}}}},"security":{"e4575812-b734-49c6-bad6-c3036303b1f8":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"}}},"servers":{"354ef262-08b5-467e-b0b8-a640a41a5637":{"url":"https://api.deeprails.com","description":"Production server"}},"processedSecurityOptions":[{"schemes":[{"scheme":{"type":"http","scheme":"bearer","bearerFormat":"JWT","scopes":[],"schemeName":"BearerAuth"},"schema":{"title":"Bearer Auth","type":"string","isRequired":true,"description":"Bearer authentication header of the form `Bearer \u003ctoken>`, where `\u003ctoken>` is your auth token.","format":"bearer","typeLabel":"string\u003cbearer>","deprecated":false},"schemeName":"BearerAuth","name":"Authorization"}],"title":"BearerAuth"}]},"originalFileLocation":"api-reference/openapi.yaml"},"subdomain":"deeprails-479f3a7b","siteName":"DeepRails","title":"Submit a Workflow Event - DeepRails","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-03-09T20:45:59.264Z","originalFileLocation":"api-reference/defend/submit-a-workflow-event.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=\"dark\";if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"dark\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Use this endpoint to submit a model input and output pair to a workflow for evaluation\">\u003cmeta data-mint-head name=\"application-name\" content=\"DeepRails\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Submit a Workflow Event - DeepRails\">\u003cmeta data-mint-head property=\"og:description\" content=\"Use this endpoint to submit a model input and output pair to a workflow for evaluation\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"DeepRails\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://deeprails-479f3a7b.mintlify.site/_mintlify/api/og/v2?division=Defend\u0026amp;title=Submit+a+Workflow+Event\u0026amp;description=Use+this+endpoint+to+submit+a+model+input+and+output+pair+to+a+workflow+for+evaluation%0A\u0026amp;theme=e5255410c10d93655e7ca4a4\u0026amp;signature=23c8842292d76f2b8e06853378a05daaa9e0188c3e3902b3b2849d4e62c67496\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Submit a Workflow Event - DeepRails\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Use this endpoint to submit a model input and output pair to a workflow for evaluation\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://deeprails-479f3a7b.mintlify.site/_mintlify/api/og/v2?division=Defend\u0026amp;title=Submit+a+Workflow+Event\u0026amp;description=Use+this+endpoint+to+submit+a+model+input+and+output+pair+to+a+workflow+for+evaluation%0A\u0026amp;theme=e5255410c10d93655e7ca4a4\u0026amp;signature=23c8842292d76f2b8e06853378a05daaa9e0188c3e3902b3b2849d4e62c67496\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/deeprails-479f3a7b/Z_VM1vKqq_sDqO8r/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"DeepRails\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#f2ca46\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/api-reference/defend/submit-a-workflow-event.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.deeprails.com/#organization\",\"name\":\"DeepRails\",\"url\":\"https://docs.deeprails.com\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/deeprails-479f3a7b/bbwR2lswB0faqCU8/logo/deeprails-gold.png?fit=max\u0026auto=format\u0026n=bbwR2lswB0faqCU8\u0026q=85\u0026s=f30c47f94d9c83f7345f61cf0bafdcb1\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.deeprails.com#website\",\"name\":\"DeepRails\",\"url\":\"https://docs.deeprails.com\",\"publisher\":{\"@id\":\"https://docs.deeprails.com/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event#webpage\",\"url\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event\",\"name\":\"Submit a Workflow Event\",\"description\":\"Use this endpoint to submit a model input and output pair to a workflow for evaluation\",\"dateModified\":\"2026-03-09T20:45:59.264Z\",\"isPartOf\":{\"@id\":\"https://docs.deeprails.com#website\"},\"breadcrumb\":{\"@id\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"API Documentation\",\"item\":\"https://docs.deeprails.com/api-reference/defend/create-a-workflow\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Defend\",\"item\":\"https://docs.deeprails.com/api-reference/defend/create-a-workflow\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Submit a Workflow Event\",\"item\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event\"}]},{\"@type\":[\"TechArticle\",\"APIReference\"],\"@id\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event#apireference\",\"headline\":\"Submit a Workflow Event\",\"name\":\"Submit a Workflow Event\",\"description\":\"Use this endpoint to submit a model input and output pair to a workflow for evaluation\",\"url\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event\",\"mainEntityOfPage\":{\"@id\":\"https://docs.deeprails.com/api-reference/defend/submit-a-workflow-event#webpage\"},\"dateModified\":\"2026-03-09T20:45:59.264Z\",\"publisher\":{\"@id\":\"https://docs.deeprails.com/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.deeprails.com#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"DeepRails\",\"publisher\":{\"@type\":\"Organization\",\"name\":\"DeepRails\"},\"provider\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","agentPointerHref":"/api-reference/defend/submit-a-workflow-event.md","siteName":"DeepRails","nav":{"global":{"anchors":[{"anchor":"Python SDK","icon":"python","href":"https://pypi.org/project/deeprails"},{"anchor":"TypeScript SDK","icon":"square-js","href":"https://www.npmjs.com/package/deeprails/"},{"anchor":"Ruby SDK","icon":"gem","href":"https://rubygems.org/gems/deeprails"},{"anchor":"Go SDK","icon":"golang","href":"https://pkg.go.dev/github.com/deeprails/deeprails-go-sdk"},{"anchor":"Contact","icon":"envelope","href":"mailto:support@deeprails.ai"}]},"tabs":[{"tab":"Documentation","pages":[{"title":"Documentation","href":""}]},{"tab":"API Reference","groups":[{"group":"API Documentation","pages":[{"group":"Defend","pages":[{"title":"Create a Workflow","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /defend","href":"/api-reference/defend/create-a-workflow"},{"title":"Retrieve a Workflow's Details","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml get /defend/{workflow_id}","href":"/api-reference/defend/retrieve-a-workflows-details"},{"title":"Update a Workflow","description":"Use this endpoint to update an existing defend workflow if its details change.\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml put /defend/{workflow_id}","href":"/api-reference/defend/update-a-workflow"},{"title":"Submit a Workflow Event","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /defend/{workflow_id}/events","href":"/api-reference/defend/submit-a-workflow-event"},{"title":"Retrieve an Event's Details","description":"Use this endpoint to retrieve a specific event of a guardrail workflow\n","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml get /defend/{workflow_id}/events/{event_id}","href":"/api-reference/defend/retrieve-an-events-details"},{"title":"Stream a Workflow Event (Optimized)","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /defend/{workflow_id}/events?stream=true","href":"/api-reference/defend/stream-a-workflow-event-optimized"}]},{"group":"Monitor","pages":[{"title":"Create a Monitor","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /monitor","href":"/api-reference/monitor/create-a-monitor"},{"title":"Retrieve a Monitor's Details","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml get /monitor/{monitor_id}","href":"/api-reference/monitor/retrieve-a-monitors-details"},{"title":"Update a Monitor","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml put /monitor/{monitor_id}","href":"/api-reference/monitor/update-a-monitor"},{"title":"Submit a Monitor Event","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /monitor/{monitor_id}/events","href":"/api-reference/monitor/submit-a-monitor-event"},{"title":"Retrieve a Monitor Event's Details","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml get /monitor/{monitor_id}/events/{event_id}","href":"/api-reference/monitor/retrieve-a-monitor-events-details"}]},{"group":"Files","pages":[{"title":"Upload a File","deprecated":null,"version":null,"openapi":"/api-reference/openapi.yaml post /files/upload","href":"/api-reference/files/upload-a-file"}]}]}]}]},"basePath":"","title":"Submit a Workflow Event - DeepRails","buildId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","deploymentId":"dpl_DqYu5MPb49gWBBbUGgpHQUmCHY3P","dynamics":["c2aa737661","2b790eda92","b0f84f53ff","a9bb46feb3"],"chunks":["OpenApiReferenceProvider-CybtLBIt.js","utils-BMLj2fvV.js","cloneDeep-izs3Hzxb.js","_Uint8Array-BVIqJ90l.js","isObjectLike-C8vmzPEN.js","isArray-Dcu1dQ5t.js","utils-B6In562Y.js","toString-BX-iyh8G.js","isSymbol-CSH9U2Gm.js","addUniqueKeysToSchema-Dr8Mfhp9.js","snippetPresets-2rmQvMVl.js","style-to-object-BY3JEAdk.js","v4-DIgz8zy6.js","conditional-requirements-CFM0id0Q.js","ApiExamples-WMqJYdZj.js","isEqual-BfaiBbcl.js","usePlaygroundInputsStore-CJ-MlPHu.js","shallow-dY3TMRCk.js","getApiPlaygroundDisplay-v-1B2bKm.js","CodeSnippet-BDhiTB7U.js","CodeSnippets-D9hnzQcS.js","Page-C4GwDT3_.js","getPastedJson-Th2V45jI.js","icon-BQXch1W9.js","MethodPill-BCqUneP3.js","DuplicateIcon-Q_-bhurZ.js","createIcon-DUjLHRqp.js","DynamicMarkdown-B-f2cqXQ.js","SectionHeading-Da5NsV4v.js","axios-vUo_bRtp.js","Markdown-D13FWkIM.js","clsx-D3Isdib3.js","lib-DuNMoZ05.js","lib-B8HbPgcC.js","html-void-elements-mCSPHezU.js","dist-C-XZBk9h.js","katex-YMM-FMeD.js","marked.esm-CZWythHk.js","AssistantPageLink--qIqmmVG.js"]}