-
Notifications
You must be signed in to change notification settings - Fork 5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add react-flow * update tutorial, some ui improvement for agent thread layout * v1 for interactive viz for agent state * add Ui visualization of message based transitions * minor updates * fix node edges, support visualization of self loops * improve edges and layout, add support for selector group chat prompt * minor ui tweaks * ui and layout updates * ugrade dependencies to fix dependabot scan errors * persist sidebar, enable contentbar title mechanism #4191 * add support for user proxy agent, support human in put mode. #4011 * add UI support for human input mode via a userproxy agent #4011 * version update * fix db initialization bug * support for human input mode in UI, fix backend api route minor bugs * update pyproject toml and uv lock * readme update, support full screen mode for agent visualiation * update uv.lock
- Loading branch information
1 parent
d55e68f
commit 2997c27
Showing
43 changed files
with
3,151 additions
and
1,011 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
python/packages/autogen-studio/autogenstudio/components/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .agents.userproxy import UserProxyAgent |
Empty file.
47 changes: 47 additions & 0 deletions
47
python/packages/autogen-studio/autogenstudio/components/agents/userproxy.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
from typing import Callable, List, Optional, Sequence, Union, Awaitable | ||
from inspect import iscoroutinefunction | ||
|
||
from autogen_agentchat.agents import BaseChatAgent | ||
from autogen_agentchat.base import Response | ||
from autogen_agentchat.messages import ChatMessage, TextMessage | ||
from autogen_core.base import CancellationToken | ||
import asyncio | ||
|
||
|
||
class UserProxyAgent(BaseChatAgent): | ||
"""An agent that can represent a human user in a chat.""" | ||
|
||
def __init__( | ||
self, | ||
name: str, | ||
description: Optional[str] = "a", | ||
input_func: Optional[Union[Callable[..., str], | ||
Callable[..., Awaitable[str]]]] = None | ||
) -> None: | ||
super().__init__(name, description=description) | ||
self.input_func = input_func or input | ||
self._is_async = iscoroutinefunction( | ||
input_func) if input_func else False | ||
|
||
@property | ||
def produced_message_types(self) -> List[type[ChatMessage]]: | ||
return [TextMessage] | ||
|
||
async def _get_input(self, prompt: str) -> str: | ||
"""Handle both sync and async input functions""" | ||
if self._is_async: | ||
return await self.input_func(prompt) | ||
else: | ||
return await asyncio.get_event_loop().run_in_executor(None, self.input_func, prompt) | ||
|
||
async def on_messages(self, messages: Sequence[ChatMessage], cancellation_token: CancellationToken) -> Response: | ||
|
||
try: | ||
user_input = await self._get_input("Enter your response: ") | ||
return Response(chat_message=TextMessage(content=user_input, source=self.name)) | ||
except Exception as e: | ||
# Consider logging the error here | ||
raise RuntimeError(f"Failed to get user input: {str(e)}") from e | ||
|
||
async def on_reset(self, cancellation_token: CancellationToken) -> None: | ||
pass |
2 changes: 1 addition & 1 deletion
2
python/packages/autogen-studio/autogenstudio/database/__init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .db_manager import DatabaseManager | ||
from .component_factory import ComponentFactory | ||
from .component_factory import ComponentFactory, Component | ||
from .config_manager import ConfigurationManager |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.