diff --git a/python/packages/autogen-core/docs/src/user-guide/autogenstudio-user-guide/faq.md b/python/packages/autogen-core/docs/src/user-guide/autogenstudio-user-guide/faq.md index fe79af941..26c52628d 100644 --- a/python/packages/autogen-core/docs/src/user-guide/autogenstudio-user-guide/faq.md +++ b/python/packages/autogen-core/docs/src/user-guide/autogenstudio-user-guide/faq.md @@ -52,14 +52,14 @@ Have a local model server like Ollama, vLLM or LMStudio that provide an OpenAI c "component_type": "model", "model_capabilities": { "vision": false, - "function_calling": false, + "function_calling": true, "json_output": false } } ``` ```{caution} -It is important that you add the `model_capabilities` field to the model client specification for custom models. This is used by the framework instantiate and use the model correctly. +It is important that you add the `model_capabilities` field to the model client specification for custom models. This is used by the framework instantiate and use the model correctly. Also, the `AssistantAgent` and many other agents in AgentChat require the model to have the `function_calling` capability. ``` ## Q: The server starts but I can't access the UI diff --git a/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py b/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py index 99e8e13fe..f6058588a 100644 --- a/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py +++ b/python/packages/autogen-ext/src/autogen_ext/agents/openai/_openai_assistant_agent.py @@ -29,8 +29,8 @@ from autogen_agentchat.messages import ( MultiModalMessage, StopMessage, TextMessage, - ToolCallRequestEvent, ToolCallExecutionEvent, + ToolCallRequestEvent, ) from autogen_core import CancellationToken, FunctionCall from autogen_core.models._types import FunctionExecutionResult diff --git a/python/packages/autogen-studio/autogenstudio/cli.py b/python/packages/autogen-studio/autogenstudio/cli.py index 90f4331f0..24e0d5549 100644 --- a/python/packages/autogen-studio/autogenstudio/cli.py +++ b/python/packages/autogen-studio/autogenstudio/cli.py @@ -54,7 +54,7 @@ def ui( @app.command() def serve( - workflow: str = "", + team: str = "", host: str = "127.0.0.1", port: int = 8084, workers: int = 1, @@ -64,9 +64,9 @@ def serve( Serve an API Endpoint based on an AutoGen Studio workflow json file. Args: - workflow (str): Path to the workflow json file. + team (str): Path to the team json file. host (str, optional): Host to run the UI on. Defaults to 127.0.0.1 (localhost). - port (int, optional): Port to run the UI on. Defaults to 8081. + port (int, optional): Port to run the UI on. Defaults to 8084 workers (int, optional): Number of workers to run the UI with. Defaults to 1. reload (bool, optional): Whether to reload the UI on code changes. Defaults to False. docs (bool, optional): Whether to generate API docs. Defaults to False. @@ -74,7 +74,11 @@ def serve( """ os.environ["AUTOGENSTUDIO_API_DOCS"] = str(docs) - os.environ["AUTOGENSTUDIO_WORKFLOW_FILE"] = workflow + os.environ["AUTOGENSTUDIO_TEAM_FILE"] = team + + # validate the team file + if not os.path.exists(team): + raise ValueError(f"Team file not found: {team}") uvicorn.run( "autogenstudio.web.serve:app", diff --git a/python/packages/autogen-studio/autogenstudio/database/component_factory.py b/python/packages/autogen-studio/autogenstudio/database/component_factory.py index 2c42cf807..b954b39c0 100644 --- a/python/packages/autogen-studio/autogenstudio/database/component_factory.py +++ b/python/packages/autogen-studio/autogenstudio/database/component_factory.py @@ -326,21 +326,19 @@ class ComponentFactory: async def load_agent(self, config: AgentConfig, input_func: Optional[Callable] = None) -> AgentComponent: """Create agent instance from configuration.""" - system_message = config.system_message if config.system_message else "You are a helpful assistant" + model_client = None + system_message = None + tools = [] + if hasattr(config, "system_message") and config.system_message: + system_message = config.system_message + if hasattr(config, "model_client") and config.model_client: + model_client = await self.load(config.model_client) + if hasattr(config, "tools") and config.tools: + for tool_config in config.tools: + tool = await self.load(tool_config) + tools.append(tool) try: - # Load model client if specified - model_client = None - if config.model_client: - model_client = await self.load(config.model_client) - - # Load tools if specified - tools = [] - if config.tools: - for tool_config in config.tools: - tool = await self.load(tool_config) - tools.append(tool) - if config.agent_type == AgentTypes.USERPROXY: return UserProxyAgent( name=config.name, diff --git a/python/packages/autogen-studio/autogenstudio/web/managers/connection.py b/python/packages/autogen-studio/autogenstudio/web/managers/connection.py index bc1ae0ac5..271b53d87 100644 --- a/python/packages/autogen-studio/autogenstudio/web/managers/connection.py +++ b/python/packages/autogen-studio/autogenstudio/web/managers/connection.py @@ -12,8 +12,8 @@ from autogen_agentchat.messages import ( MultiModalMessage, StopMessage, TextMessage, - ToolCallRequestEvent, ToolCallExecutionEvent, + ToolCallRequestEvent, ) from autogen_core import CancellationToken from autogen_core import Image as AGImage diff --git a/python/packages/autogen-studio/autogenstudio/web/serve.py b/python/packages/autogen-studio/autogenstudio/web/serve.py index 462615378..e75285f15 100644 --- a/python/packages/autogen-studio/autogenstudio/web/serve.py +++ b/python/packages/autogen-studio/autogenstudio/web/serve.py @@ -6,23 +6,23 @@ import os from fastapi import FastAPI from ..datamodel import Response -from ..workflowmanager import WorkflowManager +from ..teammanager import TeamManager app = FastAPI() -workflow_file_path = os.environ.get("AUTOGENSTUDIO_WORKFLOW_FILE", None) +team_file_path = os.environ.get("AUTOGENSTUDIO_TEAM_FILE", None) -if workflow_file_path: - workflow_manager = WorkflowManager(workflow=workflow_file_path) +if team_file_path: + team_manager = TeamManager() else: - raise ValueError("Workflow file must be specified") + raise ValueError("Team file must be specified") @app.get("/predict/{task}") async def predict(task: str): response = Response(message="Task successfully completed", status=True, data=None) try: - result_message = workflow_manager.run(message=task, clear_history=False) + result_message = await team_manager.run(task=task, team_config=team_file_path) response.data = result_message except Exception as e: response.message = str(e) diff --git a/python/packages/autogen-studio/frontend/package.json b/python/packages/autogen-studio/frontend/package.json index 5beb6e620..98d7d00ec 100644 --- a/python/packages/autogen-studio/frontend/package.json +++ b/python/packages/autogen-studio/frontend/package.json @@ -42,6 +42,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-markdown": "^9.0.1", + "react-syntax-highlighter": "^15.6.1", "tailwindcss": "^3.4.14", "yarn": "^1.22.22", "zustand": "^5.0.1" @@ -51,7 +52,7 @@ "@types/node": "^22.9.0", "@types/react": "^18.2.55", "@types/react-dom": "^18.2.19", - "@types/react-syntax-highlighter": "^15.5.10", + "@types/react-syntax-highlighter": "^15.5.13", "@types/uuid": "^10.0.0", "typescript": "^5.3.3" } diff --git a/python/packages/autogen-studio/frontend/src/components/sidebar.tsx b/python/packages/autogen-studio/frontend/src/components/sidebar.tsx index 7fbef8c57..8071cb502 100644 --- a/python/packages/autogen-studio/frontend/src/components/sidebar.tsx +++ b/python/packages/autogen-studio/frontend/src/components/sidebar.tsx @@ -10,6 +10,7 @@ import { PanelLeftClose, PanelLeftOpen, GalleryHorizontalEnd, + Rocket, } from "lucide-react"; import Icon from "./icons"; @@ -43,6 +44,12 @@ const navigation: INavItem[] = [ icon: GalleryHorizontalEnd, breadcrumbs: [{ name: "Gallery", href: "/gallery", current: true }], }, + { + name: "Deploy", + href: "/deploy", + icon: Rocket, + breadcrumbs: [{ name: "Deploy", href: "/deploy", current: true }], + }, ]; const classNames = (...classes: (string | undefined | boolean)[]) => { diff --git a/python/packages/autogen-studio/frontend/src/components/views/deploy/guides/docker.tsx b/python/packages/autogen-studio/frontend/src/components/views/deploy/guides/docker.tsx new file mode 100644 index 000000000..64b7d520b --- /dev/null +++ b/python/packages/autogen-studio/frontend/src/components/views/deploy/guides/docker.tsx @@ -0,0 +1,66 @@ +import React from "react"; +import { Alert } from "antd"; +import { CodeSection, copyToClipboard } from "./guides"; + +const DockerGuide: React.FC = () => { + return ( +
{description}
} + {code && ( +