> ## Documentation Index
> Fetch the complete documentation index at: https://koreai-content-gov.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Tools

Code Tools let you define custom logic using JavaScript or Python that agents can invoke as part of a workflow. They bridge the gap between LLM reasoning and deterministic, programmatic operations, enabling your agents to reliably transform data, call APIs, or run business logic.

## Step 1: Basic Info

Provide the basic details of the tool.

**Name**: Unique identifier for the tool.

**Description**: Briefly describe the tasks of the tool. This description is used by the LLM while selecting the tools for task execution.

## Step 2: Code and Config

**Runtime**: Select the execution environment for your tool's code. Agent Platform supports **JavaScript** and **Python**.

**Code**: Write the business logic for processing.

* You must define a `main()` function. This is the entry point the platform calls when the tool is invoked.
* The `main()` function must return a value. Example: `return main($param)`.
* Parameters are injected into the code using a $ prefix. For example, a parameter named customer_name is accessed as `$customer\_name\` in your code.

**Parameters**: Define the inputs this tool accepts. These parameters are sent to the LLM as a JSON Schema. The parameters are injected into the code using the \$ prefix.

Click + **Add** to add a new parameter manually, or click Parse to auto-detect parameters from your main() function signature.

| Field             | Description                                                                                                                                                  |
| ----------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| **Name**          | The parameter name, prefixed with $(for example.$data). This is how you reference it in code.                                                                |
| **Type**          | Data type - String, Number, Boolean, Object.                                                                                                                 |
| **Required**      | Toggle whether this parameter must always be provided.                                                                                                       |
| **Description**   | A natural-language description sent to the LLM to explain what this parameter represents (for example. "The customer's full name"). This field is mandatory. |
| **Default value** | An optional fallback value that is used if the parameter is not supplied.                                                                                    |

**Generated JSON Schema**

The platform automatically generates a JSON Schema from your defined parameters. You can inspect it by expanding **View Generated Input Schema**. This is sent to the LLM to describe the required parameters for the tool execution.

**Advanced Settings**

* **Return Type**: Specifies the data type of the value your tool returns. This is used in the DSL signature and the LLM schema. Common values: object, string, array, and boolean. Default: object
* **Memory (MB)**: The memory allocated to the tool's isolated container during execution, in megabytes. Default: 256
* **Timeout (ms)**: The maximum time (in milliseconds) the tool is allowed to run before it is terminated. Set this based on the expected complexity and latency of your tool's logic. Default: 5000.
* **Variable Namespace**: Namespace that the tool can access. By default, every tool can access ‘Default’ namespace.

## Step 3: Test & Review

Provide sample values for the input variables and **Run Test**. Verify the response from the tool. Check Logs and parameters for debugging purposes.
