OpenAI Agents

Create an AI agent using OpenAI's models.

You can create custom AI agents using OpenAI Prompts saved on the OpenAI Console Chat page.

Setup Instructions

Before following these steps you should've created and saved a prompt on the OpenAI Console Chat page.
  1. Go to Agents in your user menu and click Add AI Agent.
  2. Select OpenAI Chat/Prompt.
  3. Provide an internal name for this agent.
  4. On the next page, add your OpenAI API Key and Prompt ID.
  5. Under Use with Channels assign channels you'd like to automate with this agent.
  6. Click Save for the changes to take effect.
  7. You can also test your agent by sending messages in the test area on the right hand side.

How to configure Human Handoff?

To hand off a user to a human agent, you must instruct the LLM to execute escalate_to_human function to trigger an escalation.

In your OpenAI Prompt,

  • Go to Tools> Add > Function.
  • Add below code under Definition.
  • You can change the description but the name must stay escalate_to_human.
{
  "name": "escalate_to_human",
  "description": "Call this function when the user explicitly requests to speak with a human agent, or if you are unable to resolve their query after multiple attempts.",
  "strict": false,
  "parameters": {
    "type": "object",
    "properties": {},
    "required": []
  }
}

Udpate the system instructions/message so that the LLM knows which tool to call for handoff.

Example System Instructions Addition:

To ensure the OpenAI agent escalates to a human properly, include explicit instructions in the System Prompt. For example:

If the user explicitly asks to speak to a human, or if you cannot resolve their issue after 3 attempts, call the escalate_to_human function.

Save and publish the prompt. Handoff application will take care of the rest.