# Custom Capabilities

Custom capabilities allow you to add new functionalities or modify existing ones. This is done by defining specific instructions for how your AI Agent should handle certain requests.

{% hint style="danger" %}
Interworky Custom Capabilities right now supports HTTP 1.1 Request Only - AKA REST APIs
{% endhint %}

### **Defining a Custom Capability**

<figure><img src="/files/cu9I5QCzovPyTyKdo0V9" alt="" width="375"><figcaption><p>Adding a Custom Capability</p></figcaption></figure>

Each custom capability requires several components:

#### **Capability Name:**

* Use a unique identifier without spaces (underscores can be used if needed).

Example: `user_login`, `report_incident`.

#### **Capability Description**

* Provide a clear, human-readable explanation of what the capability does.

Example: `This capability logs the user in with an email and password.`

{% hint style="info" %}
Aim for clarity to ensure that others understand the function.
{% endhint %}

#### **When to Use Capability**

* Explain the context or scenario in which the capability should be triggered.

Example: `Use this capability when a user requests to log in, or when email verification is needed.`

{% hint style="info" %}
This guidance helps ensure the capability is employed appropriately.
{% endhint %}

#### **Capability Endpoint**

* The end point where you capability is deployed

Example: `https://myserver.com/login`

{% hint style="info" %}
avoid adding trailing slashes to your endpoint
{% endhint %}

#### **Capability HTTP Verb**

* The HTTP Verb used for the request

{% hint style="info" %}
(POST, DELETE, GET, PUT) are the supported HTTP VERB at the moment
{% endhint %}

#### Capability Arguments (Dynamic Data)

When defining a custom capability, you must specify the data required to fulfill the request. \
\
This includes both the information explicitly defined by you (such as the user’s email or password) and data that is automatically extracted from your endpoint and authentication settings. \
\
Here’s how Interworky handles this:

• Automatic Extraction of Path Parameters:

If your capability endpoint includes parameters prefixed with a colon (for example, /api/:user-id/email/:user-email), Interworky automatically:

1. Identifies these colon-prefixed parameters.<br>
2. Converts parameter names by replacing any hyphens with underscores.<br>
3. Appends a suffix (e.g., \_INPATH) to clearly denote that the data is derived from the URL path.<br>
4. Marks these parameters as required and sets their type as a string, ensuring that they are captured during the conversation.

* Bearer Token Authentication Support:

For endpoints that require Bearer token authentication (tested with JWT):

1. Interworky detects whether the request requires a Bearer token.<br>
2. &#x20;If needed, it automatically adds a dynamic parameter named IW\_TOKEN (all uppercase), which is marked as a required string.

{% hint style="info" %}
IW\_TOKEN parameter is used to securely pass the JWT token in the authentication header.
{% endhint %}

By automatically handling these dynamic parameters, Interworky simplifies the process of integrating REST APIs into your AI Agent. \
\
The system ensures that all necessary data is gathered seamlessly during user interactions, allowing your backend to process requests accurately and efficiently.

Example: For a login capability, the AI Agent might need to gather the user’s `email` and `password`.

{% hint style="info" %}
The agent collects this information through natural language conversation and then sends the data to your backend. The backend processes the request and sends a response back to the AI Agent, which then presents the results to the user.
{% endhint %}

{% hint style="warning" %}
Interworky Custom Capabilities supports Bearer Token only and was tested against JWT only
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://interworky.gitbook.io/interworky-docs/features-overview/capabilities/custom-capabilities.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
