Multi-agent techniques (MAS) signify a transformative method in synthetic intelligence, the place a number of autonomous brokers collaborate to resolve advanced issues and obtain shared targets. These techniques excel in situations requiring specialization and flexibility, making them supreme for numerous functions, from automated buying and selling to multi-robot coordination. With the arrival of GripTape, creating multi-agent techniques has grow to be extra accessible than ever. GripTape simplifies the event course of by offering a strong framework that permits builders to simply design, handle, and scale their agent-based functions, enabling seamless communication and coordination amongst brokers.
Studying Goals
- GripTape’s modular structure, core elements, and key options, and examine it with LangChain.
- We are going to exhibit find out how to automate the distribution of a weblog to potential actual property consumers in Gurgaon utilizing a multi-agent system built-in with GripTape.
- Moreover, we are going to showcase a Python implementation of a Retrieval-Augmented Technology (RAG) system, highlighting how GripTape’s modularity makes it simple and seamless to combine such techniques for automation.
Modularity at its Greatest with GripTape
Griptape is a modular Python framework designed for creating AI functions that make the most of language fashions (LLMs). Its structure is constructed round a number of core elements, which facilitate the creation of versatile and scalable workflows. GripTape units itself aside by its modular design, modern Off-Immediate™ know-how, robust integration capabilities with LLMs, complete documentation, group help, and adaptability in use circumstances. These options collectively improve the event expertise and empower customers to create sturdy AI functions effectively.
AI brokers are specialised applications or fashions designed to carry out duties autonomously utilizing LLMs, usually mimicking human decision-making, reasoning, and studying. They work together with customers or techniques, be taught from information, adapt to new data, and execute particular features inside an outlined scope, like buyer help, course of automation, or advanced information evaluation. With GripTape, the creation of a multiagent system turns into seamless and straightforward.
Core Elements of Griptape
On the coronary heart of GripTape are its core elements, which work collectively to create a versatile, environment friendly, and highly effective setting for builders.
Buildings:
- Brokers: Single-task entities that carry out particular features.
- Pipelines: Arrange a sequence of duties, permitting the output from one activity to circulate into the subsequent.
- Workflows: Configure a number of duties to function in parallel
- Duties: The basic models inside constructions that allow interplay with engines, instruments, and different Griptape elements.
- Instruments: Present capabilities for LLMs to work together with information and companies. Griptape consists of numerous built-in instruments and permits for simple creation of customized instruments.
Reminiscence:
- Dialog Reminiscence: Retains and retrieves data throughout interactions.
- Job Reminiscence: Retains massive or delicate outputs off the immediate despatched to the LLM.
- Meta Reminiscence: Passes extra metadata to reinforce context and relevance in interactions.
Drivers and Engines: Varied drivers facilitate interactions with exterior sources, together with immediate drivers, embedding drivers, SQL drivers, and net search drivers.
Observability and Rulesets: Helps occasion monitoring and logging for efficiency monitoring, whereas rulesets information LLM behaviour with minimal immediate engineering.
Key Options of Griptape
1. Modular Structure
Griptape’s structure is constructed round modular elements that enable builders to create versatile and scalable functions. The core constructions embrace brokers, pipelines, and work strains amongst others.
2. Duties and Instruments
Duties are the elemental constructing blocks inside Griptape, enabling interplay with numerous engines and instruments. Griptape gives quite a lot of built-in instruments, similar to Net Scraper Instruments, File Supervisor Instruments, and Immediate Abstract Instruments. Builders also can create customized instruments tailor-made to their particular wants.
3. Reminiscence Administration
Griptape options superior reminiscence administration capabilities that improve consumer interactions. Dialog Reminiscence helps retain and retrieve data throughout interactions. Job Reminiscence retains massive or delicate outputs off the immediate despatched to the LLM, stopping token restrict overflow. Meta Reminiscence permits passing extra metadata to the LLM, enhancing context relevance.
4. Drivers and Engines
Griptape consists of numerous drivers that facilitate interactions with exterior sources, together with Prompt Drivers that handle textual interactions with LLMs, and Embedding Drivers that generate vector embeddings from textual content. Engines wrap these drivers to supply use-case-specific functionalities, such because the RAG Engine for enhanced retrieval capabilities.
The RAG Engine is a key element of Griptape that facilitates modular Retrieval-Augmented Technology pipelines. It permits functions to retrieve related data from exterior sources and mix it with generative capabilities, leading to extra correct and contextually conscious outputs.
Evaluating Griptape vs. LangChain
Whereas each Griptape and LangChain supply frameworks for implementing RAG pipelines, they differ considerably in design philosophy and performance.
Structure Variations
- Modularity: Griptape emphasizes a extremely modular structure that permits builders to create customized workflows simply. Every element (brokers, pipelines, workflows) serves a definite function, permitting for larger flexibility in software design.
- Integration Strategy: LangChain additionally helps modularity however focuses extra on chaining collectively elements in a linear trend. Whereas it gives flexibility by its chains of thought method, it might not supply the identical degree of customization as Griptape’s constructions.
Reminiscence Administration
Griptape’s reminiscence administration is especially modern because of its Job Reminiscence function. This enables massive outputs to be saved individually from prompts despatched to LLMs. In distinction, LangChain usually manages reminiscence in a different way with out this particular deal with separating activity outputs from prompts.
Tooling Flexibility
Griptape gives an intensive vary of built-in instruments tailor-made for numerous duties (e.g., net scraping, and file administration). Builders can simply create customized instruments as wanted. Whereas LangChain additionally helps customized elements, its out-of-the-box tooling will not be as various as what Griptape provides.
Fingers-On Python Implementation of a Multi-Agentic System utilizing GripTape
Within the following steps, we are going to discover how we are able to allow the automation of a weblog to be despatched to potential Actual Property Patrons in Gurgaon by integrating a multi-agentic system utilizing GripTape.
Step 1. Putting in Mandatory Libraries
!pip set up "griptape[all]" -U
Step 2. Importing Mandatory Libraries & Defining OpenAI Keys
from duckduckgo_search import DDGS
from griptape.artifacts import TextArtifact
from griptape.drivers import LocalStructureRunDriver
from griptape.guidelines import Rule
from griptape.constructions import Agent, Pipeline, Workflow
from griptape.duties import CodeExecutionTask, PromptTask, StructureRunTask
from griptape.drivers import GoogleWebSearchDriver, LocalStructureRunDriver
from griptape.guidelines import Rule, Ruleset
from griptape.constructions import Agent, Workflow
from griptape.duties import PromptTask, StructureRunTask
from griptape.instruments import (
PromptSummaryTool,
WebScraperTool,
WebSearchTool,
)
from griptape.drivers import DuckDuckGoWebSearchDriver
import os
os.environ["OPENAI_API_KEY"]=''
Step 3. Defining Author & Researcher Brokers
Defining the Writers
WRITERS = [
{
"role": "Luxury Blogger",
"goal": "Inspire Luxury with stories of royal things that people aspire",
"backstory": "You bring aspirational and luxurious things to your audience through vivid storytelling and personal anecdotes.",
},
{
"role": "Lifestyle Freelance Writer",
"goal": "Share practical advice on living a balanced and stylish life",
"backstory": "From the latest trends in home decor to tips for wellness, your articles help readers create a life that feels both aspirational and attainable.",
},
]
We outline two writers right here – luxurious bloggers and way of life freelance writers. We’re defining the aim and backstory right here as we might need this technique to roll out blogs on actual property updates of Gurgaon from the angle of luxurious and way of life.
Defining the Researcher Agent
def build_researcher() -> Agent:
"""Builds a Researcher Construction."""
return Agent(
id="researcher",
instruments=[
WebSearchTool(
web_search_driver=DuckDuckGoWebSearchDriver(),
),
WebScraperTool(
off_prompt=True,
),
PromptSummaryTool(off_prompt=False),
],
rulesets=[
Ruleset(
name="Position",
rules=[
Rule(
value="Lead Real Estate Analyst",
)
],
),
Ruleset(
identify="Goal",
guidelines=[
Rule(
value="Discover Real Estate advancements in and around Delhi NCR",
)
],
),
Ruleset(
identify="Background",
guidelines=[
Rule(
value="""You are part of a Real Estate Brokering Company.
Your speciality is spotting new trends in Real Estate for buyers and sells.
You excel at analyzing intricate data and delivering practical insights."""
)
],
),
Ruleset(
identify="Desired Final result",
guidelines=[
Rule(
value="Comprehensive analysis report in list format",
)
],
),
],
)
The perform `build_researcher()` creates an `Agent` object, which represents a digital researcher with specialised instruments and rulesets.
- Instruments: The agent is supplied with three instruments:
- WebSearchTool makes use of a DuckDuckGo net search driver for retrieving on-line information.
- WebScraperTool with an possibility to show off prompts for scraping information.
- PromptSummaryTool for summarizing outcomes
- Rulesets: The agent’s behaviour is ruled by 4 rulesets:
- Place: Specifies the function as “Lead Actual Property Analyst”.
- Goal: Direct the agent to find actual property developments round Delhi NCR.
- Background: Defines the agent’s background in actual property, with experience in recognizing traits and offering insights.
- Desired Final result: Requests the agent to provide a complete evaluation report in a listing format. This setup defines a well-structured digital researcher for actual property evaluation.
Defining the Author Agent
def build_writer(function: str, aim: str, backstory: str) -> Agent:
"""Builds a Author Construction.
Args:
function: The function of the author.
aim: The aim of the author.
backstory: The backstory of the author.
"""
return Agent(
id=function.decrease().exchange(" ", "_"),
rulesets=[
Ruleset(
name="Position",
rules=[
Rule(
value=role,
)
],
),
Ruleset(
identify="Goal",
guidelines=[
Rule(
value=goal,
)
],
),
Ruleset(
identify="Backstory",
guidelines=[Rule(value=backstory)],
),
Ruleset(
identify="Desired Final result",
guidelines=[
Rule(
value="Full blog post of at least 4 paragraphs",
)
],
),
],
)
The perform `build_writer()` creates an `Agent` object representing a author with customizable attributes primarily based on the offered inputs:
- Arguments:
- function: The author’s function (e.g., “Content material Author”).
- aim: The author’s aim (e.g., “Write an informative article on actual property traits”).
- backstory: The author’s background (e.g., “Skilled journalist with a deal with property information”).
- Agent Setup
- ID: The agent’s ID is generated by changing the function to lowercase and changing areas with underscores (e.g., “content_writer”).
- Rulesets: The agent is outlined by 4 rulesets:
- Place: The author’s function.
- Goal: The author’s aim.
- Backstory: The author’s background story.
- Desired Final result: Specifies the specified output, which is a full weblog publish of no less than 4 paragraphs.
This perform generates a author agent tailor-made to a particular function, goal, and background.
Step 4. Defining Duties
crew = Workflow()
research_task = crew.add_task(
StructureRunTask(
(
"""Carry out an in depth examination of the most recent developments in Actual Property Updates in gurgaon as of 2025.
Pinpoint main traits, new upcoming properties and any projections.""",
),
id="analysis",
structure_run_driver=LocalStructureRunDriver(
create_structure=build_researcher,
),
),
)
writer_tasks = crew.add_tasks(
*[
StructureRunTask(
(
"""Using insights provided, develop an engaging blog
post that highlights the most significant real estate updates of Gurgaon.
Your post should be informative yet accessible, catering to a general audience.
Make it sound cool, avoid complex words.
Insights:
{{ parent_outputs["research"] }}""",
),
structure_run_driver=LocalStructureRunDriver(
create_structure=lambda author=author: build_writer(
function=author["role"],
aim=author["goal"],
backstory=author["backstory"],
)
),
parent_ids=[research_task.id],
)
for author in WRITERS
]
)
end_task = crew.add_task(
PromptTask(
'State "All Performed!"',
parent_ids=[writer_task.id for writer_task in writer_tasks],
)
)
This code defines a workflow involving a number of duties utilizing a `Workflow` object. Right here’s a breakdown of its elements:
- crew = Workflow(): A brand new workflow object `crew` is created to handle and coordinate the sequence of duties.
- Analysis Job:
- research_task = crew.add_task(…): A activity is added to the workflow for researching actual property updates in Gurgaon for 2025.
- StructureRunTask: This activity includes working a construction with an outline to look at actual property traits, pinpoint new properties, and projections.
- LocalStructureRunDriver(create_structure=build_researcher): The `build_researcher` perform is used to create the construction for this activity, making certain the duty is targeted on gathering analysis insights.
- Author Duties:
- writer_tasks = crew.add_tasks(…): A number of author duties are added, one for every author within the `WRITERS` checklist.
- StructureRunTask: Every activity makes use of the insights gathered within the analysis activity to write down a weblog publish about actual property developments in Gurgaon.
- parent_ids=[research_task.id]: These duties rely on the completion of the analysis activity, which gives the required insights for writing.
- structure_run_driver=LocalStructureRunDriver(create_structure=lambda author=author: build_writer(…)): The `build_writer` perform is used to create the writing construction, dynamically utilizing the author’s function, aim, and backstory.
- Finish Job:
- end_task = crew.add_task(PromptTask(…)): A remaining activity is added to the workflow, which is able to output “All Performed!” in any case author duties are accomplished.
- parent_ids=[writer_task.id for writer_task in writer_tasks]: This activity is dependent upon the completion of all author duties.
In abstract, this code units up a multi-step workflow with a analysis activity, a number of writing duties (for various writers), and a remaining activity that marks the completion of the method. Every activity is dependent upon the completion of the earlier one, making certain a sequential and structured execution.
Step 5. Executing the Job
crew.run()
Outputs
Output From Actual Property Researcher Agent
As we are able to see the Actual Property Researcher Agent, it has extracted many key factors, in Checklist Format, Gurgaon Actual Property market. It has recognized upcoming tasks, and developments together with different traits like present traits, purchaser preferences, Progress & Infrastructure and so forth.
Output From Luxurious Blogger Agent
As we are able to see from the output, the Luxurious blogger agent has used the extracted data and crafted it nicely to focus on the posh property particulars of Gurgaon. From utility standpoint, this weblog will be forwarded to all potential consumers on the lookout for shopping for luxurious residences on this automated approach with or with none Human Intervention.
Output From Way of life Freelance Author Agent
As we are able to see from the output, the Freelance Author agent has used the extracted data and crafted it nicely to focus on how the brand new actual property developments can improve the life-style of the folks as nicely. From utility standpoint, this weblog will be forwarded to all potential consumers on the lookout for shopping for actual property on this automated approach with or with none Human Intervention.
Following is one other Python Implementation of executing a Retrieval Augmented Technology System utilizing GripTape. The modular structure of GripTape makes it very simple and seamless to combine an RAG system.
Fingers-On Python Implementation for RAG utilizing GripTape
Step 1. Importing Mandatory Libraries & Defining OpenAI Keys
import requests
from griptape.chunkers import TextChunker
from griptape.drivers import LocalVectorStoreDriver, OpenAiChatPromptDriver, OpenAiEmbeddingDriver
from griptape.engines.rag import RagEngine
from griptape.engines.rag.modules import PromptResponseRagModule, VectorStoreRetrievalRagModule
from griptape.engines.rag.phases import ResponseRagStage, RetrievalRagStage
from griptape.loaders import PdfLoader
from griptape.constructions import Agent
from griptape.instruments import RagTool
from griptape.utils import Chat
import os
os.environ['OPENAI_API_KEY'] = ''
Step 2. Defining Instruments & Engines
#Defining a Namespace
namespace = "Phi4"
response = requests.get("https://arxiv.org/pdf/2412.08905")
#Defining Vector Retailer, Engine, Instrument
vector_store = LocalVectorStoreDriver(embedding_driver=OpenAiEmbeddingDriver())
engine = RagEngine(
retrieval_stage=RetrievalRagStage(
retrieval_modules=[
VectorStoreRetrievalRagModule(
vector_store_driver=vector_store, query_params={"namespace": namespace, "top_n": 20}
)
]
),
response_stage=ResponseRagStage(
response_modules=[PromptResponseRagModule(prompt_driver=OpenAiChatPromptDriver(model="gpt-4o"))]
),
)
rag_tool = RagTool(
description="Incorporates details about the Phi4 mannequin "
"Use it to reply any associated questions.",
rag_engine=engine,
)
Step 3. Loading Information, Chunking and Appending to Vector Retailer
artifacts = PdfLoader().parse(response.content material)
chunks = TextChunker().chunk(artifacts)
vector_store.upsert_text_artifacts({namespace: chunks})
Step 4. Loading Information, Chunking and Appending to Vector Retailer
agent = Agent(instruments=[rag_tool])
agent.run("What's the publish coaching methodology in Phi 4?")
Output
As we are able to see from the above output, it has appropriately retrieved all of the post-training strategies talked about within the Phi 4 paper like Pivotal Token Search, Choose Guided DPO amongst others.
Additionally, from the code perspective, it may be seen how in a only a few strains, we may arrange this RAG engine owing to the modular format of GripTape. This is among the highlights of GripTape that units it other than the opposite frameworks
Conclusion
GripTape’s modular structure and core elements present a strong basis for creating versatile and scalable AI functions. With options like superior reminiscence administration, customizable instruments, and integration capabilities, it provides vital benefits for builders trying to construct refined workflows. By emphasizing modularity and task-specific elements, GripTape ensures a excessive degree of customization and effectivity, setting it other than different frameworks within the AI improvement panorama.
Key Takeaways
- GripTape has a modular framework. Builders can construct scalable AI apps. They mix brokers, pipelines, and workflows.
- It provides superior reminiscence administration. Options embrace Dialog Reminiscence, Job Reminiscence, and Meta Reminiscence. These handle context and delicate information. They stop token overflow.
- GripTape gives customizable instruments. It has built-in instruments and helps customized ones. This improves LLM interactions with exterior information.
- It consists of an environment friendly RAG Engine. It retrieves exterior data. This combines with LLM capabilities for correct outputs.
- GripTape helps seamless integration. It really works with drivers like immediate, embedding, and SQL. This adapts to numerous use circumstances.
The media proven on this article shouldn’t be owned by Analytics Vidhya and is used on the Creator’s discretion.
Steadily Requested Questions
A. GripTape’s modular design permits builders to create extremely customizable and versatile workflows by combining distinct elements like brokers, pipelines, and workflows. This structure provides larger flexibility in software improvement in comparison with different frameworks like LangChain.
A. GripTape makes use of superior reminiscence administration options, together with Dialog Reminiscence, Job Reminiscence, and Meta Reminiscence. These capabilities assist retain context throughout interactions, stop token overflow by preserving massive outputs separate, and improve the relevance of interactions by passing extra metadata.
A. GripTape gives a variety of built-in instruments, similar to net scraping, file administration, and immediate summarization instruments. Builders also can simply create customized instruments to fulfill particular wants, making it extremely adaptable for various use circumstances.
A. GripTape’s Off-Immediate™ know-how enhances reminiscence and activity output administration by preserving massive or delicate information separate from the immediate despatched to the language mannequin, stopping token overflow.
A. GripTape consists of numerous drivers for facilitating interactions with exterior sources. These embrace Immediate Drivers for managing textual interactions, Embedding Drivers for producing vector embeddings, SQL Drivers, and Net Search Drivers for integrating exterior information sources.