Improve your AI Agent’s skills using Tool Actions

Picture11.png

Cognigy AI Agents cannot just communicate well and answer questions, but also perform complex tasks, possibly integrated with business services and systems. In order to give an AI Agent the skills to do so, we need to assign Tool Actions to the AI Agent.

Simply put, a Tool Action gives the AI Agent the ability to reach out and perform a structured process, such as communicating with a backend system. Tool Actions may have parameters, and the AI Agent will collect the parameters before calling the Tool Action.

The AI Agent selects a tool based on its description and parameters, and from there, it's up to you to decide how the further processing is handled. You can leverage the full capabilities of Cognigy.AI to call services, run scripts, handover to a human agent or another AI Agent, or respond to the user's request using a Say I the tool’s branch.

In this chapter, we'll guide you through the creation of two Tool Actions:

  • Track parcel
  • Escalate to human

Each parameter is defined according to the following tables:

Tool ID track_parcel
Description This tool tracks and provides the status of a parcel or package.
Parameters (Name, Type, and Description) tracking_code
String
The ID, number, or tracking code of the parcel.

 

Tool ID escalate_to_human
Description This tool escalates issues to a human representative for resolution.
Parameters (Name, Type, and Description) generated_summary
String
A generated summary of the user's inquiry for handover to a human agent.

 

To create the "track_parcel" Tool Action, follow these steps:

  1. Add Tool Action.
    Click the plus sign next to your AI Agent to add a Tool Action.

  2. Configure Tool Action.
    Assign the Tool ID “track_parcel” and add the description “This tool tracks and provides the status of a parcel or package.”

  3. Enable Parameters.
    Activate the “Use Parameters” toggle, which will enable the parameters.

  4. Add Parameter.
    Open the Parameters section and add a parameter “tracking_code” of type “String” with the description “The ID, number, or tracking code of the parcel.”.

  5. Resolve Tool Action.
    Add a “Resolve Tool Action” Node to the branch and enter “The package will arrive in two days.” into the “Answer Text” field. This will signal the AI Agent that the action was completed, and the AI Agent will answer based on this information.

You have now completed creating the track_parcel Tool Action, which is available for the AI Agent to use when needed. Test the functionality by chatting with the agent—mention that you’d like to track a parcel and observe how it responds.

To add the escalate_to_human Tool Action, follow the same steps using the settings provided in the table above:

  1. Add Tool Action.
    Click the plus sign next to your AI Agent to add a Tool Action.

  2. Configure Tool Action.
    Assign the Tool ID “escalate_to_human” and add the description “This tool escalates issues to a human representative for resolution.”.

  3. Enable Parameters.
    Activate the “Use Parameters” toggle, which will enable the parameters.

  4. Add Parameter.
    Open the Parameters section and add a parameter “generated_summary” of type “String” with the description “A generated summary of the user's inquiry for handover to a human agent”.

  5. Simulate an escalation or handover.
    Now, add a Say Node to the branch and enter “I have forwarded your issue ‘{{input.aiAgent.toolArgs.generated_summary}}’.” into the Text field to simulate a handover. The CognigyScript inside the double curly braces accesses the tool parameter and integrates it into the text.

Whenever the AI Agent determines that escalating to a human is appropriate – such as when you request to speak with a human – the conversation will now be handled through this Tool Action.

Note that the parameters can be extracted or generated by the AI Agent. In the examples above, tracking code could be extracted, but generated_summary is generated. By applying this, you can save yourself additional LLM calls.


➡️ To further improve your AI Agent, make them understand images.


Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
0 out of 0 found this helpful