Skip to main content

Hands-On with Graflow: Run AI Workflows with Local LLMs in Google Colab

· 2 min read
Graflow Team
Graflow Development Team
Share this post:

Want to try Graflow without installing anything? We've published a Google Colab notebook that walks you through building and running agentic workflows — right in your browser, completely free.

Try It Now

Open In Colab

The notebook covers 9 topics with runnable examples — from your first graph to LLM-powered agents:

#TopicWhat You'll Learn
1Your First GraphDefine tasks with @task and wire them with >> — no upfront state schema needed
2Parallel ExecutionFan-out / fan-in patterns using the | operator, plus dynamic task generation with chain() and parallel()
3Data SharingChannel-based inter-task communication with concurrency-safe primitives (atomic_add, append, lock) and TypedChannel
4Branching & LoopsRuntime control flow with next_iteration() for retries and next_task() for dynamic routing
5Error PoliciesParallel group policies — Strict, Best-effort, At-least-N, and Critical
6ExerciseBuild a data analysis pipeline combining everything above
7Checkpoint / ResumeSuspend and resume workflows with checkpoint() and CheckpointManager
8Custom Task HandlersSwappable execution strategies via TaskHandler subclassing
9LLM IntegrationLocal LLMs with LiteLLM + Ollama, and Google ADK agents with tool calling

Local LLMs: Privacy Without Compromise

The notebook includes examples using Gemma 4 (Google's recently released 4.5B-parameter multimodal model with 128K context) and other local models through Ollama. Two integration approaches are demonstrated:

  1. inject_llm_client — Call any LLM directly from a task handler via LiteLLM, which provides a unified API across 100+ providers. Point it at a local Ollama endpoint and no API key is required.

  2. inject_llm_agent — Wrap a Google ADK agent as a Graflow fat node, complete with tool calling and the ReAct pattern.

Running models locally means sensitive data never leaves your environment — no API keys, no external calls, full control over your inference stack. This matters for enterprise workflows where compliance and data sovereignty are non-negotiable. And because Graflow is framework-agnostic, swapping between local and cloud models requires zero changes to your workflow code.

Get Involved

Graflow is Apache 2.0 licensed and open source. We welcome issues and pull requests.