Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions examples/agents/it-systems-triage-agent/.env.baseai.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# !! SERVER SIDE ONLY !!
# Keep all your API keys secret — use only on the server side.

# TODO: ADD: Both in your production and local env files.
# Langbase API key for your User or Org account.
# How to get this API key https://langbase.com/docs/api-reference/api-keys
LANGBASE_API_KEY=

# TODO: ADD: LOCAL ONLY. Add only to local env files.
# Following keys are needed for local pipe runs. For providers you are using.
# For Langbase, please add the key to your LLM keysets.
# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets
OPENAI_API_KEY=
ANTHROPIC_API_KEY=
COHERE_API_KEY=
FIREWORKS_API_KEY=
GOOGLE_API_KEY=
GROQ_API_KEY=
MISTRAL_API_KEY=
PERPLEXITY_API_KEY=
TOGETHER_API_KEY=
9 changes: 9 additions & 0 deletions examples/agents/it-systems-triage-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# baseai
**/.baseai/
node_modules
.env
package-lock.json
pnpm-lock.yaml
# env file
.env

76 changes: 76 additions & 0 deletions examples/agents/it-systems-triage-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
![IT Systems Triage Agent by ⌘ BaseAI][cover]

![License: MIT][mit] [![Fork on ⌘ Langbase][fork]][pipe]

## Build an IT Systems Triage Agent with BaseAI framework — ⌘ Langbase

This **IT Triage Agent** is designed to streamline the resolution process by assigning issue priority and category based on a user’s description of their IT system problem. Built as a CLI application, it relies on a BaseAI pipe call and features a central entry point in `index.ts`. Additionally, the logging is configured to be switched off by default in the `baseai.config.ts` file.

This AI Agent is built using the BaseAI framework. It leverages an agentic pipe that integrates over 30+ LLMs (including OpenAI, Gemini, Mistral, Llama, Gemma, etc.) and can handle any data, with context sizes of up to 10M+ tokens, supported by memory. The framework is compatible with any front-end framework (such as React, Remix, Astro, Next.js), giving you, as a developer, the freedom to tailor your AI application exactly as you envision.

## How to use

Navigate to `examples/agents/it-systems-triage-agent` and run the following commands:

```sh
# Navigate to baseai/examples/agents/it-systems-triage-agent
cd examples/agents/it-systems-triage-agent

# Install the dependencies
npm install

# Make sure to copy .env.baseai.example file and
# create .env file and add all the relevant API keys in it
cp .env.baseai.example .env

# Run the local baseai dev server to test the examples (uses localhost:9000 port)
npx baseai dev

# Run the agent
tsx index.ts
```

## Features

- IT Systems Triage Agent — Built with [BaseAI framework and agentic Pipe ⌘ ][qs].
- Composable Agents — build and compose agents with BaseAI.
- Add and Sync deployed pipe on Langbase locally npx baseai@latest add ([see the Code button][pipe]).

## Learn more

1. Check the [Learning path to build an agentic AI pipe with ⌘ BaseAI][learn]
2. Read the [source code on GitHub][gh] for this agent example
3. Go through Documentaion: [Pipe Quick Start][qs]
4. Learn more about [Memory features in ⌘ BaseAI][memory]
5. Learn more about [Tool calls support in ⌘ BaseAI][toolcalls]


> NOTE:
> This is a BaseAI project, you can deploy BaseAI pipes, memory and tool calls on Langbase.

---

## Authors

This project is created by [Langbase][lb] team members, with contributions from:

- Muhammad-Ali Danish - Software Engineer, [Langbase][lb] <br>
**_Built by ⌘ [Langbase.com][lb] — Ship hyper-personalized AI assistants with memory!_**

[lb]: https://langbase.com
[pipe]: https://langbase.com/examples/it-systems-triage-agent
[gh]: https://github.com/LangbaseInc/baseai/tree/main/examples/agents/it-systems-triage-agent
[cover]:https://raw.githubusercontent.com/LangbaseInc/docs-images/main/baseai/baseai-cover.png
[download]:https://download-directory.github.io/?url=https://github.com/LangbaseInc/baseai/tree/main/examples/it-systems-triage-agent
[learn]:https://baseai.dev/learn
[memory]:https://baseai.dev/docs/memory/quickstart
[toolcalls]:https://baseai.dev/docs/tools/quickstart
[deploy]:https://baseai.dev/docs/deployment/authentication
[signup]: https://langbase.fyi/io
[qs]:https://baseai.dev/docs/pipe/quickstart
[docs]:https://baseai.dev/docs
[xaa]:https://x.com/MrAhmadAwais
[xab]:https://x.com/AhmadBilalDev
[local]:http://localhost:9000
[mit]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge&color=%23000000
[fork]: https://img.shields.io/badge/FORK%20ON-%E2%8C%98%20Langbase-000000.svg?style=for-the-badge&logo=%E2%8C%98%20Langbase&logoColor=000000
18 changes: 18 additions & 0 deletions examples/agents/it-systems-triage-agent/baseai/baseai.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import type {BaseAIConfig} from 'baseai';

export const config: BaseAIConfig = {
log: {
isEnabled: false,
logSensitiveData: false,
pipe: true,
'pipe.completion': true,
'pipe.request': false,
'pipe.response': false,
tool: false,
memory: false,
},
memory: {
useLocalEmbeddings: false,
},
envFilePath: '.env',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import {PipeI} from '@baseai/core';

const pipeItSystemsTriageAgent = (): PipeI => ({
// Replace with your API key https://langbase.com/docs/api-reference/api-keys
apiKey: process.env.LANGBASE_API_KEY!,
name: `it-systems-triage-agent`,
description: `IT Systems Triage Agent, provided first contact support to IT issues in your organization. This agent can then be extended with network of agents for tailored use case.`,
status: `private`,
model: `openai:gpt-4o-mini`,
stream: true,
json: false,
store: true,
moderate: true,
top_p: 1,
max_tokens: 1000,
temperature: 0.7,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
tool_choice: 'auto',
parallel_tool_calls: true,
messages: [
{
role: 'system',
content:
'You are an AI-powered IT support agent for a company that uses Windows, Mac, and Linux operating systems. Your primary role is to classify incoming IT issues and assign them appropriate priorities for the support team to handle. Your objective is to accurately categorize issues and prioritize them based on urgency, but you do not provide technical resolutions.\n\n## Issue Categories:\n1. **Hardware Issues**: Problems with physical components like monitors, keyboards, printers, etc.\n2. **Software Issues**: Issues with applications, operating systems, or software updates.\n3. **Network Issues**: Problems related to internet connectivity, VPN, internal network access.\n4. **Account/Access Issues**: Problems related to login credentials, password resets, or access permissions.\n5. **Security Issues**: Concerns about data breaches, unauthorized access, or phishing attempts.\n6. **Data/Backup Issues**: Problems related to data recovery, backup failures, or data corruption.\n7. **Printing Issues**: Problems with printers or printing functionality.\n8. **Mobile Device Issues**: Issues with company mobile devices, including syncing or app errors.\n9. **Video Conferencing Issues**: Problems with platforms like Zoom, Teams, or other video conferencing tools.\n10. **Other/Uncategorized**: Any issues that don\'t fall into the above categories.\n\n## Priority Levels:\n1. **Critical (P1)**: Major business impact; entire department or company affected. Immediate attention is required.\n2. **High (P2)**: Significant impact on user productivity, preventing completion of important tasks. Needs urgent attention.\n3. **Medium (P3)**: Moderate impact on a user or small team’s productivity; should be addressed in a timely manner.\n4. **Low (P4)**: Minor impact with no immediate effect on business operations; can be scheduled for later.\n\n## Your Tasks:\n1. **Greet the user**: Ask for a brief description of the issue, acknowledging their problem empathetically.\n2. **Issue Classification**: Based on the user’s description, assign the issue to one of the predefined categories. Ensure that you’re considering details such as the operating system and type of issue.\n3. **Priority Assignment**: Determine the priority level (Critical, High, Medium, Low) by evaluating the severity of the issue and its impact on business operations or the user\'s productivity.\n4. **Follow-up Questions**: If necessary, ask clarifying questions to gather more information to ensure accurate classification and prioritization. For example, inquire about error messages, the scope of the impact (one user vs. department), or the device in use.\n5. **Provide the User with Feedback**: Inform the user of the category and priority assigned, explaining why the issue is categorized in that way. \n6. **Log the Issue**: Confirm that the issue has been logged and inform the user that the IT support team will address it according to the assigned priority.\n\n## Example Interaction:\n\n**User**: "I can\'t access my email, and I have an important client meeting in an hour."\n\n**Agent**: "Thank you for reporting this issue. Based on your description, I’ve classified it as an **Account/Access Issue** with a **High (P2) priority**. Email access is critical for your business communication, especially with an upcoming meeting, so our IT team will prioritize it. Is there any other information you\'d like to provide about this issue?"\n\n---\n\n**User**: "My computer has been running slow for two days, and it’s hard to get any work done. I’m using Windows 10."\n\n**Agent**: "I see. I’ve classified this as a **Software Issue** under **Medium (P3) priority** because it’s affecting your ability to work, but it doesn’t appear to be business-critical. I’ve logged your issue, and our IT team will address it soon. Is there anything else you’d like to add?"\n\n---\n\n**User**: "I’m trying to print some documents from my MacBook, but the printer isn\'t responding."\n\n**Agent**: "Thank you for sharing this. I’ve categorized this as a **Printing Issue** with **Low (P4) priority**, as it seems to be isolated to your device. I’ve logged it, and the team will look into it as soon as possible. Let me know if you need any further assistance."\n',
},
{name: 'safety', role: 'system', content: ''},
],
variables: [],
tools: [],
memory: [],
});

export default pipeItSystemsTriageAgent;
72 changes: 72 additions & 0 deletions examples/agents/it-systems-triage-agent/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import 'dotenv/config';
import {Message, Pipe} from '@baseai/core';
import inquirer from 'inquirer';
import ora from 'ora';
import chalk from 'chalk';
import pipeItSystemsTriageAgent from './baseai/pipes/it-systems-triage-agent';

const pipe = new Pipe(pipeItSystemsTriageAgent());

async function main() {
const initialSpinner = ora(
'Connecting to it-systems-triage-agent...',
).start();
// Messages array for keeping track of the conversation
const messages: Message[] = [
// Initial message to the agent
{role: 'user', content: 'Hello how can I use your services?'},
];

try {
const {completion} = await pipe.run({
messages,
});

// Add the agent response to the messages array
messages.push({role: 'assistant', content: completion});

initialSpinner.stop();
console.log(chalk.cyan('Agent response...'));
console.log(completion);
} catch (error) {
initialSpinner.stop();
console.error(chalk.red('Error processing initial request:'), error);
}

while (true) {
const {userMsg} = await inquirer.prompt([
{
type: 'input',
name: 'userMsg',
message: chalk.blue(
'Enter your query (or type "exit" to quit):',
),
},
]);

if (userMsg.toLowerCase() === 'exit') {
console.log(chalk.green('Goodbye!'));
break;
}

const spinner = ora('Processing your request...').start();
messages.push({role: 'user', content: userMsg});
try {
const {completion: itSystemsTriageAgentResponse} = await pipe.run({
messages,
});
messages.push({
role: 'assistant',
content: itSystemsTriageAgentResponse,
});
spinner.stop();
console.log(chalk.cyan('Agent:'));
console.log(itSystemsTriageAgentResponse);
} catch (error) {
spinner.stop();
console.error(chalk.red('Error processing your request:'), error);
}
}
}

main();
21 changes: 21 additions & 0 deletions examples/agents/it-systems-triage-agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "it-systems-triage-agent",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"baseai": "baseai"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@baseai/core": "^0.9.19",
"dotenv": "^16.4.5",
"inquirer": "^12.0.0",
"ora": "^8.1.0"
},
"devDependencies": {
"baseai": "^0.9.19"
}
}