Skip to content

auth0-samples/auth0-assistant0

Repository files navigation

Assistant0: An AI Personal Assistant Secured with Auth0

Assistant0 an AI personal assistant that consolidates your digital life by dynamically accessing multiple tools to help you stay organized and efficient. Here’s some of the features that can be implemented:

  1. Gmail Integration: The assistant can scan your inbox to generate concise summaries. It can highlight urgent emails, categorizes conversations by importance, and even suggests drafts for quick replies.
  2. Calendar Management: By interfacing with your calendar, it can remind you of upcoming meetings, check for scheduling conflicts, and even propose the best time slots for new appointments based on your availability.
  3. Slack Notifications [coming soon]: For team communications, the assistant can monitor Slack channels. It identifies key messages and creates action items, ensuring you never miss an important update from your colleagues.
  4. Google Drive Access [coming soon]: Whether you need immediate access to the latest project document or a file related to a current task, the assistant retrieves pertinent documents from Google Drive on demand. It can create document summaries and even create documents based on your instructions.
  5. User Information Retrieval [coming soon]: The assistant can retrieve information about the user from their authentication profile, including their name, email, and other relevant details.

With tool-calling capabilities, the possibilities are endless. In this conceptual scenario, the AI agent embodies a digital personal secretary—one that not only processes information but also proactively collates data from connected services to provide comprehensive task management. This level of integration not only enhances efficiency but also ushers in a new era of intelligent automation, where digital assistants serve as reliable, all-in-one solutions that tailor themselves to your personal and professional needs.

Security Challenges with Tool Calling AI Agents

Building such an assistant is not too difficult. Thanks to frameworks like LangChain, LlamaIndex, and Vercel AI, you can get started quickly. The difficult part is doing it securely so that you can protect the user's data and credentials.

Many current solutions involve storing credentials and secrets in the AI agent application’s environment or letting the agent impersonate the user. This is not a good idea, as it can lead to security vulnerabilities and excessive scope and access for the AI agent.

Tool Calling with the Help of Auth0

This is where Auth0 comes to the rescue. As the leading identity provider (IdP) for modern applications, our upcoming product, Auth for GenAI, provides standardized ways built on top of OAuth and OpenID Connect to call APIs of tools on behalf of the end user from your AI agent.

Auth0's Token Vault feature helps broker a secure and controlled handshake between the AI agents and the services you want the agent to interact with on your behalf – in the form of scoped access tokens. This way, the agent and LLM do not have access to the credentials and can only call the tools with the permissions you have defined in Auth0. This also means your AI agent only needs to talk to Auth0 for authentication and not the tools directly, making integrations easier.

Tool calling with Federated API token exchange

Learn more

About the template

This template scaffolds an Auth0 + LangChain.js + Next.js starter app. It mainly uses the following libraries:

It's Vercel's free-tier friendly too! Check out the bundle size stats below.

You can check out a hosted version of this repo here: //TODO

Open in GitHub Codespaces Deploy with Vercel

🚀 Getting Started

First, clone this repo and download it locally.

git clone https://github.com/auth0-samples/auth0-assistant0.git
cd auth0-assistant0

Next, you'll need to set up environment variables in your repo's .env.local file. Copy the .env.example file to .env.local.

You can setup a new Auth0 tenant with Token Vault enabled following the instructions here.

To start with the basic examples, you'll just need to add your OpenAI API key and Auth0 credentials.

Next, install the required packages using your preferred package manager (e.g. bun install or npm install).

Now you're ready to run the development server:

bun all:dev # or npm run all:dev

This will start an in-memory LangGraph server on port 54367 and a Next.js server on port 3000. Open http://localhost:3000 with your browser to see the result! Ask the bot something and you'll see a streamed response:

A streaming conversation between the user and the AI

You can start editing the page by modifying app/page.tsx. The page auto-updates as you edit the file.

Agent configuration lives in src/lib/agent.ts. From here, you can change the prompt and model, or add other tools and logic.

📦 Bundle size

This package has @next/bundle-analyzer set up by default - you can explore the bundle size interactively by running:

$ ANALYZE=true bun run build

License

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

Author

This project is built by Deepu K Sasidharan.

About

Assistant0: An AI Personal Assistant Secured with Auth0

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published