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
Create and Manage Persistent Agents - Use Provider pattern not Project Client #355
asyncwith (
AzureCliCredential() ascredential,
AIProjectClient(
endpoint=os.environ["AZURE_AI_PROJECT_ENDPOINT"],
credential=credential
) asproject_client,
):
# Create a persistent agentcreated_agent=awaitproject_client.agents.create_agent(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
name="PersistentAgent",
instructions="You are a helpful assistant."
)
When trying this the create_agent method is not found for the project_client.agents.
After searching through the repository, it looks like the Provider-pattern should be used nowadays. Maybe the code is referring to an old version of the package?
When changing my code to use the provider pattern I get no squiglies anymore.:
asyncwithAzureCliCredential() ascredential:
asyncwithAzureAIAgentsProvider(
credential=credential
) asprovider:
calculator_agent=awaitprovider.create_agent(
model=os.environ["AZURE_AI_MODEL_DEPLOYMENT_NAME"],
name="CalculatorAgent",
instructions="You are a helpful assistant."
)
Activity