Skip to content

Commit acb79c6

Browse files
committed
Expose more "plugins" as tools.
1 parent 234d1ef commit acb79c6

File tree

4 files changed

+15
-23
lines changed

4 files changed

+15
-23
lines changed

packages/python-packages/apiview-copilot/src/agent/_agent.py

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,17 @@
1313
from typing import Optional
1414

1515
from azure.ai.agents import AgentsClient
16-
from azure.ai.agents.models import MessageRole, MessageTextContent, ToolSet
16+
from azure.ai.agents.models import (
17+
FunctionTool,
18+
MessageRole,
19+
MessageTextContent,
20+
ToolSet,
21+
)
1722
from src._credential import get_credential
1823
from src._settings import SettingsManager
24+
from src.agent.tools._api_review_tools import ApiReviewTools
1925
from src.agent.tools._search_tools import SearchTools
26+
from src.agent.tools._utility_tools import UtilityTools
2027

2128

2229
async def invoke_agent(
@@ -88,13 +95,15 @@ def get_main_agent():
8895
credential = get_credential()
8996
client = AgentsClient(endpoint=endpoint, credential=credential)
9097

98+
# TODO: These were treated as subagents before and may not be applicable in the new format.
9199
# delete_agent = await stack.enter_async_context(get_delete_agent())
92100
# create_agent = await stack.enter_async_context(get_create_agent())
93101
# retrieve_agent = await stack.enter_async_context(get_retrieve_agent())
94102
# link_agent = await stack.enter_async_context(get_link_agent())
95103

96104
toolset = ToolSet()
97-
toolset.add(SearchTools().all_tools())
105+
tools = SearchTools().all_tools() + ApiReviewTools().all_tools() + UtilityTools().all_tools()
106+
toolset.add(FunctionTool(tools))
98107

99108
agent = client.create_agent(
100109
name="APIView Copilot Main Agent",
@@ -106,21 +115,6 @@ def get_main_agent():
106115
# enable all tools by default
107116
client.enable_auto_function_calls(tools=toolset)
108117

109-
# agent = AzureAIAgent(
110-
# client=client,
111-
# definition=agent_definition,
112-
# plugins=[
113-
# SearchPlugin(),
114-
# UtilityPlugin(),
115-
# ApiReviewPlugin(),
116-
# delete_agent,
117-
# create_agent,
118-
# retrieve_agent,
119-
# link_agent,
120-
# ],
121-
# polling_options=RunPollingOptions(run_polling_interval=timedelta(seconds=1)),
122-
# kernel=kernel,
123-
# )
124118
try:
125119
yield client, agent.id
126120
finally:

packages/python-packages/apiview-copilot/src/agent/tools/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This module initializes the plugins for the agent.
99
"""
1010

11-
from ._api_review_tools import ApiReviewTool
11+
from ._api_review_tools import ApiReviewTools
1212
from ._database_tools import (
1313
get_create_agent,
1414
get_delete_agent,
@@ -19,7 +19,7 @@
1919
from ._utility_tools import UtilityTools
2020

2121
__all__ = [
22-
"ApiReviewTool",
22+
"ApiReviewTools",
2323
"SearchTools",
2424
"UtilityTools",
2525
"get_create_agent",

packages/python-packages/apiview-copilot/src/agent/tools/_api_review_tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from src.agent.tools._base import Tool
1717

1818

19-
class ApiReviewTool(Tool):
19+
class ApiReviewTools(Tool):
2020
"""Tools for API review operations."""
2121

2222
async def review_api(self, *, language: str, target: str):

packages/python-packages/apiview-copilot/src/agent/tools/_base.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
# license information.
55
# --------------------------------------------------------------------------
66

7-
from azure.ai.agents.models import FunctionTool
8-
97

108
class Tool:
119
"""Base class for agent tools. Provides automatic tool discovery."""
@@ -17,4 +15,4 @@ def all_tools(self):
1715
for name in dir(self)
1816
if not name.startswith("_") and callable(getattr(self, name)) and name != "all_tools"
1917
]
20-
return FunctionTool(tools)
18+
return tools

0 commit comments

Comments
 (0)