Arcade with OpenAI Agents
Arcade provides seamless integration with the OpenAI Agents Library and OpenAI Agents JS , allowing you to enhance your AI with powerful including Gmail, LinkedIn, GitHub, and many more. This integration is available through the agents-arcade
package for Python and our JavaScript client library .
Installation
Install the necessary packages to get started:
Python
pip install agents-arcade arcadepy
Make sure you have your Arcade ready. Get an API key if you don’t already have one.
Key features
- Easy integration with the OpenAI framework
- Access to all Arcade Servers including Google, GitHub, LinkedIn, X, and more
- Create custom with the Arcade Tool SDK
- Manage authentication for that require it
- Asynchronous support compatible with OpenAI’s framework
Basic usage
Here’s a simple example of using Arcade tools with OpenAI :
Python
from agents import Agent, Runner
from arcadepy import AsyncArcade
from agents_arcade import get_arcade_tools
from agents_arcade.errors import AuthorizationError
async def main():
# Initialize the Arcade client
client = AsyncArcade()
# Get tools from the "gmail" MCP Server
tools = await get_arcade_tools(client, toolkits=["gmail"])
# Create an agent with Gmail tools
google_agent = Agent(
name="Gmail agent",
instructions="You are a helpful assistant that can assist with Gmail API calls.",
model="gpt-4o-mini",
tools=tools,
)
try:
# Run the agent with a unique user_id for authorization
result = await Runner.run(
starting_agent=google_agent,
input="What are my latest emails?",
context={"user_id": "{arcade_user_id}"},
)
print("Final output:\n\n", result.final_output)
except AuthorizationError as e:
print("Please Login to Google:", e)
if __name__ == "__main__":
import asyncio
asyncio.run(main())
Handling authorization
Python
When a user needs to authorize access to a tool (like Google or GitHub), the will raise an AuthorizationError
with a URL for the to visit:
try:
# Run agent code
# ...
except AuthorizationError as e:
# Display the authorization URL to the user
print(f"Please visit this URL to authorize: {e}")
After visiting the URL and authorizing access, the user can run the again with the same user_id
, and it will work without requiring re-authorization.
Available MCP Servers
Arcade provides a variety of Servers you can use with your :
- Google Suite: Gmail, Calendar, Drive, Docs
- Social Media: LinkedIn, X
- Development: GitHub
- Web: Web search, content extraction
- And more: Weather, financial data, etc.
For a full list of available Servers, visit the Arcade MCP Servers documentation.
Next steps
Ready to start building with Arcade and OpenAI ? Check out these guides:
- Using Arcade tools - Learn the basics of using Arcade tools with OpenAI
- Managing user authorization - Handle authorization efficiently
- Creating custom tools - Build your own tools with the Arcade SDK
Enjoy exploring Arcade and building powerful AI-enabled applications!