{"openapi":"3.1.0","info":{"title":"Clinical Trial Matcher API","description":"Experimental matching against a fictional clinical-trial catalog.","version":"1.0.0"},"paths":{"/api/health":{"get":{"summary":"Health","operationId":"health_api_health_get","responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HealthResponse"}}}}}}},"/api/login":{"post":{"summary":"Login","operationId":"login_api_login_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/LoginRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TokenResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}}}},"/api/match":{"post":{"summary":"Match Trials","operationId":"match_trials_api_match_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}},"/api/eval":{"post":{"summary":"Evaluate Trials","description":"Run the workflow and return a full trace (answer, tools, context, and metadata) for eval.\n\nUnlike ``/api/match`` this does not fail when the verifier rejects the package; it reports the\noutcome in ``metadata.verified`` so evaluation harnesses can inspect the complete run.","operationId":"evaluate_trials_api_eval_post","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MatchRequest"}}},"required":true},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EvalResponse"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}}}},"security":[{"HTTPBearer":[]}]}}},"components":{"schemas":{"CriterionReview":{"properties":{"criterion_index":{"type":"integer","minimum":0.0,"title":"Criterion Index"},"status":{"type":"string","enum":["met","not_met","unknown"],"title":"Status"},"profile_evidence":{"items":{"type":"string","enum":["age","sex","condition","stage","biomarkers","previous_treatments","ecog_status","lab_results","location","explicitly_absent_facts"]},"type":"array","title":"Profile Evidence"},"rationale":{"type":"string","title":"Rationale"}},"type":"object","required":["criterion_index","status","profile_evidence","rationale"],"title":"CriterionReview"},"EvalMetadata":{"properties":{"model":{"type":"string","title":"Model"},"candidate_trial_ids":{"items":{"type":"string"},"type":"array","title":"Candidate Trial Ids"},"verified":{"type":"boolean","title":"Verified"},"overall_statuses":{"items":{"type":"string","enum":["potentially_eligible","insufficient_information","not_eligible"]},"type":"array","title":"Overall Statuses"},"step_count":{"type":"integer","title":"Step Count"},"duration_ms":{"type":"number","title":"Duration Ms"},"usage":{"$ref":"#/components/schemas/StepUsage"}},"type":"object","required":["model","candidate_trial_ids","verified","overall_statuses","step_count","duration_ms","usage"],"title":"EvalMetadata"},"EvalResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"input":{"additionalProperties":true,"type":"object","title":"Input"},"final_output":{"anyOf":[{"$ref":"#/components/schemas/MatchResponse"},{"type":"null"}]},"trace":{"items":{"$ref":"#/components/schemas/TraceStep"},"type":"array","title":"Trace"},"metadata":{"$ref":"#/components/schemas/EvalMetadata"},"safety_notice":{"type":"string","title":"Safety Notice","default":"Experimental screening only. This is not medical advice or a determination of clinical eligibility. A qualified study team must review every result."}},"type":"object","required":["request_id","input","final_output","trace","metadata"],"title":"EvalResponse"},"GuardrailRecord":{"properties":{"name":{"type":"string","title":"Name"},"tripwire_triggered":{"type":"boolean","title":"Tripwire Triggered"},"output_info":{"title":"Output Info"}},"type":"object","required":["name","tripwire_triggered"],"title":"GuardrailRecord","description":"The outcome of an input guardrail that ran during a step."},"HTTPValidationError":{"properties":{"detail":{"items":{"$ref":"#/components/schemas/ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"},"HealthResponse":{"properties":{"status":{"type":"string","const":"ok","title":"Status","default":"ok"},"model":{"type":"string","title":"Model"},"api_key_configured":{"type":"boolean","title":"Api Key Configured"}},"type":"object","required":["model","api_key_configured"],"title":"HealthResponse"},"LabResult":{"properties":{"name":{"type":"string","title":"Name"},"value":{"type":"number","title":"Value"},"unit":{"type":"string","title":"Unit"}},"type":"object","required":["name","value","unit"],"title":"LabResult"},"LoginRequest":{"properties":{"username":{"type":"string","maxLength":150,"minLength":1,"title":"Username"},"password":{"type":"string","maxLength":256,"minLength":1,"title":"Password"}},"type":"object","required":["username","password"],"title":"LoginRequest"},"MatchRequest":{"properties":{"profile_text":{"type":"string","maxLength":5000,"minLength":20,"title":"Profile Text"}},"type":"object","required":["profile_text"],"title":"MatchRequest"},"MatchResponse":{"properties":{"request_id":{"type":"string","title":"Request Id"},"profile":{"$ref":"#/components/schemas/PatientProfile"},"matches":{"items":{"$ref":"#/components/schemas/TrialMatch"},"type":"array","title":"Matches"},"verification":{"$ref":"#/components/schemas/VerificationResult"},"safety_notice":{"type":"string","title":"Safety Notice","default":"Experimental screening only. This is not medical advice or a determination of clinical eligibility. A qualified study team must review every result."},"catalog_notice":{"type":"string","title":"Catalog Notice","default":"All studies in this application are fictional demonstration data."}},"type":"object","required":["request_id","profile","matches","verification"],"title":"MatchResponse"},"PatientProfile":{"properties":{"age":{"anyOf":[{"type":"integer","maximum":130.0,"minimum":0.0},{"type":"null"}],"title":"Age"},"sex":{"type":"string","enum":["female","male","other","unknown"],"title":"Sex","default":"unknown"},"condition":{"type":"string","title":"Condition"},"stage":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Stage"},"biomarkers":{"items":{"type":"string"},"type":"array","title":"Biomarkers"},"previous_treatments":{"items":{"type":"string"},"type":"array","title":"Previous Treatments"},"ecog_status":{"anyOf":[{"type":"integer","maximum":5.0,"minimum":0.0},{"type":"null"}],"title":"Ecog Status"},"lab_results":{"items":{"$ref":"#/components/schemas/LabResult"},"type":"array","title":"Lab Results"},"location":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Location"},"explicitly_absent_facts":{"items":{"type":"string"},"type":"array","title":"Explicitly Absent Facts"}},"type":"object","required":["condition"],"title":"PatientProfile"},"StepUsage":{"properties":{"requests":{"type":"integer","title":"Requests","default":0},"input_tokens":{"type":"integer","title":"Input Tokens","default":0},"output_tokens":{"type":"integer","title":"Output Tokens","default":0},"total_tokens":{"type":"integer","title":"Total Tokens","default":0}},"type":"object","title":"StepUsage","description":"Token and request accounting for a step or for the whole run."},"TokenResponse":{"properties":{"access_token":{"type":"string","title":"Access Token"},"token_type":{"type":"string","const":"bearer","title":"Token Type","default":"bearer"},"expires_in":{"type":"integer","title":"Expires In"}},"type":"object","required":["access_token","expires_in"],"title":"TokenResponse"},"ToolCallRecord":{"properties":{"call_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Call Id"},"name":{"type":"string","title":"Name"},"arguments":{"title":"Arguments"},"output":{"title":"Output"}},"type":"object","required":["name"],"title":"ToolCallRecord","description":"A tool invocation observed in an agent step, with its arguments and output."},"ToolDefinition":{"properties":{"name":{"type":"string","title":"Name"},"description":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Description"}},"type":"object","required":["name"],"title":"ToolDefinition","description":"A tool that was available to an agent during a step."},"TraceStep":{"properties":{"index":{"type":"integer","title":"Index"},"kind":{"type":"string","enum":["agent","operation"],"title":"Kind"},"name":{"type":"string","title":"Name"},"description":{"type":"string","title":"Description"},"agent_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Agent Name"},"model":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Model"},"input":{"title":"Input"},"output":{"title":"Output"},"available_tools":{"items":{"$ref":"#/components/schemas/ToolDefinition"},"type":"array","title":"Available Tools"},"tool_calls":{"items":{"$ref":"#/components/schemas/ToolCallRecord"},"type":"array","title":"Tool Calls"},"messages":{"items":{"type":"string"},"type":"array","title":"Messages"},"guardrails":{"items":{"$ref":"#/components/schemas/GuardrailRecord"},"type":"array","title":"Guardrails"},"response_ids":{"items":{"type":"string"},"type":"array","title":"Response Ids"},"usage":{"$ref":"#/components/schemas/StepUsage"},"duration_ms":{"type":"number","title":"Duration Ms","default":0.0},"error":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Error"}},"type":"object","required":["index","kind","name","description"],"title":"TraceStep","description":"One recorded step of the workflow: an agent turn or a deterministic operation."},"Trial":{"properties":{"trial_id":{"type":"string","title":"Trial Id"},"title":{"type":"string","title":"Title"},"recruitment_status":{"type":"string","enum":["recruiting","not_yet_recruiting"],"title":"Recruitment Status"},"conditions":{"items":{"type":"string"},"type":"array","title":"Conditions"},"locations":{"items":{"type":"string"},"type":"array","title":"Locations"},"summary":{"type":"string","title":"Summary"},"eligibility_criteria":{"items":{"type":"string"},"type":"array","title":"Eligibility Criteria"}},"type":"object","required":["trial_id","title","recruitment_status","conditions","locations","summary","eligibility_criteria"],"title":"Trial"},"TrialMatch":{"properties":{"trial":{"$ref":"#/components/schemas/Trial"},"overall_status":{"type":"string","enum":["potentially_eligible","insufficient_information","not_eligible"],"title":"Overall Status"},"criteria":{"items":{"$ref":"#/components/schemas/CriterionReview"},"type":"array","title":"Criteria"},"met_count":{"type":"integer","title":"Met Count"},"unknown_count":{"type":"integer","title":"Unknown Count"},"not_met_count":{"type":"integer","title":"Not Met Count"}},"type":"object","required":["trial","overall_status","criteria","met_count","unknown_count","not_met_count"],"title":"TrialMatch"},"ValidationError":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"},"input":{"title":"Input"},"ctx":{"type":"object","title":"Context"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"VerificationIssue":{"properties":{"trial_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Trial Id"},"criterion_index":{"anyOf":[{"type":"integer"},{"type":"null"}],"title":"Criterion Index"},"explanation":{"type":"string","title":"Explanation"}},"type":"object","required":["explanation"],"title":"VerificationIssue"},"VerificationResult":{"properties":{"verified":{"type":"boolean","title":"Verified"},"issues":{"items":{"$ref":"#/components/schemas/VerificationIssue"},"type":"array","title":"Issues"}},"type":"object","required":["verified","issues"],"title":"VerificationResult"}},"securitySchemes":{"HTTPBearer":{"type":"http","scheme":"bearer"}}}}