[Solved ✅] 'NoneType' object has no attribute 'api_key'
I followed the Quickstart (https://docs.composio.dev/introduction/intro/quickstart) as is, logged in to Github and Composio, but keep getting this error
Checked the OPENAI_API_KEY is set correctly. Am I suppsoed to assign the composio api key as well? if yes, where?
Composio Docs
🚀 Quick Start - Composio
Composio enables your agents to connect with Various Tools and work with them

9 Replies
conscious-sapphire•4mo ago
@Akshay try to add the API KEY manually once
unwilling-turquoiseOP•4mo ago
api key for composio? what should it be assigned as?
conscious-sapphire•4mo ago
COMPOSIO_API_KEY
unwilling-turquoiseOP•4mo ago
tried adding manually and ran again
openai_client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])
composio_toolset = ComposioToolSet(api_key = "api_key_goes_here")
Still the same issue
conscious-sapphire•4mo ago
Hmmm, that shouldn't happen. Have you checked by printing openai key if it's present or not
Also are you using jupyter notebook??
unwilling-turquoiseOP•4mo ago
yeah the openai side is working fine, i checked that.
Yes, jupyter notebook
Here's the error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[18], line 15
3 task = "Star the repo composiohq/composio on GitHub"
5 response = openai_client.chat.completions.create(
6 model="gpt-4-turbo-preview",
7 tools=tools,
(...)
12 ],
13 )
---> 15 result = composio_toolset.handle_tool_calls(response)
16 print(result)
File ~/anaconda3/lib/python3.11/site-packages/composio_openai/toolset.py:204, in ComposioToolSet.handle_tool_calls(self, response, entity_id)
201 if choice.message.tool_calls:
202 for tool_call in choice.message.tool_calls:
203 outputs.append(
--> 204 self.execute_tool_call(
205 tool_call=tool_call,
206 entity_id=entity_id or self.entity_id,
207 )
208 )
209 return outputs
166 def execute_tool_call(
167 self,
168 tool_call: ChatCompletionMessageToolCall,
169 entity_id: t.Optional[str] = None,
170 ) -> t.Dict:
171 """
172 Execute a tool call.
173
(...)
176 :return: Object containing output data from the tool call.
177 """
--> 178 return self.execute_action(
179 action=Action(value=tool_call.function.name),
180 params=json.loads(tool_call.function.arguments),
181 entity_id=entity_id or self.entity_id,
182 )
File ~/anaconda3/lib/python3.11/site-packages/agentops/client.py:511, in Client.api_key(self)
509 @property
510 def api_key(self):
--> 511 return self.config.api_key
AttributeError: 'NoneType' object has no attribute 'api_key'
conscious-sapphire•4mo ago
Okay lemme try it once and connecting back to you
absent-sapphire•4mo ago
Is agentops installed and maybe on older version?
Could you update agentops?
unwilling-turquoiseOP•4mo ago
good catch - that did the track!