## Inspiration

The inspiration for Leyline came from [The Interaction Company of California's challenge](https://interaction.co/calhacks) to design an AI agent that proactively handles emails. While Google's AI summarization features in their email app were a good start, we felt they lacked the comprehensive functionality users need. We envisioned an agent that could handle more complex tasks like filling out forms and booking flights, truly taking care of the busy work in your inbox.

## What it does

Leyline connects to your Gmail account and parses incoming emails. It uses AI models to analyze the subject, body text, and attachments to determine the best course of action for each email. For example, if there's a form attached with instructions to fill it out, Leyline completes the form for you using information from our database.

## How we built it

We developed Leyline as a Next.js app with Supabase as the backend. We use Google Cloud Pub/Sub to connect to Gmail accounts. A custom webhook receives emails from the Pub/Sub topic. The webhook first summarizes the email, then decides if there's a possible tool it could use. We implemented Groq's tool-calling models to determine appropriate actions, such as filling out attached forms using user data from our database. The frontend was built with Tailwind CSS and shadcn UI components.

## Challenges we ran into

1. Processing Gmail messages correctly was challenging due to conflicting documentation and inconsistent data formats. We had to implement workarounds and additional API calls to fetch all the necessary information.
2. Getting the tool-calling workflow to function properly was difficult, as it sometimes failed to call tools or missed steps in the process.

## Accomplishments that we're proud of

* We created an intuitive and visually appealing user interface.
* We implemented real-time email support, allowing emails to appear instantly and their processing status to update live.
* We developed a functional tool workflow for handling various email tasks.

## What we learned

* This was our first time using Google Cloud Pub/Sub, which taught us about the unique characteristics of cloud provider APIs compared to consumer APIs.
* We gained experience with tool-calling in AI models and learned about its intricacies.

## What's next for Leyline

We plan to expand Leyline's capabilities by:

* Adding more tools to handle a wider variety of email-related tasks.
* Implementing a containerized browser to perform tasks like flight check-ins.
* Supporting additional email providers beyond Gmail.
* Developing more specialized tools for processing different types of emails and requests.
This project was developed with the RBC challenge in mind of developing the Help Desk of the future.

## What inspired us

We were inspired by our motivation to improve the world of work.

## Background

If we want technical support, we usually contact companies by phone, which is slow and painful for both users and technical support agents, especially when questions are obvious. Our solution is an online chat that responds to people immediately using our own bank of answers. This is a portable and a scalable solution.

## Try it!

<http://www.rbcH.tech>

## What we learned

Using NLP, dealing with devilish CORS, implementing docker successfully, struggling with Kubernetes.

## How we built

* Node.js for our servers (one server for our webapp, one for BotFront)
* React for our front-end
* Rasa-based Botfront, which is the REST API we are calling for each user interaction
* We wrote our own Botfront database during the last day and night

## Our philosophy for delivery

Hack, hack, hack until it works. Léonard was our webapp and backend expert, François built the DevOps side of things and Han solidified the front end and Antoine wrote + tested the data for NLP.

## Challenges we faced

Learning brand new technologies is sometimes difficult! Kubernetes (and CORS brought us some painful pain... and new skills and confidence.

## Our code

<https://github.com/ntnco/mchacks/>

## Our training data

<https://github.com/lool01/mchack-training-data>
We went on relentlessly. Beating back against the tide (that being lack of documentation), we created something truly magnificent out of an underused device. What's next you ask? Well, we'll go on with our lives, but in the back of our minds we will always remember the times we had, and the beauty we effected in this sorry, sullen world.