Platform Docs
Try DatumoEval

Application API integration

Connect an Application's Modules and Versions to your AI service API, and set up multi-turn conversations, response mapping, and token usage and cost.

Before you begin

①What integration enables

Once integrated, Evaluation, Red Teaming, and Observability call your service API directly, so you can run evaluation, attack, and observation jobs. Finish Create an Application first.

You integrate in Settings > Application > Agent Connection. Click Application Setting at the bottom of the left menu to open it. For the screen layout, see the Agent Connection screen in Create an Application.

②Integration steps

Integrate in the order below. The Key structure you define in step 1 is the basis for every later step.

StepWhat you do
1. Module setupDefine the Input Keys and Output Keys of the Module to evaluate.
2. Version setupRegister the Versions to compare before and after.
3. API integration per VersionEnter the API URL and request content for each Version, then test.
4. Multi-turn API integrationSet this up only for APIs that send the previous conversation, like chatbots.
5. Output Key mappingSelect the response values to evaluate and, if needed, set up cost calculation.

1. Module setup

A Module is a functional unit of an Application. Select the Module Type that matches the function you want to evaluate. Each Module has the following Keys.

KeyMeaning
Input KeyInput passed to the Module
Output KeyOutput generated after the Module runs

①1-1. Create a Module

  1. Click + New Module.

  2. Select a Module Type. You can select multiple Module Types.

  3. Click Add.

②1-2. Edit a Module

  1. Click the edit (pencil) icon at the top right of the Module.

  2. Edit the Module name, Input Keys, and Output Keys.

  3. Add Keys if needed.

ButtonAction
+Add Input KeyAdds an Input Key.
+Add Output KeyAdds an Output Key.

If you edit even one Input Key or Output Key, you must set up every Version of this Application again from scratch.

③1-3. Delete a Module

  1. Click the Delete button.

  2. Type Delete module in the field. The Delete button becomes active.

  3. Click Delete. The Module is deleted.

  1. 1-1Check Modules

    1. Check Modules and their Keys in Module List in Agent Connection.
  2. 1-2Add or edit a Module

    1. Add one with + New Module.
    2. Use the edit button on the Module card to change the name and Keys.
    3. Click Save.

    If you edit even one Key, you must set up every Version of this Module again.

  3. 1-3Delete a Module

    1. Click Delete in the edit dialog.

2. Version setup

An Application can have multiple Versions. Register a new Version whenever the prompt, model, or retrieval method changes. That way you can compare before and after against the same evaluation criteria.

To create a Version, follow the Version creation step in Create an Application. Set up both Application Versions and Module Versions the same way, using steps 3–5 below.

Version tips

  • One change per Version: If you change several things at once, you can't tell which change affected the score.
  • Consistent naming: Agree on a Version naming convention up front so it's easy to compare over time in the Dashboard.
  • Deactivate instead of delete: Keep failed Versions by deactivating them. Use them later to check whether the same problem comes back or to reproduce results.

3. API integration per Version

To run evaluations, attacks, or observations, connect a callable API to each Version. Each Version can have its own API URL, so you can apply the same evaluation set to several environments at once (e.g., staging, production, a new model).

①3-1. Enter integration details

  1. Click API Integration on the Version row.
  2. Enter the details below.
FieldWhat to enter
API URLThe API URL to call
MethodRequest method. Usually keep the default POST.
Request HeaderHeaders such as an auth key. Content-Type: application/json is prefilled.
Request ParameterValues appended to the URL. Add only when needed.
Request BodyContent to send (JSON). See 3-2.

API keys such as Authorization or x-api-key are masked after you save, like sk-****6789. The original value is used during evaluation. To change a key, click the masked field and enter a new value.

②3-2. Write the Request Body

  1. Write the request body in JSON.
  2. Insert the Input Keys from step 1 in {{key_name}} format. During evaluation, they're replaced with the actual values from the Benchmark Set.
{
  "model": "gpt-4o",
  "messages": [
    { "role": "system", "content": "You are a helpful assistant." },
    { "role": "user", "content": "{{user_query}}" }
  ],
  "temperature": 0.2
}

In the example above, {{user_query}} is replaced at run time with the user_query value of each Benchmark row.

You can use only the variables listed under Required variables at the bottom of the dialog, and you must use each of them at least once. Names must match the Input Keys exactly.

③3-3. Test the connection

  1. Enter a sample value for each variable in Test Connection on the right.
  2. Click Test Connection.
  3. Check that a valid response comes back.

Catching auth or format errors here prevents mass failures during evaluation.

④3-4. Save

ButtonWhen to use it
Save DraftSaves what you've entered so far as a draft when you aren't done yet.
Go to Output MappingWhen you're done, moves on to the next step (5. Output Key mapping).

If you close the dialog without saving, you're asked whether to save.

  1. 3-1Open the integration dialog

    1. Click the red API Integration on the Version row to open the Set up Version dialog.
    2. Check the Version Name.
  2. 3-2URL and Method

    1. Enter the API URL to call in URL.
    2. Select a Method. It's usually POST.

    A red message appears if the URL is empty or malformed.

  3. 3-3Request settings

    1. Check this Application's input variables in the info box.
    2. If needed, enter an auth key in Request Header.
    3. Insert variables in Request Body in {{key_name}} format.

    Use every variable under Required variables at the bottom of the dialog at least once.

  4. 3-4Test the connection

    1. Enter a sample value for each variable in Test Connection on the right.
    2. Click Test Connection and check the response.
  5. 3-5Save

    1. If you aren't done yet, click Save Draft.
    2. When you're done, click Go to Output Mapping.

4. Multi-turn API integration

For APIs that need the previous conversation, like chatbots, turn on Multi-turn before integrating. If your API sends a single question only, skip this step.

①4-1. Turn on Multi-turn

  1. Turn on the Multi-turn toggle on the left of the API Integration dialog.
  2. The Request Body is filled with the default example below.
{
  "messages": [
    ...{{chat_history}},
    { "role": "user", "content": "" }
  ]
}
  • The previous conversation goes in place of ...{{chat_history}}. It must appear exactly once in the Request Body.
  • The object right after it is the question sent in the current turn.
  • "content" is empty. When you select an input variable in 4-2, it's filled in, like "{{query}}".

Multi-turn uses only one Request. If you've created Request 2 or more and then turn it on, Request 2 onward is removed.

②4-2. Set up Turn Definition

In Turn Definition, define which values fill one turn of the previous conversation. With the default example, you only need to fill the two cells in the {{content}} row.

FieldUser Turn (what the user says)Assistant Turn (the agent's reply)
{{role}}user (filled automatically)assistant (filled automatically)
{{content}}Select an input variable (e.g., {{query}})Enter the path to the answer in the response (e.g., result.answer)
  1. In the User Turn cell of the {{content}} row, select an input variable (e.g., {{query}}).
  2. In the Assistant Turn cell of the same row, enter the path to the agent's answer. If you don't know the path, click Pick from response, select the answer in the response, and click Select.
  3. If you need more fields, add them with + Add Variable. They're also added to the Request Body automatically.

You can't move on to the next step while any cell is empty.

③4-3. Test a two-turn connection

Test Connection for Multi-turn has Turn 1 and Turn 2 fields.

  1. Enter a first question in Turn 1 and a follow-up question in Turn 2.
    (e.g., My name is Datumo. → What was my name?)
  2. Click Test Connection.
  3. Check that the Turn 2 response remembers what was said in Turn 1.

The test counts as complete only when both turns succeed. To rerun a failed turn, hover over its result and click the retry icon.

  1. 4-1Turn on Multi-turn

    1. Turn on the Multi-turn toggle. The Request Body is filled with the default ...{{chat_history}} example.
    2. In Turn Definition, define the values that fill one turn of the previous conversation.

    You can't use API Chaining with Multi-turn.


5. Output Key mapping

This step tells the platform which values in the API response to evaluate. Click Go to Output Mapping to open the dialog.

①5-1. Enter response paths

  1. Enter a path in the response for each Output Key. If you don't know the path, use Pick from response to select a value from the response.
Output KeyExample path
answerresponse_1.choices[0].message.content
retrieved_docsresponse_1.context.documents
  1. Check that the value under Extracted Value below the path is correct.
  2. Click Save.
  • If a path is wrong, a red message appears and you can't save.
  • If you haven't tested the connection, you're asked whether to test when you save.

A wrongly mapped Key muddies every evaluation result. You won't be able to trace why a score changed.

②5-2. Token usage and cost (optional)

Set this up only if you want to see costs. Once set, costs appear in the Usage tab of the Run Report and in Agent Simulation.

  1. Under Token Usage & Cost at the bottom of the same dialog, enter the Input Tokens and Output Tokens paths. You can also select them with Pick from response.
  2. Enter the price per 1M tokens in Input token cost ($) and Output token cost ($).
  3. When the estimated cost appears in the box below, click Save.

Common token paths are listed below.

ProviderInput TokensOutput Tokens
OpenAI, vLLM, Ollama (OpenAI-compatible)usage.prompt_tokensusage.completion_tokens
Anthropic, OpenAI Responsesusage.input_tokensusage.output_tokens
GeminiusageMetadata.promptTokenCountusageMetadata.candidatesTokenCount
  • To set it up later, click Go to Setting on the Version row. To change it, click Edit Token.
  • For Runs that already ran, setting it up in the Run Report recalculates the cost. See Eval Report.
  1. 5-1Enter response paths

    1. Run Test Connection on the left to get a response.
    2. Click Pick from response for each Output Key.
    3. Find the value in the response and click Select.
    4. Check the value in Extracted Value.

    If a path is wrong, a red message appears and you can't save.

  2. 5-2Token usage and cost (optional)

    1. Enter the Input Tokens and Output Tokens paths.
    2. Enter the price per 1M tokens and check the estimated cost.
  3. 5-3Save

    1. Click Save. The Version changes to Ready.

6. Load models and Agents from a portal (Enterprise)

Enterprise Organizations that have connected an internal model portal can create Versions by loading models or Agents registered in the portal instead of entering the API manually. When you click + New Version, the Set up Version dialog opens first so you can choose a connection method.

MethodDescription
Load ModelLoads a model registered in the portal.
Load AgentLoads an Agent registered in the portal and that Agent's Version.
Add Custom APIEnter the API manually. Same as 3. API integration per Version.
  1. 6-1Connection method

    1. Select Load Model, Load Agent, or Add Custom API.

    Add Custom API is the same as 3. API integration per Version.

  1. 6-1Load a model

    1. Select a model in Model List. You can't select Deleted models.
    2. Click Validate & Load.
  2. 6-2Load an Agent

    1. Select an Agent in Agent List and click Next.
    2. Select a Version in Agent Version List and click Validate & Load.
  3. 6-3Output Key mapping

    1. Map paths with the response_1. prefix and click Save.

    If you select with Pick from response, the prefix is added automatically.

Add the response_1. prefix to response paths for loaded models and Agents (e.g., response_1.result.answer). If you select with Pick from response, it's added automatically.


Frequently asked questions

Why did my Version settings disappear after I edited a Module Key?Because editing even one Key resets every Version's settings.
Cause
Version settings are built on the Module's Key structure.
Solution
Set up the Versions again from scratch.
Why aren't my Request Body variables replaced with actual values?Because the variable name doesn't match the Input Key name.
Cause
The name in {{key_name}} must match the Input Key exactly.
Solution
Rename the variable to match the Input Key exactly.
Why can't I click Go to Output Mapping?Because the URL is empty, a required variable isn't used, or Turn Definition has an empty cell.
Cause
You can move on only after using every variable under Required variables at the bottom of the dialog.
Solution
Check the red messages and empty cells.
Why do I get an auth or format error in Test Connection?Because the auth details in the Header or the Request Body format are wrong.
Cause
The test calls the API with exactly the settings you entered.
Solution
Fix the Header and Request Body, then test again.
Why do I get a ...{{chat_history}} error in Multi-turn?Because ...{{chat_history}} is missing from the Request Body or misspelled.
Cause
The previous conversation goes in this spot.
Solution
Put it inside the messages array, as in the default example.
What should I do if I can't trace why a score changed?Check your Output Key mapping. Confirm the value in Extracted Value, then save.
Cause
A wrongly mapped Key muddies every evaluation result.
Solution
Check the value in Extracted Value before saving.
Why isn't the cost calculated?Because a token path is wrong or a price is missing.
Cause
Cost is calculated only when both paths and both prices are set.
Solution
Re-enter them using the per-provider paths as a reference.

Last updated