Skip to content

Commit b839734

Browse files
📦 NEW: Example IT systems triage agent (#72)
* added gitignore * added env example file * main for it-systems-triage-agent cli * packages added for it-systems-triage-agent cli * added readme for it-systems-triage-agent cli * logging switched off for it-systems-triage-agent cli * baseai pipe config for it-systems-triage-agent cli * 📦 NEW: Thread functionality * 📦 NEW: Bilal Review --------- Co-authored-by: Ahmad Bilal <[email protected]>
1 parent 45ce973 commit b839734

File tree

7 files changed

+252
-0
lines changed

7 files changed

+252
-0
lines changed
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# !! SERVER SIDE ONLY !!
2+
# Keep all your API keys secret — use only on the server side.
3+
4+
# TODO: ADD: Both in your production and local env files.
5+
# Langbase API key for your User or Org account.
6+
# How to get this API key https://langbase.com/docs/api-reference/api-keys
7+
LANGBASE_API_KEY=
8+
9+
# TODO: ADD: LOCAL ONLY. Add only to local env files.
10+
# Following keys are needed for local pipe runs. For providers you are using.
11+
# For Langbase, please add the key to your LLM keysets.
12+
# Read more: Langbase LLM Keysets https://langbase.com/docs/features/keysets
13+
OPENAI_API_KEY=
14+
ANTHROPIC_API_KEY=
15+
COHERE_API_KEY=
16+
FIREWORKS_API_KEY=
17+
GOOGLE_API_KEY=
18+
GROQ_API_KEY=
19+
MISTRAL_API_KEY=
20+
PERPLEXITY_API_KEY=
21+
TOGETHER_API_KEY=
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# baseai
2+
**/.baseai/
3+
node_modules
4+
.env
5+
package-lock.json
6+
pnpm-lock.yaml
7+
# env file
8+
.env
9+
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
![IT Systems Triage Agent by ⌘ BaseAI][cover]
2+
3+
![License: MIT][mit] [![Fork on ⌘ Langbase][fork]][pipe]
4+
5+
## Build an IT Systems Triage Agent with BaseAI framework — ⌘ Langbase
6+
7+
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.
8+
9+
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.
10+
11+
## How to use
12+
13+
Navigate to `examples/agents/it-systems-triage-agent` and run the following commands:
14+
15+
```sh
16+
# Navigate to baseai/examples/agents/it-systems-triage-agent
17+
cd examples/agents/it-systems-triage-agent
18+
19+
# Install the dependencies
20+
npm install
21+
22+
# Make sure to copy .env.baseai.example file and
23+
# create .env file and add all the relevant API keys in it
24+
cp .env.baseai.example .env
25+
26+
# Run the local baseai dev server to test the examples (uses localhost:9000 port)
27+
npx baseai dev
28+
29+
# Run the agent
30+
tsx index.ts
31+
```
32+
33+
## Features
34+
35+
- IT Systems Triage Agent — Built with [BaseAI framework and agentic Pipe ⌘ ][qs].
36+
- Composable Agents — build and compose agents with BaseAI.
37+
- Add and Sync deployed pipe on Langbase locally npx baseai@latest add ([see the Code button][pipe]).
38+
39+
## Learn more
40+
41+
1. Check the [Learning path to build an agentic AI pipe with ⌘ BaseAI][learn]
42+
2. Read the [source code on GitHub][gh] for this agent example
43+
3. Go through Documentaion: [Pipe Quick Start][qs]
44+
4. Learn more about [Memory features in ⌘ BaseAI][memory]
45+
5. Learn more about [Tool calls support in ⌘ BaseAI][toolcalls]
46+
47+
48+
> NOTE:
49+
> This is a BaseAI project, you can deploy BaseAI pipes, memory and tool calls on Langbase.
50+
51+
---
52+
53+
## Authors
54+
55+
This project is created by [Langbase][lb] team members, with contributions from:
56+
57+
- Muhammad-Ali Danish - Software Engineer, [Langbase][lb] <br>
58+
**_Built by ⌘ [Langbase.com][lb] — Ship hyper-personalized AI assistants with memory!_**
59+
60+
[lb]: https://langbase.com
61+
[pipe]: https://langbase.com/examples/it-systems-triage-agent
62+
[gh]: https://github.com/LangbaseInc/baseai/tree/main/examples/agents/it-systems-triage-agent
63+
[cover]:https://raw.githubusercontent.com/LangbaseInc/docs-images/main/baseai/baseai-cover.png
64+
[download]:https://download-directory.github.io/?url=https://github.com/LangbaseInc/baseai/tree/main/examples/it-systems-triage-agent
65+
[learn]:https://baseai.dev/learn
66+
[memory]:https://baseai.dev/docs/memory/quickstart
67+
[toolcalls]:https://baseai.dev/docs/tools/quickstart
68+
[deploy]:https://baseai.dev/docs/deployment/authentication
69+
[signup]: https://langbase.fyi/io
70+
[qs]:https://baseai.dev/docs/pipe/quickstart
71+
[docs]:https://baseai.dev/docs
72+
[xaa]:https://x.com/MrAhmadAwais
73+
[xab]:https://x.com/AhmadBilalDev
74+
[local]:http://localhost:9000
75+
[mit]: https://img.shields.io/badge/license-MIT-blue.svg?style=for-the-badge&color=%23000000
76+
[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
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import type {BaseAIConfig} from 'baseai';
2+
3+
export const config: BaseAIConfig = {
4+
log: {
5+
isEnabled: false,
6+
logSensitiveData: false,
7+
pipe: true,
8+
'pipe.completion': true,
9+
'pipe.request': false,
10+
'pipe.response': false,
11+
tool: false,
12+
memory: false,
13+
},
14+
memory: {
15+
useLocalEmbeddings: false,
16+
},
17+
envFilePath: '.env',
18+
};
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import {PipeI} from '@baseai/core';
2+
3+
const pipeItSystemsTriageAgent = (): PipeI => ({
4+
// Replace with your API key https://langbase.com/docs/api-reference/api-keys
5+
apiKey: process.env.LANGBASE_API_KEY!,
6+
name: `it-systems-triage-agent`,
7+
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.`,
8+
status: `private`,
9+
model: `openai:gpt-4o-mini`,
10+
stream: true,
11+
json: false,
12+
store: true,
13+
moderate: true,
14+
top_p: 1,
15+
max_tokens: 1000,
16+
temperature: 0.7,
17+
presence_penalty: 0,
18+
frequency_penalty: 0,
19+
stop: [],
20+
tool_choice: 'auto',
21+
parallel_tool_calls: true,
22+
messages: [
23+
{
24+
role: 'system',
25+
content:
26+
'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',
27+
},
28+
{name: 'safety', role: 'system', content: ''},
29+
],
30+
variables: [],
31+
tools: [],
32+
memory: [],
33+
});
34+
35+
export default pipeItSystemsTriageAgent;
Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import 'dotenv/config';
2+
import {Message, Pipe} from '@baseai/core';
3+
import inquirer from 'inquirer';
4+
import ora from 'ora';
5+
import chalk from 'chalk';
6+
import pipeItSystemsTriageAgent from './baseai/pipes/it-systems-triage-agent';
7+
8+
const pipe = new Pipe(pipeItSystemsTriageAgent());
9+
10+
async function main() {
11+
const initialSpinner = ora(
12+
'Connecting to it-systems-triage-agent...',
13+
).start();
14+
// Messages array for keeping track of the conversation
15+
const messages: Message[] = [
16+
// Initial message to the agent
17+
{role: 'user', content: 'Hello how can I use your services?'},
18+
];
19+
20+
try {
21+
const {completion} = await pipe.run({
22+
messages,
23+
});
24+
25+
// Add the agent response to the messages array
26+
messages.push({role: 'assistant', content: completion});
27+
28+
initialSpinner.stop();
29+
console.log(chalk.cyan('Agent response...'));
30+
console.log(completion);
31+
} catch (error) {
32+
initialSpinner.stop();
33+
console.error(chalk.red('Error processing initial request:'), error);
34+
}
35+
36+
while (true) {
37+
const {userMsg} = await inquirer.prompt([
38+
{
39+
type: 'input',
40+
name: 'userMsg',
41+
message: chalk.blue(
42+
'Enter your query (or type "exit" to quit):',
43+
),
44+
},
45+
]);
46+
47+
if (userMsg.toLowerCase() === 'exit') {
48+
console.log(chalk.green('Goodbye!'));
49+
break;
50+
}
51+
52+
const spinner = ora('Processing your request...').start();
53+
messages.push({role: 'user', content: userMsg});
54+
try {
55+
const {completion: itSystemsTriageAgentResponse} = await pipe.run({
56+
messages,
57+
});
58+
messages.push({
59+
role: 'assistant',
60+
content: itSystemsTriageAgentResponse,
61+
});
62+
spinner.stop();
63+
console.log(chalk.cyan('Agent:'));
64+
console.log(itSystemsTriageAgentResponse);
65+
} catch (error) {
66+
spinner.stop();
67+
console.error(chalk.red('Error processing your request:'), error);
68+
}
69+
}
70+
}
71+
72+
main();
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "it-systems-triage-agent",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"scripts": {
6+
"baseai": "baseai"
7+
},
8+
"keywords": [],
9+
"author": "",
10+
"license": "ISC",
11+
"description": "",
12+
"dependencies": {
13+
"@baseai/core": "^0.9.19",
14+
"dotenv": "^16.4.5",
15+
"inquirer": "^12.0.0",
16+
"ora": "^8.1.0"
17+
},
18+
"devDependencies": {
19+
"baseai": "^0.9.19"
20+
}
21+
}

0 commit comments

Comments
 (0)