Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Weni Agents Toolkit

CI CD PyPI version Python Versions License: MIT

A Python library for creating and managing agent skills for the Weni platform. Build powerful conversational agents with type-safe components and a robust skill system.

Installation

pip install weni-agents-toolkit

Or with Poetry:

poetry add weni-agents-toolkit

Quick Start

Creating a Skill

import requests
from weni import Skill
from weni.context import Context
from weni.components import Text, QuickReplies
from weni.data import register_result

class GetAddress(Skill):

    def execute(self, context: Context):
        # This is how we would retrieve credentials or sensitive information from context
        token = context.credentials.get("X-App-Token")

        # This is how we would retrieve parameters for this agent tool
        cep = context.parameters.get("cep")

        # This is how we would retrieve global constants for this project
        api_url = context.globals.get("cep_api_url")

        # This block is the business logic for the sake of this example on retrieving an address based on the received CEP
        base_url = f"{api_url}/{cep}"
        response = requests.get(base_url, headers={"Authorization": f"Bearer {token}"})

        result = response.json()

        # This block is where data is registered for further analysis in the future
        register_result("address", result.get("street"))
        # This example I'm respoonding allowing quick replies message or a location
        return TextResponse(data=result)

Registering Events

Register analytics events to the Weni Datalake using self.register_event() inside your tool:

from weni import Tool
from weni.context import Context
from weni.events.event import Event
from weni.responses import TextResponse

class MyTool(Tool):
    def execute(self, context: Context):
        result = do_work()

        self.register_event(Event(
            event_name="order_placed",
            key="order_123",
            value_type="string",
            value="completed",
            metadata={"customer": "John Doe"},
        ))

        return TextResponse(data=result)

Parameters:

  • event_name: Event name.
  • key: Unique key for the event.
  • value_type: Value type (string, int, etc).
  • value: Event value.
  • metadata: (Optional) Additional event metadata.
  • date: (Optional) ISO 8601 date string (defaults to current time).

Events are collected automatically per tool execution with full isolation between Lambda warm starts.

Core Concepts

Context System

The context system provides secure access to:

context = Context(
    credentials={"api_key": "secret123"},     # Sensitive data
    parameters={"user_id": "123"},            # Skill parameters
    globals={"env": "production"}             # Global configuration
)

Available Components

  • Text: Basic text messages
  • QuickReplies: Interactive quick reply buttons
  • ListMessage: Interactive list menus
  • CTAMessage: Call-to-action messages
  • Location: Location request messages
  • OrderDetails: Order information messages
  • Attachments: File attachments
  • Header: Message headers
  • Footer: Message footers

Response Types

  • TextResponse: Simple text messages
  • QuickReplyResponse: Messages with quick reply buttons
  • ListMessageResponse: Interactive list menus
  • CTAMessageResponse: Call-to-action messages
  • LocationResponse: Location-based messages
  • OrderDetailsResponse: Order information displays

Development

Prerequisites

  • Python 3.9+
  • Poetry

Setup

  1. Clone the repository:
git clone https://github.com/weni-ai/agents-toolkit.git
cd agents-toolkit
  1. Install dependencies:
poetry install
  1. Run tests:
poetry run pytest

Code Quality

We use several tools to ensure code quality:

  • pytest for testing
  • mypy for type checking
  • ruff for linting

Run all checks:

poetry run pytest
poetry run mypy weni
poetry run ruff check .

Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Metadata

Release files for weni-agents-toolkit 2.11.0a0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for weni-agents-toolkit 2.11.0a0
File Size Uploaded Provenance Actions
weni_agents_toolkit-2.11.0a0.tar.gz 35.9 kB Without provenance Details for weni_agents_toolkit-2.11.0a0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for weni-agents-toolkit 2.11.0a0
File Interpreter ABI Platform Actions
weni_agents_toolkit-2.11.0a0-py3-none-any.whl Python 3 none any Details for weni_agents_toolkit-2.11.0a0-py3-none-any.whl

Total release size: 82.3 kB

Release files / weni_agents_toolkit-2.11.0a0.tar.gz

Download URL weni_agents_toolkit-2.11.0a0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
3db752049412430d9b3a9b82345133a0ab03c13b3319e0f201930a3f4e4ac07b
BLAKE2b-256 checksum
How to use checksums
e10f4cfb1be8da849689358de73ea3fc7fe4cd337707c3da26981698fed7004f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.17 Linux/7.0.0-1017-azure

Release files / weni_agents_toolkit-2.11.0a0-py3-none-any.whl

Download URL weni_agents_toolkit-2.11.0a0-py3-none-any.whl
Size 46.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cd950cecc75314751a5fe1f8c6027b890b1b11b1c3733862d4caf44bff3c774b
BLAKE2b-256 checksum
How to use checksums
ae7c50f337c1c47b46a3f1d8b11da3cca45efc6bd18a4dce8757673b14a5c436
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.5 CPython/3.13.17 Linux/7.0.0-1017-azure

Security for weni-agents-toolkit 2.11.0a0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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