Skip to main content
This guide walks through building an Autonomy application that combines:
  • Voice Agents - Talk to a voice agent about information stored in Box.
  • Box integration - Search and knowledge retrieval from documents stored in Box.
  • GitHub integration - Report issues by talking to a voice agent.
Voice agent interface for Box and GitHub
The complete source code is available at github.com/build-trust/autonomy-and-box.

Prerequisites

Before starting, ensure you have:
  1. Sign up and install the autonomy command.
  2. A Box developer account with API credentials.
  3. A GitHub personal access token.
  4. Docker running on your machine.

Project Structure

File Structure:

Step 1: Clone the Repository


Step 2: Configure Box Credentials

Create a Box application in the Box Developer Console:
  1. Create a new Custom App.
  2. Select Server Authentication (Client Credentials Grant).
  3. Under Configuration, note your:
    • Client ID.
    • Client Secret.
    • Enterprise ID.
Copy the secrets template and add your credentials:
Edit secrets.yaml:
secrets.yaml
Never commit secrets.yaml to version control. It’s already in .gitignore.

Step 3: Configure GitHub Access

Create a GitHub Personal Access Token with repo scope to allow issue creation. Add the token and target repository to your secrets.yaml:

Step 4: Upload Documents to Box

The application searches documents stored in a Box folder. Use the included script to populate Box with sample documentation:
This script:
  1. Fetches documentation from autonomy.computer/docs/llms.txt.
  2. Parses all markdown file URLs.
  3. Creates a docs folder in Box.
  4. Uploads all documentation files.

Step 5: Understand the Application Code

The Main Application

The application creates a voice-enabled agent with access to a knowledge base and GitHub tools:
images/main/main.py

Box Integration

The Box client handles authentication and document retrieval:
images/main/box.py

GitHub Issue Tool

The GitHub tool allows the agent to create issues based on user requests:
images/main/github.py

Agent Instructions

The agent has two sets of instructions - one for the primary agent and one for the voice interface:

Step 6: Deploy the Application

Deploy to Autonomy Computer:
The deployment configuration in autonomy.yaml defines the infrastructure:
autonomy.yaml
The size: big setting allocates more resources for the embedding model and voice processing.

Step 7: Access the Voice Interface

Once deployed, open your zone URL in a browser:
To find your cluster name:
Click the voice button and start talking to your assistant!

Using the Application

Voice Commands

Try these voice interactions:
  • “What is Autonomy?” - Searches the knowledge base and responds.
  • “How do I create an agent?” - Retrieves relevant documentation.
  • “I found a bug, help me report it” - Creates a GitHub issue.
  • “Can you file a feature request for better logging?” - Creates a GitHub issue.

API Access

You can also interact via HTTP:

Refresh Knowledge Base

The knowledge base automatically refreshes every hour. To manually refresh:

How It Works

Document Loading

When the application starts:
  1. Connects to Box using CCG authentication.
  2. Navigates to the configured folder path (docs).
  3. Recursively lists all files in the folder.
  4. Downloads each file’s text content.
  5. Chunks documents and generates embeddings.
  6. Stores embeddings in the knowledge base.

Voice Flow

When a user speaks:
  1. Browser captures audio via Web Audio API.
  2. Audio streams to the agent via WebSocket.
  3. Voice Activity Detection (VAD) detects speech boundaries.
  4. Speech is transcribed and sent to the voice agent.
  5. Voice agent delegates to the primary agent.
  6. Primary agent searches knowledge and/or creates issues.
  7. Response is synthesized to speech.
  8. Audio streams back to the browser.
When searching documents:
  1. Query is embedded using Cohere’s embed-english-v3.
  2. Vector similarity search finds relevant chunks.
  3. Top 5 results within distance threshold (0.4) are returned.
  4. Agent uses retrieved context to answer.

Configuration Options

Voice Settings

Customize voice behavior in main.py:

Knowledge Settings

Tune document search:

Environment Variables


Build with a coding agent

See the guide on building Autonomy apps using coding agents.

Troubleshooting

Verify your credentials in secrets.yaml. Ensure your Box app uses Server Authentication (Client Credentials Grant) and has the necessary scopes enabled.
Check that BOX_FOLDER_PATH matches your Box folder name. View logs with autonomy zone inlet --to logs to see which folders are found.
Verify your GitHub token has repo scope and the repository format is owner/repo.
Ensure your browser has microphone permissions. Use Chrome or Edge for best WebSocket and Web Audio API support.

Learn More

Voice

Give agents the ability to listen and speak.

Knowledge bases

Give agents the ability to search a corpus of documents.

Tools

Give agents the ability to take actions.

File structure

How to organize an application built with the Autonomy Framework.