-
Question: Reusing
|
Beta Was this translation helpful? Give feedback.
Answered by
moonbox3
Jan 6, 2025
Replies: 1 comment 1 reply
-
Hi @vslepakov, thanks for your question. Are you handling the retrieval in the following manner? First we create the assistant agent, as an example: agent = await AzureAssistantAgent.create(
kernel=kernel,
service_id=service_id,
name=AGENT_NAME,
instructions=AGENT_INSTRUCTIONS,
enable_code_interpreter=True,
) Then we can retrieve it using the assistant ID: assistant_id = agent.assistant.id
# Retrieve the agent using the assistant_id
retrieved_agent: AzureAssistantAgent = await AzureAssistantAgent.retrieve(
id=assistant_id,
kernel=kernel,
)
# Define a thread and invoke the agent with the user input
thread_id = await retrieved_agent.create_thread()
try:
await invoke_agent(retrieved_agent, thread_id, "Tell me a joke about bears.")
finally:
await agent.delete()
await retrieved_agent.delete_thread(thread_id) Code is from this sample (I realize we have a bug in the sample where it only retrieves the OpenAIAssistantAgent, I will fix this): |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
vslepakov
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @vslepakov, thanks for your question. Are you handling the retrieval in the following manner?
First we create the assistant agent, as an example:
Then we can retrieve it using the assistant ID: