Looking for help. My code has multiple agents, and all of them work fine in the playground all the time except the OpenBBtools, which works for the first time and throws an error when accessed 2nd time. I am using Azure Openai; the code and the error are below. Is this error a bug, or is something wrong with the implementation?
#####model####
azure_model2 = AzureOpenAIChat(
id=os.getenv(“AZURE_OPENAI_MODEL_NAME”),
api_key=os.getenv(“AZURE_OPENAI_API_KEY”),
azure_endpoint=os.getenv(“AZURE_OPENAI_ENDPOINT”),
azure_deployment=os.getenv(“AZURE_OPENAI_DEPLOYMENT”),
azure_version=os.getenv(“AZURE_OPENAI_VERSION”),
azure_modelname=os.getenv(“AZURE_OPENAI_MODEL_NAME”),
)
####code#####
cypto_finance_agent = Agent(
name=“Crypto News Agent”,
role=“Get crypro & stock data”,
model=azure_model2,
tools=[OpenBBTools()],
instructions=[
“Use tables to display financial data”,
“Include both technical and fundamental analysis when relevant”,
“Provide context for financial metrics”,
“Highlight significant changes or unusual patterns”,
“Include source and timestamp for all financial data”,
“Adapt analysis based on asset type (crypto, stock, etc.)”,
“Use OpenBB functions: get_stock_price, get_company_news, get_company_profile, get_price_targets”
],
show_tool_calls=True,
debug_mode=True,
markdown=True,
)
Create an agent team with web_agent and finance_agent
agent_team = Agent(
name=“Investment Adviser Agent”,
model=azure_model3,
team=[web_agent, finance_agent, cypto_finance_agent],
role=“Investment Adviser with deep knowledge in stock and crypto market”,
description=“This agent is responsible for providing financial data and analysis after partnering with 3 specilaized agents.”,
debug_mode=True,
instructions=[
“Always include sources”,
“Use tables to display financial data”,
“Combine market news with financial analysis”,
“Prioritize actionable insights”,
“Highlight any discrepancies between different data sources”,
“Include both short-term and long-term perspectives”,
“Adapt analysis based on asset type which is crypto or stock”
],
show_tool_calls=True,
markdown=True,
)
app = Playground(agents=[finance_agent, web_agent, cypto_finance_agent, agent_team]).get_app(use_async=False)
if name == “main”:
serve_playground_app(“agent-finance:app”, reload=True,port=7777)
######Error trace #####
DEBUG AgentRunRequest: What’s your special skill? 69eee8bf-dc60-4e77-80e4-0d10533cba8b True False myemail_39a9 None
DEBUG Continuing session:
WARNING Failed to deepcopy field: tools - DeprecationSummary.new() missing 1 required positional argument: ‘metadata’
INFO: 127.0.0.1:56022 - “POST /v1/playground/agent/run HTTP/1.1” 500 Internal Server Error
ERROR: Exception in ASGI application
Traceback (most recent call last):
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\uvicorn\protocols\http\httptools_impl.py”, line 409, in run_asgi
result = await app( # type: ignore[func-returns-value]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\uvicorn\middleware\proxy_headers.py”, line 60, in call
return await self.app(scope, receive, send)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\fastapi\applications.py”, line 1054, in call
await super().call(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\applications.py”, line 112, in call
await self.middleware_stack(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\middleware\errors.py”, line 187, in call
raise exc
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\middleware\errors.py”, line 165, in call
await self.app(scope, receive, _send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\middleware\cors.py”, line 93, in call
await self.simple_response(scope, receive, send, request_headers=headers)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\middleware\cors.py”, line 144, in simple_response
await self.app(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\middleware\exceptions.py”, line 62, in call
await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette_exception_handler.py”, line 53, in wrapped_app
raise exc
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette_exception_handler.py”, line 42, in wrapped_app
await app(scope, receive, sender)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\routing.py”, line 715, in call
await self.middleware_stack(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\routing.py”, line 735, in app
await route.handle(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\routing.py”, line 288, in handle
await self.app(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\routing.py”, line 76, in app
await wrap_app_handling_exceptions(app, request)(scope, receive, send)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette_exception_handler.py”, line 53, in wrapped_app
raise exc
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette_exception_handler.py”, line 42, in wrapped_app
await app(scope, receive, sender)
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\starlette\routing.py”, line 73, in app
response = await f(request)
^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\fastapi\routing.py”, line 301, in app
raw_response = await run_endpoint_function(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\fastapi\routing.py”, line 214, in run_endpoint_function
return await run_in_threadpool(dependant.call, values)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "U:\S***\phiMultiAgent\aienv\Lib\site-packages\starlette\concurrency.py", line 37, in run_in_threadpool
return await anyio.to_thread.run_sync(func)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\anyio\to_thread.py”, line 56, in run_sync
return await get_async_backend().run_sync_in_worker_thread(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\anyio_backends_asyncio.py”, line 2461, in run_sync_in_worker_thread
return await future
^^^^^^^^^^^^
File “U:\S*****\phiMultiAgent\aienv\Lib\site-packages\anyio_backends_asyncio.py”, line 962, in run
result = context.run(func, *args)