Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📦 NEW: BaseAI CLI Product Engineering Agent #66

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
21 changes: 21 additions & 0 deletions examples/agents/product-engineering-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=
8 changes: 8 additions & 0 deletions examples/agents/product-engineering-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# baseai
**/.baseai/
node_modules
.env
package-lock.json
pnpm-lock.yaml
# env file
.env
53 changes: 53 additions & 0 deletions examples/agents/product-engineering-agent/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
![Product Engineering Agent by ⌘ BaseAI][cover]

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

## Build a Product Engineering Agent with BaseAI framework — ⌘ Langbase

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.

## Features

- Product Engineering 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/product-engineering-agent
[gh]: https://github.com/LangbaseInc/baseai/tree/main/examples/agents/product-engineering-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/agents/product-engineering-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/product-engineering-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': true,
'pipe.response': true,
tool: true,
memory: true
},
memory: {
useLocalEmbeddings: false
},
envFilePath: '.env'
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
## Product Information

1. Product Name: CleanSweep Pro X3
2. Category: Smart Home Appliances - Robot Vacuum Cleaners
3. Launch Date: September 1, 2023
4. Current Version: 1.2 (Software), Model 2024A (Hardware)
5. Key Features:
- LiDAR navigation and mapping
- App control via smartphone
- Voice assistant compatibility (Alexa, Google Assistant)
- 3-stage cleaning system (dual brushes + suction)
- Automatic dirt disposal base (holds up to 30 days of debris)
- 120-minute battery life
- Carpet boost function
- Multi-floor mapping (up to 4 floors)
6. Target Market: Busy professionals and tech-savvy homeowners, ages 25-55
7. Price Point: $499.99 (with self-emptying base)
8. Current Market Share: 12%

## User Feedback

1. "Great suction power, but it sometimes misses corners in my home." - James L.
2. "The app is intuitive, but it occasionally loses connection to the vacuum." - Maria S.
3. "Battery life seems shorter than advertised, especially on carpet." - Tom R.
4. "Love the self-emptying feature, but the disposal bags are expensive." - Sarah K.
5. "It gets stuck on the transition from hardwood to my high-pile carpet." - Ahmed M.
6. "Excellent on hard floors, but not as effective on pet hair on carpets." - Emily W.
7. "The LiDAR navigation is precise, but I wish it had a camera for remote viewing." - Carlos B.
8. "It's louder than I expected, especially when on maximum suction." - Lisa T.

## Market Trends

1. Growing demand for eco-friendly and energy-efficient cleaning solutions
2. Increased interest in air purification features in robot vacuums
3. Rising popularity of combo robot vacuums and mops
4. Emphasis on smart home integration and scene-based cleaning routines
5. Trend towards using AI for personalized cleaning schedules and wear-and-tear diagnostics

## Competitor Information

1. Main Competitor: SwiftClean UltraGlide
- Market Share: 18%
- Unique Feature: Built-in mop function with electronic water flow control
- Price Point: $599.99

2. Up-and-Coming Competitor: EcoVac Green
- Market Share: 7%
- Unique Feature: Made from 70% recycled materials, biodegradable dust bags
- Price Point: $449.99

## Additional Context

1. Recent study shows increasing concern about indoor air quality among homeowners
2. Upcoming holiday shopping season in 2 months
3. Company's goal to expand product line to include a handheld vacuum accessory
4. Industry shift towards more repairable and modular designs to reduce e-waste
5. Growing market for pet-specific cleaning solutions
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { MemoryI } from '@baseai/core';
import path from 'path';

const memoryProductDocs = (): MemoryI => ({
name: 'product-docs',
description: 'data for product engineering insights',
});

export default memoryProductDocs;
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { PipeI } from '@baseai/core';
import memoryProductDocs from '../memory/product-docs';

const pipeProductEngineeringAgent = (): PipeI => ({
// Replace with your API key https://langbase.com/docs/api-reference/api-keys
apiKey: process.env.LANGBASE_API_KEY!,
name: `product-engineering-agent`,
description: ``,
status: `private`,
model: `openai:gpt-4o-mini`,
stream: true,
json: false,
store: true,
moderate: true,
top_p: 1,
max_tokens: 1000,
temperature: 0.4,
presence_penalty: 0,
frequency_penalty: 0,
stop: [],
tool_choice: 'auto',
parallel_tool_calls: true,
messages: [
{
role: 'system',
content:
'You are an AI assistant specializing in product engineering and improvement. Your role is to analyze product information and user feedback to generate valuable insights and recommendations for product enhancements. If user has request to use the attached CONTEXT for product engineer analysis then you use that CONTEXT otherwise you can use the product feedback data provided to you. \n\n## Guidelines:\n\n1. **Thorough Analysis**: Carefully analyze the provided product information and user feedback to understand the product\'s current performance and the user experience.\n2. **Identify Key Areas**: Focus on identifying major pain points from users and align your analysis with current market trends to spot areas needing improvement.\n3. **Actionable Recommendations**: Provide specific and actionable recommendations for product enhancements that address the identified issues.\n4. **Prioritization**: Prioritize your recommendations based on the potential impact on the product and the feasibility of implementation. Consider balancing quick fixes with strategic, long-term improvements.\n5. **Short-Term vs. Long-Term**: Clearly distinguish between recommendations that can be implemented quickly to address immediate concerns and those that are more strategic and long-term.\n6. **Data-Driven Reasoning**: Support your recommendations with data or clear reasoning whenever possible to enhance the credibility of your insights.\n7. **Creative Solutions**: Be open to innovative or out-of-the-box solutions that might offer fresh ways to enhance the product or resolve user pain points.\n8. **Address Challenges**: Highlight any challenges or potential drawbacks that might arise with each recommendation to provide a balanced view.\n9. **Tailored Communication**: Adapt your language and the level of technical detail based on the user\'s expertise, ensuring your insights are accessible and actionable.\n10. **Ask for Clarification**: If the product information or feedback lacks clarity or detail, ask clarifying questions to ensure that your recommendations are well-informed.\n\n## When provided with product information and user feedback, respond with:\n\n1. **Summary of Key Issues**: A concise summary of the primary challenges or issues identified from the product analysis and user feedback.\n2. **Prioritized Recommendations**: Offer 3-5 prioritized recommendations for product improvements that are specific, actionable, and address the identified pain points.\n3. **Potential Impact**: For each recommendation, describe the potential impact it could have on the product or user experience.\n4. **Additional Data Needed**: Mention any additional research or data that would assist in refining the recommendations or further understanding the product and its challenges.\n\nRemember, your recommendations should strike a balance between practicality and creativity, offering both realistic solutions and forward-thinking innovation.\n\n**Example Input**: \n"We have received feedback that users are experiencing slow load times on the mobile version of our app, and some features like the search function are difficult to navigate."\n\n**Example Output**:\n\n**Summary of Key Issues**:\n1. Users are experiencing slow load times on the mobile app.\n2. The search function is reported as being difficult to navigate, causing user frustration.\n\n**Recommendations**:\n1. **Optimize Mobile Performance**: Implement caching mechanisms or reduce asset sizes to improve load times, which will enhance user satisfaction and reduce app abandonment rates.\n - **Impact**: This will lead to a faster, more responsive app, improving user retention and engagement.\n \n2. **Redesign Search Functionality**: Simplify the search UI/UX by adding filters and improving the search algorithm to make it more intuitive.\n - **Impact**: A smoother search experience will reduce user frustration and make it easier for users to find what they need, increasing overall app usability.\n\n3. **Introduce an In-App Feedback Feature**: Allow users to report specific issues directly from the app, enabling quicker identification and resolution of user problems.\n - **Impact**: Faster feedback will lead to more direct insights from users, improving product iteration and customer satisfaction.\n\n**Additional Data**:\n1. Gathering analytics on specific mobile device load times.\n2. More detailed user feedback on specific pain points in the search experience.\n'
},
{ name: 'json', role: 'system', content: '' },
{ name: 'safety', role: 'system', content: '' },
{
name: 'opening',
role: 'system',
content: 'Welcome to Langbase. Prompt away!'
},
{ name: 'rag', role: 'system', content: '' }
],
variables: [],
tools: [],
memory: [memoryProductDocs()]
});

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

const pipe = new Pipe(pipeProductEngineeringAgent());

async function main() {

const initialSpinner = ora('Checking attached product data...').start();
try {
const { completion: initialProductEngAgentResponse } = await pipe.run({
messages: [{ role: 'user', content: 'I have attached document in the CONTEXT, proceed with your analysis' }],
});
initialSpinner.stop();
console.log(chalk.cyan('Product Engineering Agent response...'));
console.log(initialProductEngAgentResponse);
} 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();

try {
const { completion: productEngAgentResponse } = await pipe.run({
messages: [{ role: 'user', content: userMsg }],
});

spinner.stop();
console.log(chalk.cyan('Agent:'));
console.log(productEngAgentResponse);
} catch (error) {
spinner.stop();
console.error(chalk.red('Error processing your request:'), error);
}
}
}

main();
22 changes: 22 additions & 0 deletions examples/agents/product-engineering-agent/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "product-engineering-agent",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"baseai": "baseai"
},
"keywords": [],
"author": "",
"license": "ISC",
"description": "",
"dependencies": {
"@baseai/core": "^0.9.3",
"dotenv": "^16.4.5",
"inquirer": "^12.0.0",
"ora": "^8.1.0"
},
"devDependencies": {
"baseai": "^0.9.3"
}
}