Rajan 31d2d37d88
[CAP] Improved AutoGen Agents support & Pip Install (#2711)
* 1) Removed most framework sleeps 2) refactored connection code

* pre-commit fixes

* pre-commit

* ignore protobuf files in pre-commit checks

* Fix duplicate actor registration

* refactor change

* Nicer printing of Actors

* 1) Report recv_multipart errors 4) Always send 4 parts

* AutoGen generate_reply expects to wait indefinitely for an answer.  CAP can wait a certain amount and give up.   In order to reconcile the two, AutoGenConnector is set to wait indefinitely.

* pre-commit formatting fixes

* pre-commit format changes

* don't check autogenerated proto py files

* Iterating on CAP interface for AutoGen

* User proxy must initiate chat

* autogencap pypi package

* added dependencies

* serialize/deserialize dictionary elements to json when dealing with ReceiveReq

* 1) Removed most framework sleeps 2) refactored connection code

* Nicer printing of Actors

* AutoGen generate_reply expects to wait indefinitely for an answer.  CAP can wait a certain amount and give up.   In order to reconcile the two, AutoGenConnector is set to wait indefinitely.

* pre-commit formatting fixes

* pre-commit format changes

* Iterating on CAP interface for AutoGen

* User proxy must initiate chat

* autogencap pypi package

* added dependencies

* serialize/deserialize dictionary elements to json when dealing with ReceiveReq

* pre-commit check fixes

* fix pre-commit issues

* Better encapsulation of logging

* pre-commit fix

* pip package update
2024-05-19 13:34:39 +00:00

23 lines
665 B
Python

import time
from autogen import ConversableAgent
from ..DebugLog import Info, Warn
from .CAP2AG import CAP2AG
class Agent:
def __init__(self, agent: ConversableAgent, counter_party_name="user_proxy", init_chat=False):
self._agent = agent
self._the_other_name = counter_party_name
self._agent_adptr = CAP2AG(
ag_agent=self._agent, the_other_name=self._the_other_name, init_chat=init_chat, self_recursive=True
)
def register(self, network):
Info("Agent", f"Running Standalone {self._agent.name}")
network.register(self._agent_adptr)
def running(self):
return self._agent_adptr.run