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.
| Step | What you do |
|---|---|
| 1. Module setup | Define the Input Keys and Output Keys of the Module to evaluate. |
| 2. Version setup | Register the Versions to compare before and after. |
| 3. API integration per Version | Enter the API URL and request content for each Version, then test. |
| 4. Multi-turn API integration | Set this up only for APIs that send the previous conversation, like chatbots. |
| 5. Output Key mapping | Select 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.
| Key | Meaning |
|---|---|
Input Key | Input passed to the Module |
Output Key | Output generated after the Module runs |
①1-1. Create a Module
-
Click
+ New Module. -
Select a Module Type. You can select multiple Module Types.
-
Click
Add.
②1-2. Edit a Module
-
Click the edit (pencil) icon at the top right of the Module.
-
Edit the Module name, Input Keys, and Output Keys.
-
Add Keys if needed.
| Button | Action |
|---|---|
+Add Input Key | Adds an Input Key. |
+Add Output Key | Adds 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
-
Click the
Deletebutton. -
Type
Delete modulein the field. TheDeletebutton becomes active. -
Click
Delete. The Module is deleted.
1-1Check Modules
- Check Modules and their Keys in
Module Listin Agent Connection.
- Check Modules and their Keys in
1-2Add or edit a Module
- Add one with
+ New Module. - Use the edit button on the Module card to change the name and Keys.
- Click
Save.
If you edit even one Key, you must set up every Version of this Module again.
- Add one with
1-3Delete a Module
- Click
Deletein the edit dialog.
- Click
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
- Click
API Integrationon the Version row. - Enter the details below.
| Field | What to enter |
|---|---|
API URL | The API URL to call |
Method | Request method. Usually keep the default POST. |
Request Header | Headers such as an auth key. Content-Type: application/json is prefilled. |
Request Parameter | Values appended to the URL. Add only when needed. |
Request Body | Content 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
- Write the request body in JSON.
- 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
- Enter a sample value for each variable in
Test Connectionon the right. - Click
Test Connection. - Check that a valid response comes back.
Catching auth or format errors here prevents mass failures during evaluation.
④3-4. Save
| Button | When to use it |
|---|---|
Save Draft | Saves what you've entered so far as a draft when you aren't done yet. |
Go to Output Mapping | When 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.
3-1Open the integration dialog
- Click the red
API Integrationon the Version row to open theSet up Versiondialog. - Check the
Version Name.
- Click the red
3-2URL and Method
- Enter the API URL to call in
URL. - Select a
Method. It's usuallyPOST.
A red message appears if the URL is empty or malformed.
- Enter the API URL to call in
3-3Request settings
- Check this Application's input variables in the info box.
- If needed, enter an auth key in
Request Header. - Insert variables in
Request Bodyin{{key_name}}format.
Use every variable under
Required variablesat the bottom of the dialog at least once.3-4Test the connection
- Enter a sample value for each variable in
Test Connectionon the right. - Click
Test Connectionand check the response.
- Enter a sample value for each variable in
3-5Save
- If you aren't done yet, click
Save Draft. - When you're done, click
Go to Output Mapping.
- If you aren't done yet, click
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
- Turn on the
Multi-turntoggle on the left of the API Integration dialog. - 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.
| Field | User 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) |
- In the
User Turncell of the{{content}}row, select an input variable (e.g.,{{query}}). - In the
Assistant Turncell of the same row, enter the path to the agent's answer. If you don't know the path, clickPick from response, select the answer in the response, and clickSelect. - 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.
- Enter a first question in
Turn 1and a follow-up question inTurn 2.
(e.g.,My name is Datumo.→What was my name?) - Click
Test Connection. - 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.
4-1Turn on Multi-turn
- Turn on the
Multi-turntoggle. The Request Body is filled with the default...{{chat_history}}example. - In
Turn Definition, define the values that fill one turn of the previous conversation.
You can't use API Chaining with Multi-turn.
- Turn on the
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
- Enter a path in the response for each Output Key. If you don't know the path, use
Pick from responseto select a value from the response.
| Output Key | Example path |
|---|---|
answer | response_1.choices[0].message.content |
retrieved_docs | response_1.context.documents |
- Check that the value under
Extracted Valuebelow the path is correct. - 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.
- Under
Token Usage & Costat the bottom of the same dialog, enter theInput TokensandOutput Tokenspaths. You can also select them withPick from response. - Enter the price per 1M tokens in
Input token cost ($)andOutput token cost ($). - When the estimated cost appears in the box below, click
Save.
Common token paths are listed below.
| Provider | Input Tokens | Output Tokens |
|---|---|---|
| OpenAI, vLLM, Ollama (OpenAI-compatible) | usage.prompt_tokens | usage.completion_tokens |
| Anthropic, OpenAI Responses | usage.input_tokens | usage.output_tokens |
| Gemini | usageMetadata.promptTokenCount | usageMetadata.candidatesTokenCount |
- To set it up later, click
Go to Settingon the Version row. To change it, clickEdit Token. - For Runs that already ran, setting it up in the Run Report recalculates the cost. See Eval Report.
5-1Enter response paths
- Run
Test Connectionon the left to get a response. - Click
Pick from responsefor each Output Key. - Find the value in the response and click
Select. - Check the value in
Extracted Value.
If a path is wrong, a red message appears and you can't save.
- Run
5-2Token usage and cost (optional)
- Enter the
Input TokensandOutput Tokenspaths. - Enter the price per 1M tokens and check the estimated cost.
- Enter the
5-3Save
- Click
Save. The Version changes toReady.
- Click
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.
| Method | Description |
|---|---|
Load Model | Loads a model registered in the portal. |
Load Agent | Loads an Agent registered in the portal and that Agent's Version. |
Add Custom API | Enter the API manually. Same as 3. API integration per Version. |
6-1Connection method
- Select
Load Model,Load Agent, orAdd Custom API.
Add Custom APIis the same as 3. API integration per Version.- Select
6-1Load a model
- Select a model in
Model List. You can't selectDeletedmodels. - Click
Validate & Load.
- Select a model in
6-2Load an Agent
- Select an Agent in
Agent Listand clickNext. - Select a Version in
Agent Version Listand clickValidate & Load.
- Select an Agent in
6-3Output Key mapping
- Map paths with the
response_1.prefix and clickSave.
If you select with
Pick from response, the prefix is added automatically.- Map paths with the
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 variablesat 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
messagesarray, 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 Valuebefore 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.