How to Build Autonomous Agents using Prompt Chaining with AI Primitives (No Frameworks)

How to Build Autonomous Agents using Prompt Chaining with AI Primitives (No Frameworks)

Sovereign agents may look complicated, but they do not have to be. These are the AI ​​systems that can make decisions to achieve a purpose and take steps on their own – usually using LLMS, various tools, and memory through a job.

You can create a powerful agent system without heavyweight framework or archetypes engines. This is the easiest and most effective way to use Langbus Agent’s Architecture (made with AI ancient, which does not require any framework to send an expansable AI agent system).

In this article, we will dive into one of the Langabis’ agent architecture: quick chain. We will see why this is useful and how to make it implemented immediately.

The table of content

  1. Provisions

  2. AI ancient (agentic architecture)

  3. What is a quick chain?

  4. The architecture of the instant chains

  5. Lang Base SD’s

  6. Creating an instant chain agent using Lang Base Pipes

  7. Conclusion

Provisions

Before we start making the chains agent immediately, you must be ready to go the following setup and tools.

In this tutorial, I will use the following tech stack:

  • Langbus – Platform to build and deploy your server lace AI agents.

  • Lang Base SD’s – A type script AI SDK, JavaScript, type script, node. JS, Next Dot JS, Reacting, and is designed to work with so on.

  • Open I – To get the LLM key for the priority model.

You also need:

  • Sign up Langbus To access the API key.

  • Sign up Open I LLM Key to develop the model you want to use (this demo’s l i’ll, i will use it openai:gpt-4o-mini Model). You can create a key Here.

AI ancient (agentic architecture)

AI ancient level approaches mean that using the most basic building blocks of AI system-construction-articles, orchestration engines, or fully manufactured framework.

Langbus Pipe And Memory agent Serve like these building blocks.

Pipe agent Lang base is different from other agents. He is a server -equipped AI agent with agent tools who can work with any language or framework. The pipe agents are easily deployed .News, and with just one API they allow you to connect 250+ LLLMS with any data to build any developer API workflow.

Lang Base Memory Agent (Long -term memory solution) is designed to obtain, process, maintain and recover without interruption. They dynamically connect private data to any LLM, and in real time enable the reaction to the context and reduce the deception. Memory, when connected to the pipe agent, becomes a memory agent.

Through these building blocks (AI ancient) you can build the entire agent workflow. For this, Langbus Agent Architecture Works as a boiler plate in the construction, deployment and scaling of independent agents.

Let’s see one of an agent architecture: immediately chains.

What is a quick chain?

Immediate chain is an agent architecture where a task is broken in connection with the indicator. Each step moves its production to the next section, which enables LLM to handle more complex workflows with more accuracy.

This is especially useful for structural tasks such as:

  • Summary and analysis of the document

  • Generation of multi -dimensional materials

  • Changes and cleaning data

  • Content verification and dispersion

Instead of relying on the same indication to do everything, you divide the work into concentrated measures. This makes it easier to debugged, improve output quality, and introduce natural “checkpoints” to your AI workflow.

The architecture of the instant chains

A reference architecture that describes the workflow is:

How to Build Autonomous Agents using Prompt Chaining with AI Primitives (No Frameworks)

This artery is a visual reference on how to immediately use chains to create a lightweight agent system using LLM calls and conditional logic – without any heavyweight framework.

An error of what is happening in the flow is:

  1. → In the LLM Call
  1. Gate
  • The next step estimates Output 1 to decide.

  • Works as a conditional checkpoint (for example, success/failure, confirmation of intent, confidence limit).

  1. If the gate passes:
  • Input goes on to LLM call 2 with output 1.

  • LLM call 2 output 2 produces 2.

  • The output goes to 2 LLM call 3, which produces the final result.

  • The final output flows.

  1. If the gate fails:
  • The flow expires soon when the flow is out.

  • More LLM leaves calls, saves computers and avoids wrong results.

Lang Base SD’s

Lang Base SD’s Using a type script makes it easier to build powerful AI agents. It gives you everything to work with any LLM, connect your embedded models, manage documentary memory, and build AI agents that can argue and respond.

SD of ISnoded Dot J, Next Dot JS, reaction, or any modern JavaScript stack is designed to work with. You can use it to upload documents, make cement memory, and run AI workflows (called pipe agent) with just a few lines of code.

Langbus An API is the first AI platform, and its type script smooth the SDK experience-which makes it easier to start without dealing with infrastructure. Just leave your API key, write your logic, and you are good.

Now, when you know about Langbus SD, come, start building a chain agent immediately.

To make a quick chain agent using Lang Base Pipe

Let’s go by using a real instant chain chain system Langbus pipe agent (Server -equipped AI agent with API united for every LLM). We We We, we are a basic node. JS will set up projects.

We will enforce a set -up product marketing material pipeline that converts raw product description into polished marketing copy through three stages (forming three pipe agents):

First Step (Summary Agent):

  • Takes a raw product description

  • It makes the condenses in two comprehensive sentences

  • A Quality Gate that checks if the summary is in detail (at least 10 words)

Second Step (Features Agent):

Last Step (Marketing Copy Agent):

All steps will use the Open AI4O-minor model through the Lang Base SD. The best thing is that you can also use different LLM models to create each phase/pipe agent.

What makes it interesting is his pipeline point of view. The pipeline manufactures the production of the previous phase at each phase to ensure high quality maintain, which is examined after the summary phase.

Let’s immediately start with the formation of the chains’ agent system.

Step 1: Sort your project

A basic node in the type script. I will develop a JS app that uses Lang Base SDK to create an extended prompting agent agent system. This AI will work after an ancient level of view, without any framework.

To start with it, create a new directory for your project and navigate to it:

mkdir agentic-architecture && cd agentic-architecture

Then the node. Start the JS Project and make a type script file by running this command in your terminal:

npm init -y && touch prompt-chaining.ts

prompt-chaining.ts The file will have the code for all the agent creations contained in it.

After that, we will use Lang Base SDK to make agents and dotenv Managing environmental variables. So, let’s install these dependence.

npm i langbase dotenv

Step 2: Get the Langbus API key

Every request you send to the Lang Base requires an API key. You can produce API keys from you Langbus Studio By following these steps:

  1. Switch to your user or org account.

  2. From the sidebar, click on Settings Menu

  3. In the developer settings section, click on Langbase API keys Link

  4. From here you can create a new API key or manage existing people.

For more details, check Langbus API Keys Documents

After developing the API key, make a .env File in the root of your project and add your Langbase API key to it:

LANGBASE_API_KEY=xxxxxxxxx

Change XXXXXXXXX with your Lang Base API key.

Step 3: Add LLM API Keys

Once you have a Langbase API key, you will also need a LLM key to run a RAG agent. If you have compiled the LLM API keys in your profile, AI memory and agent pipes will use them automatically. Otherwise, go to the LLM API Keys page and add keys for various providers like Openi, Entropic, and similar.

Follow these steps to add LLM keys:

  1. Add LLM API Keys to your account Langbus Studio

  2. Switch to your user or org account.

  3. From the sidebar, click on Settings Menu

  4. In the developer settings section, click on LLM API keys Link

  5. From here you can add LLM API keys to open, simultaneously, interstropic, and similar providers.

Step 4: I add logic prompt-chaining.ts File

I prompt-chaining.ts The file has made you in Step 1, add the following code:

import dotenv from 'dotenv';
import { Langbase } from 'langbase';


dotenv.config();


const langbase = new Langbase({
   apiKey: process.env.LANGBASE_API_KEY!
});


async function main(inputText: string) {
   
   const steps = (
       {
           name: `summary-agent-${Date.now()}`,
           model: 'openai:gpt-4o-mini',
           description:
               'summarize the product description into two concise sentences',
           prompt: `Please summarize the following product description into two concise
           sentences:\n`
       },
       {
           name: `features-agent-${Date.now()}`,
           model: 'openai:gpt-4o-mini',
           description: 'extract key product features as bullet points',
           prompt: `Based on the following summary, list the key product features as
           bullet points:\n`
       },
       {
           name: `marketing-copy-agent-${Date.now()}`,
           model: 'openai:gpt-4o-mini',
           description:
               'generate a polished marketing copy using the bullet points',
           prompt: `Using the following bullet points of product features, generate a
           compelling and refined marketing copy for the product, be precise:\n`
       }
   );


   
   await Promise.all(
       steps.map(step =>
           langbase.pipes.create({
               name: step.name,
               model: step.model,
               messages: (
                   {
                       role: 'system',
                       content: `You are a helpful assistant that can ${step.description}.`
                   }
               )
           })
       )
   );


   
   let data = inputText;


   try {
       
       for (const step of steps) {
           
           const response = await langbase.pipes.run({
               stream: false,
               name: step.name,
               messages: ({ role: 'user', content: `${step.prompt} ${data}` })
           });


           data = response.completion;


           console.log(`Step: ${step.name} \n\n Response: ${data}`);


           
           
           if (step.name === 'summary-agent' && data.split(' ').length < 10) {
               throw new Error(
                   'Gate triggered for summary agent. Summary is too brief. Exiting workflow.'
               );
               return;
           }
       }
   } catch (error) {
       console.error('Error in main workflow:', error);
   }


   
   console.log('Final Refined Product Marketing Copy:', data);
}


const inputText = `Our new smartwatch is a versatile device featuring a high-resolution display,
long-lasting battery life,fitness tracking, and smartphone connectivity. It's designed for
everyday use and is water-resistant. With cutting-edge sensors and a sleek design, it's
perfect for tech-savvy individuals.`;


main(inputText);

An error of the aforementioned code is:

Setup and start:

  • dotenv Load env Variable from .env File for secure API key access.

  • The Lang Base is imported from SDK to communicate with API.

  • A Lang Twenty client example has been created using your API key.

Explain AI steps (Quick China):

Make Lang Base Pipe (Agent):

Run the workflow (sequence processing):

Verification test (gate capping):

  • If the summary output is too low (less than 10 words), the workflow stops with error.

Last output:

  • After all stages, the final result is a better marketing copy printed on the console.

We are using Demo Smart Watch Product Description to see the result inputText Field

Step 5: Run file

To run prompt-chaining.ts File to see the results, you need:

  • Add the type script as dependent

  • Add the script to run type script files

  • Add type script configuration file

Because it lets first install pnpm By running this command in your terminal:

pnpm install

Then once again in your terminal, run this command to add relevant dependence and configuration files:

pnpm add -D typescript ts-node @types/node

Then, create a type script configuration file tsconfig.json:

pnpm exec tsc --init

And update package.json To add relevant scripts. This is your package.json It should be done after updating:

{
 "name": "agentic-architectures",
 "version": "1.0.0",
 "main": "index.js",
 "scripts": {
   "test": "echo \"Error: no test specified\" && exit 1",
   "prompt-chaining": "ts-node prompt-chaining.ts"
 },
 "keywords": (),
 "author": "",
 "license": "ISC",
 "description": "",
 "dependencies": {
   "dotenv": "^16.5.0",
   "langbase": "^1.1.55"
 },
 "devDependencies": {
   "@types/node": "^22.14.1",
   "ts-node": "^10.9.2",
   "typescript": "^5.8.3"
 }
}

Let’s now run the project through PNPM Run Petting Charnings

Conclusion

After running the project, you will see the example of smart watch products in your console as the following.

Step: summarize-description
Response: This smartwatch combines fitness tracking and smartphone connectivity with a high-resolution display and long-lasting battery. Designed for everyday use with a sleek, water-resistant build, it's ideal for tech enthusiasts.

Step: extract-features
Response: Okay, here are the key product features extracted from the summary:

Fitness Tracking
Smartphone Connectivity
High-Resolution Display
Long-Lasting Battery
Sleek Design
Water-Resistant Build
Designed for Everyday Use
Step: refine-marketing-copy
Response: ## Elevate Your Everyday with Seamless Connectivity and Unrivaled Performance.

Experience the perfect fusion of style and functionality with our revolutionary device, designed to seamlessly integrate into your active lifestyle. Stay motivated and informed with comprehensive Fitness Tracking, while effortlessly staying connected via Smartphone Connectivity.

Immerse yourself in vibrant clarity with the stunning High-Resolution Display, and power through your day without interruption thanks to the Long-Lasting Battery. Encased in a Sleek Design, this device is as stylish as it is practical.

Built to withstand the rigors of daily life, the Water-Resistant Build ensures worry-free wear, rain or shine. Engineered for comfort and performance, this device is Designed for Everyday Use, empowering you to live your best life, effortlessly.

In this way you can immediately create chains chains with AI ancient (no framework) using Lang Base SD and Langbes Agent Architecture.

Thank you for reading!

Contact me 🙌:

  • To subscribe to me UTube Channel if you are ready to know about AI and agents.

  • Subscribe to my free newsletter “Agent Engineer” Where I share all the latest AI and agents news/trends/jobs and more.

  • Follow me X (Twitter).

Unlock Your Business Potential with Stan Jackowski Designs

At Stan Jackowski Designs, we bring your ideas to life with cutting-edge creativity and innovation. Whether you need a customized website, professional digital marketing strategies, or expert SEO services, we’ve got you covered! Our team ensures your business, ministry, or brand stands out with high-performing solutions tailored to your needs.

🚀 What We Offer:

  • Web Development – High-converting, responsive, and optimized websites
  • Stunning Design & UI/UX – Eye-catching visuals that enhance engagement
  • Digital Marketing – Creative campaigns to boost your brand presence
  • SEO Optimization – Increase visibility, traffic, and search rankings
  • Ongoing Support – 24/7 assistance to keep your website running smoothly

🔹 Take your business to the next level! Explore our outstanding services today:
Stan Jackowski Services

📍 Located: South of Chicago

📞 Contact Us: https://www.stanjackowski.com/contact

💡 Bonus: If you’re a ministry, church, or non-profit organization, we offer specialized solutions, including website setup, training, and consultation to empower your online presence. Book a FREE 1-hour consultation with Rev. Stanley F. Jackowski today!

🔥 Looking for a done-for-you autoblog website? We specialize in creating money-making autoblog websites that generate passive income on autopilot. Let us handle the technical details while you focus on growth!

📩 Let’s Build Something Amazing Together! Contact us now to get started.

Share:

Facebook
Twitter
Pinterest
LinkedIn