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
{{ message }}
Repository navigation
Basic Agent Creation - Python yields in error #354
AzureCliCredential() ascredential,
AzureAIAgentClient(async_credential=credential).as_agent(
name="HelperAgent",
instructions="You are a helpful assistant."
) asagent,
):
When trying this code in my FastAPI endpoint I get an error stating:
Azure credential is required when agents_client is not provided.
I had to change my code to the following to get the code working: AzureAIAgentClient(credential=credential).as_agent(
Full sample:
classcalculator:
asyncdefrun(self, question: str):
answer="I don't know"asyncwithAzureCliCredential() ascredential:
asyncwithAzureAIAgentClient(credential=credential).as_agent(
name="HelperAgent",
instructions="You are a helpful assistant."
) asagent:
answer=awaitagent.run(question)
returnanswer
I'm not sure if the behavior is different between a console app & FastAPI endpoint (which is also marked as async, but the error is confusing at least. It looks like the code sample needs updating, but might need some more testing.
Activity