Tutorial: Creating a CEP Query Agent

José David Updated by José David

This tutorial will guide you step by step to create, understand, and deploy your first agent, an assistant that retrieves addresses from a Brazilian postal code (CEP).

Step 1: Set Up Your Project

First, you need to select which project in the Weni Platform you’ll be working on.

# List all projects you have access to 
weni project list

# Select a project using its UUID
weni project use YOUR_PROJECT_UUID

# Verify that the correct project is selected
weni project current
The project UUID is the unique identifier for each project. You can find it in the project’s URL: https://dash.weni.ai/projects/PROJECT_UUID/agent-builder/init

Step 2: Create the Agent Structure with weni init

The init command is the fastest way to get started. It creates all the necessary files with example code.

weni init

This command generates a folder structure like this:

.
├── agent_definition.yaml
└── tools/
└── get_address/
├── main.py
└── requirements.txt

Step 3: Understanding the Created Files

weni init has generated two main components:

  1. agent_definition.yaml: This is the brain that defines what your agent is and what it can do. It contains its name, instructions, and the tools it uses.
    To learn more, check our complete guide on the Anatomy of an Agent#######.
  2. tools/get_address: Contains the Python code that performs the tool’s logic (querying the CEP API).
    For a deeper understanding, read our guide on Tools.########

Step 4: Deploy Your First Agent

Congratulations! You now have a functional agent. To deploy it to your project, simply run:

weni project push agent_definition.yaml

Your agent is now available on the Weni Platform, and you can find it in the Custom Agents section.

How did we do?

Contact