When using the Astra Assistants API, there is an issue where the execution stops if the assistant outputs a message before using a tool. In the OpenAI Assistants API, the agent can output a message and then use a tool subsequently. However, with Astra Assistants, if the agent outputs any message, the execution stops and prevents further tool usage. The execution works correctly if the agent uses tools before outputting any message.
Steps to Reproduce
Create an assistant using the Astra Assistants API.
Instruct the assistant to output a message and then use a tool: "You must say 'I am using test tool' and then use test tool in this exact order in a single message. Do not use test tool before you said you are using it."
Observe that the execution stops after the message is outputted, and the tool is not used.
Expected Behavior
The assistant should be able to output a message and then use a tool seamlessly, as it works in the OpenAI Assistants API.
Actual Behavior
The execution stops after the assistant outputs a message, preventing any subsequent tool usage.
Example
from openai import OpenAI
from astra_assistants import patch
from agency_swarm import Agent, Agency, set_openai_client
from dotenv import load_dotenv
from agency_swarm.tools import BaseTool
load_dotenv('../.env')
client = patch(OpenAI())
set_openai_client(client)
class TestTool(BaseTool):
"""
A simple tool that prints 'test'.
"""
def run(self):
"""
This method prints the word 'test'.
"""
print("test")
return "Test has been printed."
ceo = Agent(name="Test Agent",
description="Test Agent for testing purposes",
instructions="You must say 'I am using test tool' and then use test tool in the same message.",
# model="perplexity/llama-3-8b-instruct",
# model="anthropic/claude-3-haiku-20240307",
# model="groq/mixtral-8x7b-32768",
model="gpt-4o",
# files_folder="./examples/python/agency-swarm/files",
temperature=0,
tools=[TestTool])
agency = Agency([ceo])
completion = agency.get_completion("Please say 'I am using test tool' and ONLY THEN use test tool.")
print(completion)
Environment
Agency Swarm version: 0.2.5
Astra Assistants version: 2.0.5
Additional Information
The issue does not occur if tools are used before outputting any message.
Description
When using the Astra Assistants API, there is an issue where the execution stops if the assistant outputs a message before using a tool. In the OpenAI Assistants API, the agent can output a message and then use a tool subsequently. However, with Astra Assistants, if the agent outputs any message, the execution stops and prevents further tool usage. The execution works correctly if the agent uses tools before outputting any message.
Steps to Reproduce
"You must say 'I am using test tool' and then use test tool in this exact order in a single message. Do not use test tool before you said you are using it."
Expected Behavior
The assistant should be able to output a message and then use a tool seamlessly, as it works in the OpenAI Assistants API.
Actual Behavior
The execution stops after the assistant outputs a message, preventing any subsequent tool usage.
Example
Environment
Additional Information