> For the complete documentation index, see [llms.txt](https://docs.agentalk.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.agentalk.io/ai-agents/agent-functions.md).

# Agent functions

Agent functions define the actions an agent can take during a live call.

Instead of only responding to the caller, functions allow the agent to perform actions such as ending a call, saving data, transferring the caller, or retrieving information from another system.

A function runs when its trigger condition is met. This condition is written in plain language and describes when the agent should activate the function during a conversation.

### Function types

Agentalk provides four function types that cover most call scenarios.

| Function           | What it does                                                                   | Common use case                                        |
| ------------------ | ------------------------------------------------------------------------------ | ------------------------------------------------------ |
| **End Call**       | Ends the call when a trigger condition is met                                  | End the call when the caller says goodbye              |
| **Update Contact** | Extracts information from the conversation and writes it to the contact record | Capture details like name, company, or interest        |
| **Transfer Call**  | Forwards the call to a specified phone number                                  | Connect the caller to a human agent or specific team   |
| **External API**   | Calls a third-party API and uses the response during the call                  | Check availability, look up data, or trigger workflows |

### Trigger conditions

Every function includes a trigger condition, which defines when the agent should activate it during a call. These conditions are written in natural language, not code.

Well-defined trigger conditions are specific and unambiguous. They help prevent incorrect activations and ensure the agent acts at the right moment.

| Less effective                    | More effective                                                                 |
| --------------------------------- | ------------------------------------------------------------------------------ |
| When the call ends                | When the caller says goodbye, thank you, or indicates they are done            |
| When the user wants help          | When the caller asks to speak with a human agent or requests to be transferred |
| When the caller gives information | When the caller provides their company name during the conversation            |

### Function categories

Agentalk supports two categories of functions depending on how they are configured and where they operate.

#### Built-in functions

End Call, Update Contact and Transfer Call are configured entirely within Agentalk. They do not require any external setup or credentials.

#### External API functions

External API functions connect to a URL you provide. They require an endpoint that accepts a request from Agentalk, processes it, and returns a response the agent can use.

See [**Connect external APIs as functions**](/ai-agents/agent-functions/connect-external-apis-as-functions.md) for setup details.

### Next steps

Here are the recommended next steps to continue learning about agent functions:

* [**Use built-in functions**](/ai-agents/agent-functions/use-built-in-functions.md): Configure core actions like ending calls, updating contacts, and transferring calls.
* [**Connect external APIs as functions**](/ai-agents/agent-functions/connect-external-apis-as-functions.md): Extend your agent with real-time data and integrations.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.agentalk.io/ai-agents/agent-functions.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
