Skip to main content

How to Create Agents

This guide delves into the advanced topic of creating agents within the XpressAI platform.

Prerequisites

Before proceeding with this tutorial, familiarity with Xircuits is recommended. If you're new to the platform or in need of a refresher, it is highly recommended to first go through the following resources:

  • Xircuits Quickstart Guide: This guide introduces the basics of the Xircuits platform, assisting you in getting comfortable with its interface and core functionalities. Understanding how to read Xircuits execution flows and how to update parameters is essential.

  • How to Create Chatbots Tutorial: This tutorial makes use of the converse component library, which will be utilized for our agent. It also covers events, deployment, and interaction with agents.

Initializing Agent Development with a Template

For this tutorial we'll utilize a pre-defined template in Xircuits:

  1. Navigate to the Settings > Projects > Create new Project.
  2. Enter the Project Name and Project Domain, then choose the Simple Agent template for your new project. Press the Create Project.

Spinning up the project will take a few minutes. Once done, select the new template from the sidebar.

Creating Your Agent

The agent template is structured to guide you through the process of creating a multifunctional agent. It includes several key components, each serving a specific role in the operation of the agent. Comments within the template are numbered to assist you in navigating the sections in the correct sequence. The general flow for creating an agent is as follows:

  1. Define the Agent's Purpose: Start by specifying what your agent is designed to do and how it will interact with users and respond to queries. For example, in the template:

    You are a meeting assistant, with access to tools to help your user schedule their meetings.

    To use a tool write TOOL: in one line followed by the tool name and arguments, the system will respond with the results.

    Example:
    user:
    What time is it?
    assistant:
    TOOL: get_current_time
    system:
    2024-03-29T11:35:17.114466+00:00
    assistant:
    It's March 29th, 11:35 AM UTC.

    End of example

    Example:
    user:
    What time is it in Japan?
    assistant:
    TOOL: get_current_time
    system:
    2024-03-29T20:35:17.114466+00:00
    assistant:
    The time offset from UTC to Japan is +9 hours. Therefore, it's March 29th, 8:35 PM in Japan now.

    End of example

    You have access to the following tools: {tools}

    From experience, providing examples enhance the response.

  2. Define Tool Definition: Tools are essentially the skills or functionalities your agent can use to carry out specific tasks. In the AgentDefineTool component, give your tool a name and a description of what it does.

An Example of an Agent Tool

  1. Implement Tools: Finally, make the tools operational within your agent by using pre-existing components or develop custom ones. Connect components from the AgentDefineTool component to the AgentToolOutput. Ensure that the components connected logic correspond to the definition provided in AgentDefineTool.

You may create as many tools as you wish. The agent will choose based on the definition provided.

These three steps are the main focus when developing an agent. The remaining steps in the template, including making the agent accessible and emitting responses, provide further guidance for deployment.

Deploying and Interacting with Your Agent

Once you have customized the template to fit your specific use case, deploy via Agent interface. Test its functionalities thoroughly using various queries and ensure that it responds accurately and efficiently.

Interacting with your Agent

Conclusion

By following this guide and understanding each section of the agent template, you can create sophisticated agents capable of handling complex interactions and tasks. The flexibility of Xircuits allows you to expand and tailor the agent's capabilities to meet a wide range of needs, unlocking the potential for innovative and powerful applications.