Skip to main content

A Email agent for AutoGen

Project description

autogen-ext-email is a Python package that provides an agent capable of generating images, attaching files, drafting reports, and sendind emails to multiple recipients or specific users based on their queries. This feature is highly beneficial for customer management and email marketing, enhancing automation and improving efficiency.

Installation

To install the package from the GitHub repository, use the following command:

pip install autogen-ext-email

Example

from autogen_ext_email import EmailAgent,EmailConfig
from autogen_ext.models.openai import OpenAIChatCompletionClient
from autogen_agentchat.teams import RoundRobinGroupChat
from autogen_agentchat.base import TaskResult
from autogen_agentchat.conditions import TextMentionTermination
import asyncio
model_client = OpenAIChatCompletionClient(
        api_key=api_key,
        parallel_tool_calls=False,
    )
# img_base_url and img_api_key is from https://www.aliyun.com/product/bailian, or you can change your image generating method by yourself.
e_agent = EmailAgent(name='email_agent', 
                     model_client=model_client,
                     email_config=EmailConfig(
                         email='masquerlin@gmail.com', 
                         password='xxxxxxxxxxxx', server='smtp.gmail.com', 
                         port=587),
                     img_base_url=img_base_url,
                     img_api_key=img_api_key)

async def main():
    text_termination = TextMentionTermination("TERMINATE")
    team = RoundRobinGroupChat([e_agent], termination_condition=text_termination)
    async for message in team.run_stream(task="generate an report about autogen and send it to 'masquerlin@gmail.com'"): 
        if isinstance(message, TaskResult):
            print("Stop Reason:", message.stop_reason)
        elif 'PASS_TOUSER' in message.content:
            print(message)
asyncio.run(main())

Usage

See example.py for a simple example of how to use this agent. Note, this example requires the OpenAI client, so please install the relevant extension.

License

This project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

autogen_ext_email-0.1.1.tar.gz (11.5 kB view details)

Uploaded Source

Built Distribution

autogen_ext_email-0.1.1-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file autogen_ext_email-0.1.1.tar.gz.

File metadata

  • Download URL: autogen_ext_email-0.1.1.tar.gz
  • Upload date:
  • Size: 11.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for autogen_ext_email-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6fe4661997dce0426f17b7d7c5c75c3421cf5bd5ca738cafc36c5f17d9c79cb2
MD5 ec8b98272c394674dfda957a779c1aaa
BLAKE2b-256 3b8cc99359ec005ade03313a1045111022e49c93bffe5755d24d0be8611b2aad

See more details on using hashes here.

File details

Details for the file autogen_ext_email-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for autogen_ext_email-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 559cf2d069a2c1b48af9a323df32ad2b90e83c79cc7bb8b05ac87ea958c1d25c
MD5 97a1e9f881f03bb45e8235665ba751b0
BLAKE2b-256 c546144b7b3e5b04409887024dc950a7534c13a7840ff00764ddaf80dd1fc274

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page