You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current samples seem to be out of sync with the latest foundry SDKs for loading or creating agents as workflow executors. The agent-framework agent examples demonstrate the latest code which leverages the AzureAIAgentProvider class to create or load agents. However, probably due to my inexperience with Python, I cannot figure out how to use these async functions when trying to declare my agent (or workflow) in the global namespace. If i use asyncio.run, i get an error that I can't do that from an already running loop. If I skip that, I get an error that my entity type is not correct.
# Agent instance following Agent Framework conventionsprovider=AzureAIProjectAgentProvider(
project_endpoint=os.environ.get("AZURE_AI_PROJECT_ENDPOINT"),
model=os.environ.get("FOUNDRY_MODEL_DEPLOYMENT_NAME"),
credential=AzureCliCredential()
)
agent=provider.create_agent(
name="FoundryWeatherAgent",
instructions=""" You are a weather assistant using Azure AI Foundry models. You can provide current weather information and forecasts for any location. Always be helpful and provide detailed weather information when asked. """,
tools=[get_weather, get_forecast],
)
Error is: Error: Entity loading failed: No valid entity found
OR with asyncio
provider=AzureAIProjectAgentProvider(
project_endpoint=os.environ.get("AZURE_AI_PROJECT_ENDPOINT"),
model=os.environ.get("FOUNDRY_MODEL_DEPLOYMENT_NAME"),
credential=AzureCliCredential()
)
agent=asyncio.run(provider.create_agent(
name="FoundryWeatherAgent",
instructions=""" You are a weather assistant using Azure AI Foundry models. You can provide current weather information and forecasts for any location. Always be helpful and provide detailed weather information when asked. """,
tools=[get_weather, get_forecast],
))
Error is: Entity loading failed: Failed to load entity 'foundry_agent': asyncio.run() cannot be called from a running event loop
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
The current samples seem to be out of sync with the latest foundry SDKs for loading or creating agents as workflow executors. The agent-framework agent examples demonstrate the latest code which leverages the AzureAIAgentProvider class to create or load agents. However, probably due to my inexperience with Python, I cannot figure out how to use these async functions when trying to declare my agent (or workflow) in the global namespace. If i use asyncio.run, i get an error that I can't do that from an already running loop. If I skip that, I get an error that my entity type is not correct.
Error is:
Error: Entity loading failed: No valid entity foundOR with asyncio
Error is:
Entity loading failed: Failed to load entity 'foundry_agent': asyncio.run() cannot be called from a running event loopBeta Was this translation helpful? Give feedback.
All reactions