Skip to content
Merged
24 changes: 24 additions & 0 deletions nodejs/perplexity/sample-agent/.env.template
Comment thread
aubreyquinn marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Perplexity API Configuration
PERPLEXITY_API_KEY=your_perplexity_api_key_here
PERPLEXITY_MODEL=sonar

# Agent365 Configuration
AGENT_ID=perplexity-agent
PORT=3978

# Microsoft Bot Framework Authentication
# Get these from Azure Bot Service registration
CLIENT_ID=
CLIENT_SECRET=
TENANT_ID=

# MCP Tools Configuration (optional - for M365 integration)
MCP_ENVIRONMENT_ID=
AGENTIC_USER_ID=
MCP_AUTH_TOKEN=

# Observability (optional - Azure Application Insights)
CONNECTION_STRING=

# Debug Mode
DEBUG=false
94 changes: 94 additions & 0 deletions nodejs/perplexity/sample-agent/README.md
Comment thread
aubreyquinn marked this conversation as resolved.
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Agent Sample - Perplexity AI

This directory contains a sample agent implementation using Node.js and Perplexity AI.

## Demonstrates

This sample demonstrates how to build an agent using the Agent 365 framework with Node.js and Perplexity AI.

## Features

- ✅ **Chat with Perplexity** - Natural language conversations using Perplexity's Sonar models.

## Prerequisites

- Node.js 18+
- Perplexity AI API Key from <https://perplexity.ai/account/api>
- Agents SDK
Comment thread
aubreyquinn marked this conversation as resolved.

## How to run this sample

### 1. Setup environment variables

Copy the template and fill in your values:

```powershell
# Copy the template environment file
cp .env.template .env
```

**Minimum required:**

```bash
PERPLEXITY_API_KEY=your_perplexity_api_key_here
AGENT_ID=perplexity-agent
PORT=3978
```

**For production/M365 integration, also add:**

```bash
CLIENT_ID=your_bot_app_id
CLIENT_SECRET=your_bot_secret
TENANT_ID=your_tenant_id
```

See `.env.template` for all available options.

### 2. Install dependencies

```powershell
npm install
```

### 3. Build the sample

```powershell
npm run build
```

### 4. Start the agent

```powershell
npm start
```

You should see:

```powershell
🚀 Perplexity Agent listening on port 3978
App ID: your-app-id
Debug: false

✅ Agent ready to receive messages!
```

### 5. To test with M365 Agents Playground

In a new terminal:

```powershell
npm run test-tool
```

This opens the M365 Agents Playground where you can chat with your agent.

### 5. Optionally, while testing you can run in dev mode (auto-reload)

```powershell
npm run dev
```

This watches for file changes and auto-restarts the server.

The agent will start and be ready to receive requests through the configured hosting mechanism.
Comment thread
aubreyquinn marked this conversation as resolved.
Loading
Loading