How to design a complete agentic pipeline using the griptepe workflow, folding face models, and modular workflow

In this tutorial, we build a complete, API-free eventic storytelling system that uses Gloves and lightweight face model. We walk through building an agent with the skills to use the tool, generate a fictional world, design characters, and implement a high-level workflow that produces a story with a coherent narrative. By breaking down the implementation of dynamic snippets, we can better understand each component as it comes together into a future creative pipeline. Look Full codes here.
!pip install -q "griptape[drivers-prompt-huggingface-pipeline]" "transformers" "accelerate" "sentencepiece"
import textwrap
from griptape.structures import Workflow, Agent
from griptape.tasks import PromptTask
from griptape.tools import CalculatorTool
from griptape.rules import Rule, Ruleset
from griptape.drivers.prompt.huggingface_pipeline import HuggingFacePipelinePromptDriver
local_driver = HuggingFacePipelinePromptDriver(
model="TinyLlama/TinyLlama-1.1B-Chat-v1.0",
max_tokens=256,
)
def show(title, content):
print(f"n{'='*20} {title} {'='*20}")
print(textwrap.fill(str(content), width=100))
We set up our environment by applying griptepe and start sealing the surface of the area. We configure the Assistant function to show clean results, allowing us to track each step of the workflow. As we build the foundation, we ensure that everything runs locally without relying on external APIs. Look Full codes here.
math_agent = Agent(
prompt_driver=local_driver,
tools=[CalculatorTool()],
)
math_response = math_agent.run(
"Compute (37*19)/7 and explain the steps briefly."
)
show("Agent + CalculatorTool", math_response.output.value)
We create an agent equipped with a calculation tool and test it with a simple mathematical appendix. We see how the agent is submitted to be compiled by the tool and put a natural language description. By using this, we ensure that our local driver and integration tools work properly. Look Full codes here.
world_task = PromptTask(
input="Create a vivid fictional world using these cues: {{ args[0] }}.nDescribe geography, culture, and conflicts in 3–5 paragraphs.",
id="world",
prompt_driver=local_driver,
)
def character_task(task_id, name):
return PromptTask(
input=(
"Based on the world below, invent a detailed character named {{ name }}.n"
"World description:n{{ parent_outputs['world'] }}nn"
"Describe their background, desires, flaws, and one secret."
),
id=task_id,
parent_ids=["world"],
prompt_driver=local_driver,
context={"name": name},
)
scotty_task = character_task("scotty", "Scotty")
annie_task = character_task("annie", "Annie")
We are creating jobs for the entire country and we are building the capacity for generation-to-generation jobs that depend on global output. We define a recursive function to perform conditional character operations in a shared environment. As we combine these components, we can see how the workflow begins to structure itself with dependencies. Look Full codes here.
style_ruleset = Ruleset(
name="StoryStyle",
rules=[
Rule("Write in a cinematic, emotionally engaging style."),
Rule("Avoid explicit gore or graphic violence."),
Rule("Keep the story between 400 and 700 words."),
],
)
story_task = PromptTask(
input=(
"Write a complete short story using the following elements.nn"
"World:n{{ parent_outputs['world'] }}nn"
"Character 1 (Scotty):n{{ parent_outputs['scotty'] }}nn"
"Character 2 (Annie):n{{ parent_outputs['annie'] }}nn"
"The story must have a clear beginning, middle, and end, with a meaningful character decision near the climax."
),
id="story",
parent_ids=["world", "scotty", "annie"],
prompt_driver=local_driver,
rulesets=[style_ruleset],
)
story_workflow = Workflow(tasks=[world_task, scotty_task, annie_task, story_task])
topic = "tidally locked ocean world with floating cities powered by storms"
story_workflow.run(topic)
We introduce stylistic rules and create a final story work that integrates the world and the characters into a cohesive narrative. We then combine all the tasks in the workflow and apply them to the selected topic. This time, we're witnessing how griptapes shake up creative pipelines. Look Full codes here.
world_text = world_task.output.value
scotty_text = scotty_task.output.value
annie_text = annie_task.output.value
story_text = story_task.output.value
show("Generated World", world_text)
show("Character: Scotty", scotty_text)
show("Character: Annie", annie_text)
show("Final Story", story_text)
def summarize_story(text):
paragraphs = [p for p in text.split("n") if p.strip()]
length = len(text.split())
structure_score = min(len(paragraphs), 10)
return {
"word_count": length,
"paragraphs": len(paragraphs),
"structure_score_0_to_10": structure_score,
}
metrics = summarize_story(story_text)
show("Story Metrics", metrics)
We're bringing back all the effects that were done and showing the world, the characters, and the final story. We also use simple metrics to check structure and length, giving us a snapshot for quick analysis. As we wrap up, we see that the full workflow produces measurable, dynamic results.
In conclusion, we show how we can easily reorganize the complex steps of consultation, tool interaction, and creative generation using spatial models within the GripTrape framework. We feel that it is the functions of the model, the rules, and the emergence of the work that come together in a powerful agentic system that is able to produce systematic narrative results. By using everything without external APIs, we gain full control, reproducibility, and flexibility, opening the door to advanced testing in local agent pipelines, automating authoring systems, and decorating many jobs.
Look Full codes here. Feel free to take a look at ours GitHub page for tutorials, code and notebooks. Also, feel free to follow us Kind of stubborn and don't forget to join ours 100K + ML Subreddit and sign up Our newsletter. Wait! Do you telegraph? Now you can join us by telegraph.
AsifAzzaq is the CEO of MarktechPost Media Inc.. as a visionary entrepreneur and developer, Asifi is committed to harnessing the power of social intelligence for good. His latest effort is the launch of a media intelligence platform, MarktechPpost, which stands out for its deep understanding of machine learning and deep learning stories that are technically sound and easily understood by a wide audience. The platform sticks to more than two million monthly views, which shows its popularity among the audience.




