{"slug": "3-llm-calls-in-1-5s-not-4s-parallel-by-default", "title": "3 LLM Calls in 1.5s, Not 4s — Parallel by Default", "summary": "Pipe, a programming language from the Pipe in 30 Lines series, now runs LLM calls in parallel by default, reducing three sequential DeepSeek API calls from about 4 seconds to 1.5 seconds. The >> operator starts pipeline stages in the background, and futures auto-resolve when used, eliminating the need for asyncio.gather() boilerplate in Python. The feature is demonstrated in examples/parallel_ai_demo.pipe and runs with `export DEEPSEEK_API_KEY=... && pipe -vm -q examples/blog_parallel.pipe`.", "body_md": "[← All posts← Alle Beiträge](../blog.html)\n\n# ⚡ 3 LLM Calls in 1.5s, Not 4s — Parallel by Default\n\n**The >> operator starts pipeline stages in the background. Futures auto-resolve when you use them — no asyncio.gather() boilerplate.**\n\n> **Part of the *Pipe in 30 Lines* series:** [RAG without a vector DB](tutorial-local-rag.html) · [Self-healing code](tutorial-self-healing.html) · [Your first MCP server](tutorial-first-mcp-server.html)\n\nSequential LLM calls add up: three questions, one after another, each waiting its turn. Pipe's `>>`\n\noperator runs each stage concurrently — the future resolves automatically the moment you touch the value.\n\n```\nai_provider \"deepseek\"\n\na: \"Löse 7*8+4 und antworte nur mit der Zahl.\"\n    >> ask\nb: \"Löse 12*12 und antworte nur mit der Zahl.\"\n    >> ask\nc: \"Löse 100/4 und antworte nur mit der Zahl.\"\n    >> ask\n\nt: now\nprint (\"Frage 1: \" ++ a)\nprint (\"Frage 2: \" ++ b)\nprint (\"Frage 3: \" ++ c)\nprint (\"Fertig nach \" ++ (to_str ((now) - t)) ++ \"s\")\n```\n\nWhat happens here:\n\nreplaces`>>`\n\n`>`\n\nand starts the stage in the background — all three`ask`\n\ncalls leave immediately.- The values\n`a`\n\n,`b`\n\n,`c`\n\nare *futures*; they**auto-resolve** when printed or used. No`.await()`\n\n, no thread management. - Timing is real: on a local run all three answers land in ~2 seconds instead of three round trips.\n\nIn Python this is `asyncio.gather()`\n\nplus an async client setup, event loops, and call-site discipline. In Pipe, parallelism is the default shape of the pipeline, not an import.\n\nFor batched workloads, `ai_batch`\n\ngoes further — it fans out hundreds of texts with built-in rate limiting. The full comparison lives in [ examples/parallel_ai_demo.pipe](https://github.com/MachuraHarry/pipe/blob/master/examples/parallel_ai_demo.pipe); the minimal version above runs with\n\n`export DEEPSEEK_API_KEY=... && pipe -vm -q examples/blog_parallel.pipe`\n\n.# ⚡ 3 LLM-Calls in 1,5s statt 4s — Parallel als Standard\n\n**Der >>-Operator startet Pipeline-Stufen im Hintergrund. Futures lösen sich beim Benutzen automatisch auf — kein asyncio.gather()-Boilerplate.**\n\n> **Teil der Serie *Pipe in 30 Lines*:** [RAG ohne Vektor-DB](tutorial-local-rag.html) · [Selbstheilender Code](tutorial-self-healing.html) · [Dein erster MCP-Server](tutorial-first-mcp-server.html)\n\nSequentielle LLM-Calls summieren sich: drei Fragen, eine nach der anderen, jede wartet auf ihren Turn. Pipes `>>`\n\n-Operator startet jede Stufe parallel — das Future löst sich automatisch auf, sobald du den Wert anfasst.\n\n```\nai_provider \"deepseek\"\n\na: \"Löse 7*8+4 und antworte nur mit der Zahl.\"\n    >> ask\nb: \"Löse 12*12 und antworte nur mit der Zahl.\"\n    >> ask\nc: \"Löse 100/4 und antworte nur mit der Zahl.\"\n    >> ask\n\nt: now\nprint (\"Frage 1: \" ++ a)\nprint (\"Frage 2: \" ++ b)\nprint (\"Frage 3: \" ++ c)\nprint (\"Fertig nach \" ++ (to_str ((now) - t)) ++ \"s\")\n```\n\nWas hier passiert:\n\nersetzt`>>`\n\n`>`\n\nund startet die Stufe im Hintergrund — alle drei`ask`\n\n-Calls laufen sofort los.- Die Werte\n`a`\n\n,`b`\n\n,`c`\n\nsind *Futures*; sie**lösen sich automatisch auf**, sobald sie gedruckt oder benutzt werden. Kein`.await()`\n\n, kein Thread-Management. - Das Timing ist real: lokal landen alle drei Antworten in ~2 Sekunden statt drei Roundtrips.\n\nIn Python heißt das `asyncio.gather()`\n\nplus Async-Client-Setup, Event-Loops und Disziplin an jeder Call-Stelle. In Pipe ist Parallelität die Standardform der Pipeline, kein Import.\n\nFür Batch-Workloads geht `ai_batch`\n\nweiter: hunderte Texte mit eingebautem Rate-Limiting. Der komplette Vergleich lebt in [ examples/parallel_ai_demo.pipe](https://github.com/MachuraHarry/pipe/blob/master/examples/parallel_ai_demo.pipe); die Minimalversion oben startest du mit\n\n`export DEEPSEEK_API_KEY=... && pipe -vm -q examples/blog_parallel.pipe`\n\n.", "url": "https://wpnews.pro/news/3-llm-calls-in-1-5s-not-4s-parallel-by-default", "canonical_source": "https://pipe-lang.com/blog/tutorial-parallel.html", "published_at": "2026-08-14 07:41:52.497339+00:00", "updated_at": "2026-08-14 07:41:54.337530+00:00", "lang": "en", "topics": ["developer-tools", "artificial-intelligence", "large-language-models"], "entities": ["Pipe", "DeepSeek", "MachuraHarry"], "alternates": {"html": "https://wpnews.pro/news/3-llm-calls-in-1-5s-not-4s-parallel-by-default", "markdown": "https://wpnews.pro/news/3-llm-calls-in-1-5s-not-4s-parallel-by-default.md", "text": "https://wpnews.pro/news/3-llm-calls-in-1-5s-not-4s-parallel-by-default.txt", "jsonld": "https://wpnews.pro/news/3-llm-calls-in-1-5s-not-4s-parallel-by-default.jsonld"}}