• bitcoinBitcoin(BTC)$84,132.000.22%
  • ethereumEthereum(ETH)$2,691.240.02%
  • tetherTether(USDT)$1.000.00%
  • binancecoinBNB(BNB)$774.20-0.18%
  • rippleXRP(XRP)$1.55-1.68%
  • usd-coinUSDC(USDC)$1.00-0.01%
  • solanaSolana(SOL)$121.710.88%
  • tronTRON(TRX)$0.3366140.07%
  • zcashZcash(ZEC)$1,553.340.28%
  • Figure HelocFigure Heloc(FIGR_HELOC)$1.02-0.38%
  • HyperliquidHyperliquid(HYPE)$92.431.51%
  • dogecoinDogecoin(DOGE)$0.0984190.59%
  • chainlinkChainlink(LINK)$14.242.82%
  • moneroMonero(XMR)$554.93-0.11%
  • whitebitWhiteBIT Coin(WBT)$83.970.17%
  • USDSUSDS(USDS)$1.000.01%
  • cardanoCardano(ADA)$0.2590511.62%
  • RainRain(RAIN)$0.0127917.95%
  • leo-tokenLEO Token(LEO)$8.981.76%
  • stellarStellar(XLM)$0.2197480.65%
  • bitcoin-cashBitcoin Cash(BCH)$335.800.40%
  • nearNEAR Protocol(NEAR)$4.85-6.31%
  • uniswapUniswap(UNI)$9.681.18%
  • litecoinLitecoin(LTC)$72.994.61%
  • CantonCanton(CC)$0.13922912.26%
  • Ethena USDeEthena USDe(USDE)$1.00-0.02%
  • avalanche-2Avalanche(AVAX)$10.975.38%
  • suiSui(SUI)$1.186.31%
  • daiDai(DAI)$1.000.00%
  • USD1USD1(USD1)$1.000.00%
  • the-open-networkGram (prev. Toncoin)(GRAM)$1.484.41%
  • hedera-hashgraphHedera(HBAR)$0.0950061.40%
  • BittensorBittensor(TAO)$335.3910.21%
  • shiba-inuShiba Inu(SHIB)$0.0000062.98%
  • crypto-com-chainCronos(CRO)$0.0660170.07%
  • Global DollarGlobal Dollar(USDG)$1.000.00%
  • BitwayBitway(BTW)$1.06-14.70%
  • MemeCoreMemeCore(M)$1.223.89%
  • EthenaEthena(ENA)$0.2746917.15%
  • paypal-usdPayPal USD(PYUSD)$1.00-0.01%
  • tether-goldTether Gold(XAUT)$4,279.61-0.24%
  • OndoOndo(ONDO)$0.552.36%
  • okbOKB(OKB)$122.001.54%
  • Ripple USDRipple USD(RLUSD)$1.00-0.01%
  • Circle USYCCircle USYC(USYC)$1.140.00%
  • aaveAave(AAVE)$154.563.39%
  • mantleMantle(MNT)$0.705.91%
  • BlackRock USD Institutional Digital Liquidity FundBlackRock USD Institutional Digital Liquidity Fund(BUIDL)$1.000.00%
  • Ondo US Dollar YieldOndo US Dollar Yield(USDY)$1.15-0.11%
  • polkadotPolkadot(DOT)$1.288.20%
TradePoint.io
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop
No Result
View All Result
TradePoint.io
No Result
View All Result

An Implementation Guide to Design Intelligent Parallel Workflows in Parsl for Multi-Tool AI Agent Execution

August 15, 2025
in AI & Technology
Reading Time: 6 mins read
A A
An Implementation Guide to Design Intelligent Parallel Workflows in Parsl for Multi-Tool AI Agent Execution
ShareShareShareShareShare

In this tutorial, we implement an AI agent pipeline using Parsl, leveraging its parallel execution capabilities to run multiple computational tasks as independent Python apps. We configure a local ThreadPoolExecutor for concurrency, define specialized tools such as Fibonacci computation, prime counting, keyword extraction, and simulated API calls, and coordinate them through a lightweight planner that maps a user goal to task invocations. The outputs from all tasks are aggregated and passed through a Hugging Face text-generation model to produce a coherent, human-readable summary. Check out the FULL CODES here.

!pip install -q parsl transformers accelerate


import math, json, time, random
from typing import List, Dict, Any
import parsl
from parsl.config import Config
from parsl.executors import ThreadPoolExecutor
from parsl import python_app


parsl.load(Config(executors=[ThreadPoolExecutor(label="local", max_threads=8)]))

We begin by installing the required libraries & importing all necessary modules for our workflow. We then configure Parsl with a local ThreadPoolExecutor to run tasks concurrently and load this configuration so we can execute our Python apps in parallel. Check out the FULL CODES here.

YOU MAY ALSO LIKE

This App Lets You Use An Apple Watch With An Android Phone

These Xbox Players Got GTA 6 For Free The Hard Way

@python_app
def calc_fibonacci(n: int) -> Dict[str, Any]:
   def fib(k):
       a, b = 0, 1
       for _ in range(k): a, b = b, a + b
       return a
   t0 = time.time(); val = fib(n); dt = time.time() - t0
   return {"task": "fibonacci", "n": n, "value": val, "secs": round(dt, 4)}


@python_app
def extract_keywords(text: str, k: int = 8) -> Dict[str, Any]:
   import re, collections
   words = [w.lower() for w in re.findall(r"[a-zA-Z][a-zA-Z0-9\-]+", text)]
   stop = set("the a an and or to of is are was were be been in on for with as by from at this that it its if then else not no".split())
   cand = [w for w in words if w not in stop and len(w) > 3]
   freq = collections.Counter(cand)
   scored = sorted(freq.items(), key=lambda x: (x[1], len(x[0])), reverse=True)[:k]
   return {"task":"keywords","keywords":[w for w,_ in scored]}


@python_app
def simulate_tool(name: str, payload: Dict[str, Any]) -> Dict[str, Any]:
   time.sleep(0.3 + random.random()*0.5)
   return {"task": name, "payload": payload, "status": "ok", "timestamp": time.time()}

We define four Parsl @python_app functions that run asynchronously as part of our agent’s workflow. We create a Fibonacci calculator, a prime-counting routine, a keyword extractor for text processing, and a simulated tool that mimics external API calls with randomized delays. These modular apps let us perform diverse computations in parallel, forming the building blocks for our multi-tool AI agent. Check out the FULL CODES here.

def tiny_llm_summary(bullets: List[str]) -> str:
   from transformers import pipeline
   gen = pipeline("text-generation", model="sshleifer/tiny-gpt2")
   prompt = "Summarize these agent results clearly:\n- " + "\n- ".join(bullets) + "\nConclusion:"
   out = gen(prompt, max_length=160, do_sample=False)[0]["generated_text"]
   return out.split("Conclusion:", 1)[-1].strip()

We implement a tiny_llm_summary function that uses Hugging Face’s pipeline with the lightweight sshleifer/tiny-gpt2 model to generate concise summaries of our agent’s results. It formats the collected task outputs as bullet points, appends a “Conclusion:” cue, and extracts only the final generated conclusion for a clean, human-readable summary. Check out the FULL CODES here.

def plan(user_goal: str) -> List[Dict[str, Any]]:
   intents = []
   if "fibonacci" in user_goal.lower():
       intents.append({"tool":"calc_fibonacci", "args":{"n":35}})
   if "primes" in user_goal.lower():
       intents.append({"tool":"count_primes", "args":{"limit":100_000}})
   intents += [
       {"tool":"simulate_tool", "args":{"name":"vector_db_search","payload":{"q":user_goal}}},
       {"tool":"simulate_tool", "args":{"name":"metrics_fetch","payload":{"kpi":"latency_ms"}}},
       {"tool":"extract_keywords", "args":{"text":user_goal}}
   ]
   return intents

We define the plan function to map a user’s goal into a structured list of tool invocations. It checks the goal text for keywords like “fibonacci” or “primes” to trigger specific computational tasks, then adds default actions such as simulated API queries, metrics retrieval, and keyword extraction, forming the execution blueprint for our AI agent. Check out the FULL CODES here.

def run_agent(user_goal: str) -> Dict[str, Any]:
   tasks = plan(user_goal)
   futures = []
   for t in tasks:
       if t["tool"]=="calc_fibonacci": futures.append(calc_fibonacci(**t["args"]))
       elif t["tool"]=="count_primes": futures.append(count_primes(**t["args"]))
       elif t["tool"]=="extract_keywords": futures.append(extract_keywords(**t["args"]))
       elif t["tool"]=="simulate_tool": futures.append(simulate_tool(**t["args"]))
   raw = [f.result() for f in futures]


   bullets = []
   for r in raw:
       if r["task"]=="fibonacci":
           bullets.append(f"Fibonacci({r['n']}) = {r['value']} computed in {r['secs']}s.")
       elif r["task"]=="count_primes":
           bullets.append(f"{r['count']} primes found ≤ {r['limit']}.")
       elif r["task"]=="keywords":
           bullets.append("Top keywords: " + ", ".join(r["keywords"]))
       else:
           bullets.append(f"Tool {r['task']} responded with status={r['status']}.")


   narrative = tiny_llm_summary(bullets)
   return {"goal": user_goal, "bullets": bullets, "summary": narrative, "raw": raw}

In the run_agent function, we execute the full agent workflow by first generating a task plan from the user’s goal, then dispatching each tool as a Parsl app to run in parallel. Once all futures are complete, we convert their results into clear bullet points and feed them to our tiny_llm_summary function to create a concise narrative. The function returns a structured dictionary containing the original goal, detailed bullet points, the LLM-generated summary, and the raw tool outputs. Check out the FULL CODES here.

if __name__ == "__main__":
   goal = ("Analyze fibonacci(35) performance, count primes under 100k, "
           "and prepare a concise executive summary highlighting insights for planning.")
   result = run_agent(goal)
   print("\n=== Agent Bullets ===")
   for b in result["bullets"]: print("•", b)
   print("\n=== LLM Summary ===\n", result["summary"])
   print("\n=== Raw JSON ===\n", json.dumps(result["raw"], indent=2)[:800], "...")

In the main execution block, we define a sample goal that combines numeric computation, prime counting, and summary generation. We run the agent on this goal, print the generated bullet points, display the LLM-crafted summary, and preview the raw JSON output to verify both the human-readable and structured results.

In conclusion, this implementation demonstrates how Parsl’s asynchronous app model can efficiently orchestrate diverse workloads in parallel, enabling an AI agent to combine numerical analysis, text processing, and simulated external services in a unified pipeline. By integrating a small LLM at the final stage, we transform structured results into natural language, illustrating how parallel computation and AI models can be combined to create responsive, extensible agents suitable for real-time or large-scale tasks.


Check out the FULL CODES here. Feel free to check out our GitHub Page for Tutorials, Codes and Notebooks. Also, feel free to follow us on Twitter and don’t forget to join our 100k+ ML SubReddit and Subscribe to our Newsletter.


Asif Razzaq is the CEO of Marktechpost Media Inc.. As a visionary entrepreneur and engineer, Asif is committed to harnessing the potential of Artificial Intelligence for social good. His most recent endeavor is the launch of an Artificial Intelligence Media Platform, Marktechpost, which stands out for its in-depth coverage of machine learning and deep learning news that is both technically sound and easily understandable by a wide audience. The platform boasts of over 2 million monthly views, illustrating its popularity among audiences.

Credit: Source link

ShareTweetSendSharePin

Related Posts

This App Lets You Use An Apple Watch With An Android Phone
AI & Technology

This App Lets You Use An Apple Watch With An Android Phone

September 26, 2026
These Xbox Players Got GTA 6 For Free The Hard Way
AI & Technology

These Xbox Players Got GTA 6 For Free The Hard Way

September 26, 2026
Exa Launches Agent Ultra: A Subagent Swarm Deep Research API Built for Exhaustive List Building
AI & Technology

Exa Launches Agent Ultra: A Subagent Swarm Deep Research API Built for Exhaustive List Building

September 26, 2026
End-to-End Multimodal Data Augmentation and Adversarial Robustness Benchmark with AugLy for Images, Text, Audio, and PyTorch
AI & Technology

End-to-End Multimodal Data Augmentation and Adversarial Robustness Benchmark with AugLy for Images, Text, Audio, and PyTorch

September 26, 2026
Next Post
Tarantulas hit the road for mating season

Tarantulas hit the road for mating season

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Search

No Result
View All Result
Bain Capital Ventures Bets .6 Billion on AI’s Next Act

Bain Capital Ventures Bets $1.6 Billion on AI’s Next Act

September 20, 2026
Bodycam video released from arrest of 49ers owner in prostitution sting

Bodycam video released from arrest of 49ers owner in prostitution sting

September 23, 2026
ANY Screen AI can DO THIS!

ANY Screen AI can DO THIS!

September 25, 2026

About

Learn more

Our Services

Legal

Privacy Policy

Terms of Use

Bloggers

Learn more

Article Links

Contact

Advertise

Ask us anything

©2020- TradePoint.io - All rights reserved!

Tradepoint.io, being just a publishing and technology platform, is not a registered broker-dealer or investment adviser. So we do not provide investment advice. Rather, brokerage services are provided to clients of Tradepoint.io by independent SEC-registered broker-dealers and members of FINRA/SIPC. Every form of investing carries some risk and past performance is not a guarantee of future results. “Tradepoint.io“, “Instant Investing” and “My Trading Tools” are registered trademarks of Apperbuild, LLC.

This website is operated by Apperbuild, LLC. We have no link to any brokerage firm and we do not provide investment advice. Every information and resource we provide is solely for the education of our readers. © 2020 Apperbuild, LLC. All rights reserved.

No Result
View All Result
  • Main
  • AI & Technology
  • Stock Charts
  • Market & News
  • Business
  • Finance Tips
  • Trade Tube
  • Blog
  • Shop

© 2023 - TradePoint.io - All Rights Reserved!