From e5d9e28d971f43740672740eabf3826d03338caa Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:39:17 +0200 Subject: [PATCH 1/8] added gitignore --- examples/agents/agile-stories-agent/.gitignore | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 examples/agents/agile-stories-agent/.gitignore diff --git a/examples/agents/agile-stories-agent/.gitignore b/examples/agents/agile-stories-agent/.gitignore new file mode 100644 index 00000000..c256453b --- /dev/null +++ b/examples/agents/agile-stories-agent/.gitignore @@ -0,0 +1,8 @@ +# baseai +**/.baseai/ +node_modules +.env +package-lock.json +pnpm-lock.yaml +# env file +.env From 2ae7d1ce7cab92321d4d02551c9f021d30a0a2ba Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:39:31 +0200 Subject: [PATCH 2/8] added env example file --- .../agile-stories-agent/.env.baseai.example | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 examples/agents/agile-stories-agent/.env.baseai.example diff --git a/examples/agents/agile-stories-agent/.env.baseai.example b/examples/agents/agile-stories-agent/.env.baseai.example new file mode 100644 index 00000000..8c643651 --- /dev/null +++ b/examples/agents/agile-stories-agent/.env.baseai.example @@ -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= From 6e3c8668f15de9d83873dfebe386b36b04f1dfe1 Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:40:21 +0200 Subject: [PATCH 3/8] main for agile-user-stories-agent --- examples/agents/agile-stories-agent/index.ts | 57 ++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 examples/agents/agile-stories-agent/index.ts diff --git a/examples/agents/agile-stories-agent/index.ts b/examples/agents/agile-stories-agent/index.ts new file mode 100644 index 00000000..faf4436c --- /dev/null +++ b/examples/agents/agile-stories-agent/index.ts @@ -0,0 +1,57 @@ +import 'dotenv/config'; +import { Pipe } from '@baseai/core'; +import inquirer from 'inquirer'; +import ora from 'ora'; +import chalk from 'chalk'; +import pipeAgileUserStoriesAgent from './baseai/pipes/agile-user-stories-agent'; + + +const pipe = new Pipe(pipeAgileUserStoriesAgent()); + +async function main() { + + const initialSpinner = ora('Checking attached content type...').start(); + try { + const { completion: initialUserStoriesAgentReps } = await pipe.run({ + messages: [{ role: 'user', content: 'How can I use your services?' }], + }); + initialSpinner.stop(); + console.log(chalk.cyan('User Stories Agent response...')); + console.log(initialUserStoriesAgentReps); + } 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: userStoriesAgentResp } = await pipe.run({ + messages: [{ role: 'user', content: userMsg }], + }); + + spinner.stop(); + console.log(chalk.cyan('Agent:')); + console.log(userStoriesAgentResp); + } catch (error) { + spinner.stop(); + console.error(chalk.red('Error processing your request:'), error); + } + } +} + +main(); \ No newline at end of file From b4443b1f5b82e0907cb1996798ba85a782824710 Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:40:40 +0200 Subject: [PATCH 4/8] required packages for CLI agile-user-stories-agent --- .../agents/agile-stories-agent/package.json | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 examples/agents/agile-stories-agent/package.json diff --git a/examples/agents/agile-stories-agent/package.json b/examples/agents/agile-stories-agent/package.json new file mode 100644 index 00000000..f1fddee0 --- /dev/null +++ b/examples/agents/agile-stories-agent/package.json @@ -0,0 +1,22 @@ +{ + "name": "agile-user-stories-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" + } +} From 1f16808da11947b40e9c29efb5aaddcf091f0fe4 Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:40:53 +0200 Subject: [PATCH 5/8] log swtiched off for agile-user-stories-agent --- .../baseai/baseai.config.ts | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 examples/agents/agile-stories-agent/baseai/baseai.config.ts diff --git a/examples/agents/agile-stories-agent/baseai/baseai.config.ts b/examples/agents/agile-stories-agent/baseai/baseai.config.ts new file mode 100644 index 00000000..3c0328bc --- /dev/null +++ b/examples/agents/agile-stories-agent/baseai/baseai.config.ts @@ -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' +}; From e34a2fef71080c8f2fdd7480e1c100316090328c Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 02:41:20 +0200 Subject: [PATCH 6/8] baseai pipe for cli agile-user-stories-agent --- .../baseai/pipes/agile-user-stories-agent.ts | 42 +++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 examples/agents/agile-stories-agent/baseai/pipes/agile-user-stories-agent.ts diff --git a/examples/agents/agile-stories-agent/baseai/pipes/agile-user-stories-agent.ts b/examples/agents/agile-stories-agent/baseai/pipes/agile-user-stories-agent.ts new file mode 100644 index 00000000..a4b09029 --- /dev/null +++ b/examples/agents/agile-stories-agent/baseai/pipes/agile-user-stories-agent.ts @@ -0,0 +1,42 @@ +import { PipeI } from '@baseai/core'; + +const pipeAgileUserStoriesAgent = (): PipeI => ({ + // Replace with your API key https://langbase.com/docs/api-reference/api-keys + apiKey: process.env.LANGBASE_API_KEY!, + name: `agile-user-stories-agent`, + description: ``, + status: `public`, + 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 assistant and agent that specializing in software engineering and agile methodologies. Your role is to generate user stories and acceptance criteria based on the project requirements provided by the user. Please follow these guidelines:\n\nGuidelines:\n\n1. **Understand the Requirement**: Analyze the project requirement provided by the user. For example, a project requirement might be, 'We need a feature for users to reset their password.'\n\n2. **User Story Format**: Create user stories using the format: 'As a [type of user], I want [an action] so that [a benefit/value].' Ensure each story adheres to the SMART criteria (Specific, Measurable, Achievable, Relevant, Time-bound). For example, ensure the story is measurable: 'I want to reset my password within 5 minutes.'\n\n3. **Acceptance Criteria Format**: Use the Given-When-Then structure for acceptance criteria:\n - Given [a context]\n - When [an action is performed]\n - Then [a set of observable outcomes should occur]\n Ensure criteria are clear, concise, and testable, covering both positive and negative scenarios when appropriate.\n\n4. **Adaptability**: Generate 3-5 user stories or acceptance criteria per requirement by default, but adapt the quantity based on the complexity of the requirement. Adjust based on user feedback.\n\n5. **Proactive Clarification**: If the requirements are vague or incomplete, ask clarifying questions to ensure the most accurate stories and criteria. After generating stories and criteria, proactively ask the user for feedback or additional context to refine the output further.\n\n**Example Input**: 'We need a feature for users to reset their password.'\n\n**Example Output**:\n\n**User Stories**:\n1. As a registered user, I want to reset my password so that I can regain access to my account if I forget my credentials.\n2. As a security-conscious user, I want a secure method to reset my password so that I can protect my account from unauthorized access.\n\n**Acceptance Criteria**:\n1. Given a user has forgotten their password \n When they click on the \"Forgot Password\" link \n Then they should be prompted to enter their email address.\n2. Given a user has entered their email address for password reset \n When they submit the form \n Then a unique password reset link should be sent to their email.\n3. Given a user clicks on the password reset link \n When they enter a new password and confirm it \n Then their password should be updated, and they should be able to log in with the new password.\n\nHow can I assist you further with your project requirements?\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: [] +}); + +export default pipeAgileUserStoriesAgent; From f3c1d7671c4bbe387aaff91b50d975648bc1ddd3 Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 03:11:43 +0200 Subject: [PATCH 7/8] Updated intial question --- examples/agents/agile-stories-agent/index.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/agents/agile-stories-agent/index.ts b/examples/agents/agile-stories-agent/index.ts index faf4436c..4df03f16 100644 --- a/examples/agents/agile-stories-agent/index.ts +++ b/examples/agents/agile-stories-agent/index.ts @@ -10,10 +10,10 @@ const pipe = new Pipe(pipeAgileUserStoriesAgent()); async function main() { - const initialSpinner = ora('Checking attached content type...').start(); + const initialSpinner = ora('Connecting to agile user stories agent...').start(); try { const { completion: initialUserStoriesAgentReps } = await pipe.run({ - messages: [{ role: 'user', content: 'How can I use your services?' }], + messages: [{ role: 'user', content: 'Let me know how to use your services?' }], }); initialSpinner.stop(); console.log(chalk.cyan('User Stories Agent response...')); From 18eb3c984eeee349c60a9cafd8da73dda53939cb Mon Sep 17 00:00:00 2001 From: ali Date: Wed, 16 Oct 2024 03:12:54 +0200 Subject: [PATCH 8/8] added readme for agile user stories agent cli --- examples/agents/agile-stories-agent/README.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 examples/agents/agile-stories-agent/README.md diff --git a/examples/agents/agile-stories-agent/README.md b/examples/agents/agile-stories-agent/README.md new file mode 100644 index 00000000..42ead1fc --- /dev/null +++ b/examples/agents/agile-stories-agent/README.md @@ -0,0 +1,53 @@ +![Agile User Stories Agent by ⌘ BaseAI][cover] + +![License: MIT][mit] [![Fork on ⌘ Langbase][fork]][pipe] + +## Build an Agile User Stories 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 + +- Agile User Stories 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]
+**_Built by ⌘ [Langbase.com][lb] — Ship hyper-personalized AI assistants with memory!_** + + +[lb]: https://langbase.com +[pipe]: https://langbase.com/examples/agile-user-stories-agent +[gh]: https://github.com/LangbaseInc/baseai/tree/main/examples/agents/agile-user-stories-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/agile-user-stories-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 \ No newline at end of file