Tool calls

Cura 1T was trained for EHR tool workflows — its 94.0% MedAgentBench score is FHIR tool execution against a live server. The API uses the standard OpenAI function-calling shape.

Cura 1T is a research model, not a medical service, and not a substitute for a clinician. Benchmark scores do not establish safety for unsupervised clinical use.

The tool loop

Declare functions in tools; when the model decides to act it responds with tool_calls instead of content. Execute each call, append a tool-role result, and call the API again — until the model answers in plain content.

Python
import jsonimport osfrom openai import OpenAI client = OpenAI(api_key=os.environ["ACTAVA_API_KEY"], base_url="https://inference.actava.ai/v1") tools = [    {        "type": "function",        "function": {            "name": "create_lab_order",            "description": "Create a lab order in the EHR",            "parameters": {                "type": "object",                "properties": {                    "patient_id": {"type": "string"},                    "panel": {"type": "string", "description": "e.g. CBC, BMP"},                },                "required": ["patient_id", "panel"],            },        },    }] messages = [{"role": "user", "content": "Order a CBC panel for patient 1234."}] while True:    response = client.chat.completions.create(        model="actava/cura-soar",        messages=messages,        tools=tools,    )    message = response.choices[0].message    messages.append(message)     if not message.tool_calls:        print(message.content)        break     for call in message.tool_calls:        args = json.loads(call.function.arguments)        result = create_lab_order(**args)  # your implementation        messages.append(            {                "role": "tool",                "tool_call_id": call.id,                "content": json.dumps(result),            }        )

Returning results

Each result message must reference the exact tool_call_id it answers, and the assistant message carrying the tool_calls must stay in the history — removing it is the usual cause of "tool_call_id not found" errors. Treat ids as opaque strings (they look like functions.<name>:<index>, not OpenAI's call_… style — don't parse or pattern-match them).

JSON
{  "role": "tool",  "tool_call_id": "functions.create_lab_order:0",  "content": "{\"status\": \"placed\", \"order_id\": \"SR-2210\"}"}

Notes

  • Parallel calls: a single response may carry several tool_calls — execute all of them and append one tool message per call before the next request.
  • tool_choice: "auto" (default) lets the model decide; "none" suppresses calls — treat it as advisory rather than a hard guarantee, and ignore any tool_calls you didn't ask for; {"type":"function","function":{"name":"..."}} forces one.
  • Tokens: tool definitions ride in the prompt and are billed as input tokens — keep descriptions tight, and stable across turns so they cache.
  • Safety: gate any write action (orders, referrals, documentation) behind human confirmation in your application layer.