Flow skills & tools

Docs › Upgrades & Flow AI

Frappe Flow Skills and Tools

Build Frappe Flow skills, tools, agents and triggers in your custom app: SKILL.md, the @tool decorator, flow_tools, flow_agents and flow_triggers hooks, with examples.

3 min read · Updated November 2026 · By Vivek Choudhary

Frappe Flow skills and tools let a custom app teach Flow how to do your business's work. You write them in your app, register them in hooks.py and run bench migrate; Flow adds them to the site. There are four kinds: skills (written instructions), tools (Python functions an agent can call), agents and triggers. If you only need to use Flow, start with Frappe Flow AI.

Frappe Flow skills: SKILL.md files

A skill is a Markdown file with instructions the built-in agent can follow. Create skills/<name>/SKILL.md in the root of your app. The file starts with front matter that has a name and a description, followed by the instructions. The built-in agent picks it up after migrate.

Example skill (our own illustration, adjust it to your process):

---
name: gst-invoice-check
description: Check a draft Sales Invoice for common GST mistakes before it is submitted.
---
When asked to check a Sales Invoice:
1. Confirm the customer has a GSTIN if the invoice is B2B.
2. Check the place of supply matches the customer's billing state.
3. Check every item has an HSN/SAC code and a tax template.
4. List problems as short bullet points. Do not submit the invoice.

Good skills are short, name the exact DocTypes and fields, and say what the agent must not do.

Tools: Python functions with @tool

A tool is a Python function an agent can call. The model uses its docstring and type hints to decide when to call it, so write them clearly. Import ToolContext and tool from frappe.flow:

from frappe.flow import ToolContext, tool
import frappe

@tool
def overdue_invoices(customer: str, *, ctx: ToolContext) -> list[dict]:
    """List unpaid Sales Invoices past their due date for one customer."""
    return frappe.get_list(
        "Sales Invoice",
        filters={"customer": customer, "docstatus": 1, "outstanding_amount": [">", 0],
                 "due_date": ["<", frappe.utils.today()]},
        fields=["name", "due_date", "outstanding_amount"],
    )

Register it in hooks.py with the dotted path:

flow_tools = ["my_app.ai.overdue_invoices"]
  • @tool(requires_confirmation=True) for tools that change data: Flow asks the user to approve each call.
  • @tool(background=True) for slow tools: each call runs as a background job.
  • Tools run with the chatting user's permissions. Use permission-aware calls such as frappe.get_list, not raw SQL.

Agents

An agent has a name, a model, instructions and a list of tools. The model must be the name of a Flow Model that already exists on the site. Return your agents from a function and register it:

def agents():
    return [collections_agent]

# hooks.py
flow_agents = ["my_app.ai.agents"]

After migrate, users can choose the agent in a chat. A System Manager can disable it or change its model; other settings come from your code. To start an agent from code, call its run(); it returns at once and Flow calls the function named in on_complete when it finishes.

Triggers

A trigger starts an agent automatically. Return a list of Trigger objects and register the function:

def triggers():
    return [Trigger(...)]

# hooks.py
flow_triggers = ["my_app.ai.triggers"]

Each trigger has a title, an agent, either a document event (doctype and doc_event) or a schedule (cron), an optional condition, a prompt and a run_as user. Give that user only the roles the trigger needs.

Checklist before you ship a Flow skill

  1. Test on a staging site with a normal user, not Administrator.
  2. Mark every tool that writes data with requires_confirmation=True.
  3. Keep tool results small: return only the fields the agent needs.
  4. Check the Flow Run log for each test to see which tools were called.
  5. Pin your app to a v16.60+ branch; Flow's APIs are new and may change between releases.

Flow is alpha/beta, so check the official Extending Flow page in the sources for the latest class names and arguments. Need a Flow skill built for your ERPNext? Talk to our Frappe developers.

Sources

Written from the official documentation and source code below. Menus and fields can differ between versions, so check the docs for your version.

Planning ERPNext or a Frappe app for your business? See our ERPNext implementation and Frappe development services, or talk to us.
ERPWork app icon
ERPWork: ERPNext on your phoneFree Android app for your ERPNext site: check in with location, approve documents, see sales and stock dashboards and get notifications.

Get it on Google PlayLearn more →