Skip to main content

Weni-CLI

Weni CLI is a highly powerful tool for creating customized AI multi-agents. This command-line interface enables developers to build, deploy, and manage sophisticated AI agents with tailored tools and functionalities across various communication channels. With Weni CLI, you can rapidly prototype, develop, and deploy agents that perfectly match your business requirements and use cases.

For comprehensive guidance and detailed documentation, we strongly recommend visiting our official documentation: https://weni-ai.github.io/weni-cli/

Overview

A command-line interface (CLI) tool to manage and interact with projects on the Weni platform.

Requirements

  • Python >= 3.10
  • Poetry >= 1.8.5

Installation

Install via PIP

You can install the CLI directly using pip:

pip install weni-cli

Manual Installation

  1. Clone the repository:

    git clone https://github.com/weni-ai/weni-cli.git
    cd weni-cli
    
  2. Install dependencies and make the CLI executable:

    poetry shell
    poetry install
    

Quick Start [Step by Step]

After setting up your environment, follow these steps to create your first agent:

1. Login to Weni

weni login

This will open your browser for authentication. After successful login, you can close the browser tab.

2. List Available Projects

weni project list

This command will show all projects you have access to. Note down the UUID of the project you want to work with.

3. Select Your Project

weni project use your-project-uuid

Replace your-project-uuid with the UUID from the project list.

4. Verify Current Project

weni project current

This ensures you're working with the correct project.

5. Create Your Agent Definition

Create a file named agent_definition.yaml with this content:

agents:
  sample_agent:
    name: "CEP Agent"
    description: "Weni's sample agent"
    instructions:
      - "You are an expert in providing addresses to the user based on a postal code provided by the user"
      - "The user will send a ZIP code (postal code) and you must provide the address corresponding to this code."
    guardrails:
      - "Don't talk about politics, religion or any other sensitive topic. Keep it neutral."
    tools:
      - get_address:
          name: "Get Address"
          source: 
            path: "tools/get_address"
            entrypoint: "main.GetAddress"
          description: "Function to get the address from the postal code"
          parameters:
            - cep:
                description: "postal code of a place"
                type: "string"
                required: true
                contact_field: true

6. Create Your tool Folder

Create a folder for your tool:

mkdir -p tools/get_address

7. Create the tool Class

Create a file in tools/get_address named main.py with this content:

from weni import Tool
from weni.context import Context
from weni.responses import TextResponse
import requests


class GetAddress(Tool):
    def execute(self, context: Context) -> TextResponse:
        cep = context.parameters.get("cep", "")
        address_response = self.get_address_by_cep(cep=cep)
        return TextResponse(data=address_response)

    def get_address_by_cep(self, cep):
        url = f"https://viacep.com.br/ws/{cep}/json/"
        response = requests.get(url)
        return response.json()

Make sure the file folder matches the path specified in your agents.yaml file.

7.1 Create the requirements.txt file

Create a requirements.txt file in the same folder as your tool with the necessary dependencies:

requests==2.32.3

8. Upload Your Agent

weni project push agent_definition.yaml

That's it! You've just created your first agent with a custom tool using Weni-CLI.

The agent will now be able to:

  1. Receive a CEP (postal code) from the user
  2. Call the ViaCEP API through your tool
  3. Return the address information to the user

Features

  • Login: Authenticate with Weni to access your projects.
  • List projects: View a list of all projects available in your account.
  • Select project: Set the project to be used by the CLI.
  • Current project: Display information about the currently selected project.
  • Push project definition: Upload the agents definition file to the selected project.
  • Agent evaluation: Initialize and run agent evaluations with weni eval.

Usage

1. Login

Log in to your Weni account:

weni login

This will open your default browser for authentication. After successful login, you can close the browser tab.

2. List projects

View all projects associated with your account:

weni project list

3. Select project

Choose the project you want to work with:

weni project use <project-uuid>

Replace <project-uuid> with the UUID of your project from the list command.

4. View current project

Check the currently configured project:

weni project current

5. Push project definition

Upload a YAML definition file to the configured project:

weni project push <definition_file.yaml>

Replace <definition_file.yaml> with the path to your YAML definition file.

6. Initialize an evaluation plan

Create an agent_evaluation.yml test plan in the current directory:

weni eval init

This generates a file where you only need to define your tests:

tests:
  greeting:
    steps:
      - Send a greeting message to the agent
    expected_results:
      - Agent responds with a friendly greeting

You can also choose a directory:

weni eval init --plan-dir <path_to_directory>

7. Run agent evaluation

Run all tests from agent_evaluation.yml:

weni eval run

Common options:

# Run only specific tests
weni eval run --filter "greeting,checkout_flow"

# Verbose output with detailed reasoning
weni eval run --verbose

# Custom plan directory
weni eval run --plan-dir <plan_directory>

Agent Definition File Structure

Below is an example of a valid agent definition file structure:

agents:
  sample_agent:
    name: "Sample Agent"                                                                      # Maximum of 55 characters
    description: "Weni's sample agent"
    instructions:
      - "You should always be polite, respectful and helpful, even if the user is not."       # Minimum of 40 characters
      - "If you don't know the answer, don't lie. Tell the user you don't know."              # Minimum of 40 characters
    guardrails:
      - "Don't talk about politics, religion or any other sensitive topic. Keep it neutral."  # Minimum of 40 characters
    tools:
      - get_order_status:
          name: "Get Order Status"                                                            # Maximum of 40 characters
          source: 
            path: "tools/order_status"
            entrypoint: "main.GetOrderStatus"
          description: "Function to get the order status"
          parameters:
            - order_id:
                description: "Order ID"
                type: "string"
                required: true
      - get_order_details:
          name: "Get Order Details"                                                           # Maximum of 40 characters
          source: 
            path: "tools/order_details"
            entrypoint: "main.GetOrderDetails"
          description: "Function to get the order details"
          parameters:
            - order_id:
                description: "Order ID"
                type: "string"
                required: true

## Examples

- Log in and list projects:
  ```bash
  weni login
  weni project list
  • Set and check the current project:

    weni project use 12345678-1234-1234-1234-123456789012
    weni project current
    
  • Push a definition file:

    weni project push definition.yaml
    

Contributing

Contributions are welcome! Follow the steps below to contribute:

  1. Fork the repository.
  2. Create a branch for your feature or bug fix:
    git checkout -b my-feature
    
  3. Commit your changes:
    git commit -m "Description of my feature"
    
  4. Push your branch:
    git push origin my-feature
    
  5. Open a Pull Request in the original repository.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weni_cli-3.8.6.tar.gz (62.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

weni_cli-3.8.6-py3-none-any.whl (76.7 kB view details)

Uploaded Python 3

File details

Details for the file weni_cli-3.8.6.tar.gz.

File metadata

  • Download URL: weni_cli-3.8.6.tar.gz
  • Upload date:
  • Size: 62.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.13 Linux/6.17.0-1022-azure

File hashes

Hashes for weni_cli-3.8.6.tar.gz
Algorithm Hash digest
SHA256 2586c3e916322da8fa6ad065b68a7b67c14cc89eca0ba586ab0c7eabfc398abf
MD5 7cc7a8345675e350afee1ad21ee58089
BLAKE2b-256 c018c836bcada4358d001c432cffaafabddbef7a0f1c259c7ef8978288cd50c8

See more details on using hashes here.

File details

Details for the file weni_cli-3.8.6-py3-none-any.whl.

File metadata

  • Download URL: weni_cli-3.8.6-py3-none-any.whl
  • Upload date:
  • Size: 76.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.5 CPython/3.12.13 Linux/6.17.0-1022-azure

File hashes

Hashes for weni_cli-3.8.6-py3-none-any.whl
Algorithm Hash digest
SHA256 29e1afd350610201dcc30d25137c7bda553b3bb5a40bb0dd21d4a8f001d14f11
MD5 b65fc6781be1309f64694fbe2bdc073c
BLAKE2b-256 7373e19dc40f9cf87dfe0383d86e4cc209a4d5e9863b16b6f994677a82c331a5

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

3.8.6 This release

2 files

3.8.5

2 files

3.8.4

2 files

3.8.3

2 files

3.8.2

2 files

3.8.1

2 files

3.8.0

2 files

3.7.2

2 files

3.7.1

2 files

3.7.0

2 files

3.6.10

2 files

3.6.9

2 files

3.6.8

2 files

3.6.7

2 files

3.6.6

2 files

3.6.5

2 files

3.6.4

2 files

3.6.3

2 files

3.6.2

2 files

3.6.1

2 files

3.6.0

2 files

3.5.6

2 files

3.5.5

2 files

3.5.4

2 files

3.5.3

2 files

3.5.2

2 files

3.5.1

2 files

3.5.0

2 files

3.4.5

2 files

3.4.4

2 files

3.4.3

2 files

3.4.2

2 files

3.4.1

2 files

3.4.0

2 files

3.3.2

2 files

3.3.1

2 files

3.3.0

2 files

3.2.0

2 files

3.1.1

2 files

3.1.0

2 files

3.0.0

2 files

2.2.1

2 files

2.2.0

2 files

2.1.0

2 files

2.0.4

2 files

2.0.3

2 files

2.0.2

2 files

2.0.1

2 files

2.0.0

2 files

1.0.1

2 files

1.0.0

2 files

0.2.0

1 file

0.1.9

1 file

0.1.8

1 file

0.1.7

1 file

0.1.6

1 file

0.1.5

1 file

0.1.4

1 file

0.1.3

1 file

0.1.2

1 file

0.1.1

1 file

0.1.0

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page