Skip to main content

Arcade Integration for OpenAI Agents

Project description

Arcade Library for OpenAI Agents

License PyPI

Arcade DocumentationIntegrationsArcade Python ClientOpenAI Agents

agents-arcade

agents-arcade provides an integration between Arcade and the OpenAI Agents Library. This allows you to enhance your AI agents with Arcade tools like Google Mail, Linkedin, X, or ones you build yourself with the Tool SDK.

For a list of all hosted tools and auth providers you can use to build your own, see the Arcade Integrations documentation.

Installation

pip install agents-arcade

Basic Usage

Below shows a basic example of how to use the agents-arcade library to create an agent that can use the GitHub toolkit hosted in Arcade Cloud. You can use other hosted tools like Google, or you can build your own and host them to the agents library with the Tool SDK.

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():
    client = AsyncArcade()
    # Use the "github" toolkit for this example
    # You can use other toolkits like "google", "linkedin", "x", etc.
    tools = await get_arcade_tools(client, toolkits=["github"])

    # Create an agent that can use the github toolkit
    github_agent = Agent(
        name="GitHub agent",
        instructions="You are a helpful assistant that can assist with GitHub API calls.",
        model="gpt-4o-mini",
        tools=tools,
    )

    try:
        result = await Runner.run(
            starting_agent=github_agent,
            input="Star the arcadeai/arcade-ai repo",
            # make sure you pass a UNIQUE user_id for auth
            context={"user_id": "user@example.com"},
        )
        print("Final output:\n\n", result.final_output)
    except AuthorizationError as e:
        print("Please Login to GitHub:", e)


if __name__ == "__main__":
    import asyncio

    asyncio.run(main())

If you haven't auth'd Arcade with GitHub yet, you'll see a message similar to this:

> python examples/github.py
Please Login to Github: Authorization required: https://github.com/login/oauth/authorize...

You can then visit the URL in your browser to auth'd Arcade with GitHub and run the script again.

> python examples/github.py
The repository **arcadeai/arcade-ai** has been successfully starred! If you need any more assistance, feel free to ask.

You can also wait for authorization to complete before running the script using the helper methods in arcadepy.

Once you have auth'd Arcade with a tool, you can use the tool in your agent by passing the user_id and never having to worry about auth'ing for that specific tool again.

Key Features

  • Easy Integration: Simple API (one function) to connect Arcade tools with OpenAI Agents
  • Extensive Toolkit Support: Access to all Arcade toolkits including Gmail, Google Drive, Search, and more
  • Asynchronous Support: Built with async/await for compatibility with OpenAI's Agent framework
  • Authentication Handling: Manages authorization for tools requiring user permissions like Google, LinkedIn, etc

Authentication

Many Arcade tools require user authentication. The authentication flow is managed by Arcade and can be triggered by providing a user_id in the context when running your agent. Refer to the Arcade documentation for more details on managing tool authentication.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Documentation

The project documentation is available at docs.arcadeai.dev/agents-arcade and includes:

  • Installation instructions
  • Quickstart guides
  • API reference
  • Advanced usage patterns
  • Toolkit guides
  • Examples

To build and serve the documentation locally:

# Install development dependencies
pip install -e ".[dev]"

# Serve the documentation
make serve-docs
# or
mkdocs serve

Then visit http://localhost:8000 in your browser.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agents_arcade-0.0.3.tar.gz (96.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agents_arcade-0.0.3-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file agents_arcade-0.0.3.tar.gz.

File metadata

  • Download URL: agents_arcade-0.0.3.tar.gz
  • Upload date:
  • Size: 96.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.14

File hashes

Hashes for agents_arcade-0.0.3.tar.gz
Algorithm Hash digest
SHA256 e6260fa9190bf2babe7766138348ebbda9058432ac9184deacdbdae998688961
MD5 22b10d8fc8ae1656354b0c2056674c17
BLAKE2b-256 f7957c556ebfdeefb2b7cc27c207bfc9a31cdcb21b412321abaf135c38a41d5c

See more details on using hashes here.

File details

Details for the file agents_arcade-0.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for agents_arcade-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 041c4034fc2dc704393e9b85954cf332e083618a6cf0c36c75ec1051075f1a00
MD5 21f5724d10136d347162887041af974d
BLAKE2b-256 f70120595b6d78070f0c362db310b6d27cf0dcfa2f001d675599b87cd441738d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page