218

Add a workflow

Turn a play your team already runs into one file any agent can follow.

View on GitHub

A workflow is up to ten steps that reach one result. Each step either uses a published tool or is something the agent does itself, like writing a draft.

Note. If a step calls a service, it must link a published tool. Otherwise the check rejects the file.

How to create

  1. 1. Create the file

    Add one file to workflows/. The folder has no subfolders. The file name becomes the workflow’s key and URL. To rename it later, list the old name under aliases so the old URL still works.

    workflows/
    funding-signal-outbound.md
    at-risk-customer-rescue.md
    competitor-intent.md
  2. 3. Say what the user gets

    Start the body with ## Outcome: one to four things the user has when the run ends, like a table, drafts, records or sent messages. Write them in plain words, not input names: people read them to decide, and the agent treats them as the checks that mean it is done. Name only what the steps produce, never a promise like replies or meetings. Leave out safety rules like asking before sending: every file adds them at the end.

    workflows/funding-signal-outbound.md
    ## Outcome
    
    - A table of every funded company with its buyer and their work email, or a note on why there is none.
    - An approved three-sentence email for each buyer, queued in your lemlist campaign.
  3. 4. List what the agent must ask for

    Under ## Inputs, write one line per input: its name in snake_case and backticks, a colon, then what it is. Add “, e.g.” and an example. Ask for what the user knows, like a campaign’s name, when the agent can look up the id. If something must be set up once first, like a campaign template or a CRM property, say so. Steps refer to an input by the same name in backticks, never as {{templates}}.

    workflows/funding-signal-outbound.md
    ## Inputs
    
    - `target_segment`: the kind of company to watch, e.g. Series A B2B SaaS in the US
    - `funding_window`: how fresh the round must be, e.g. 30 days
    - `max_companies`: the most companies to pull, since each costs a credit, e.g. 50
    - `buyer_titles`: the roles to reach, most senior first, e.g. VP Marketing, Head of Growth
    - `offer`: what you sell, in one line, e.g. outbound email that books meetings
    - `campaign`: the lemlist campaign that sends the emails from your mailbox, by name, e.g. Funding outreach
    - `email_variable`: the custom variable the campaign's email prints as its whole body, set up once in lemlist, e.g. drafted_email
  4. 5. Write the steps

    Under ## Steps, write a numbered list of one to ten steps. Each step starts with a bold title, then “with” and the tool it uses, linked to ../companies/<handle>/tools/<name>.md, then a full stop and what to do. A step the agent does itself, like writing a draft, has no link. If a later step needs a result, end the step with “Keep …”. Say what to do, not how the tool works. The tool’s own file covers setup.

    workflows/funding-signal-outbound.md
    ## Steps
    
    1. **Find funded companies** with [people-data-labs/search-companies](../companies/people-data-labs/tools/search-companies.md). List up to `max_companies` companies matching `target_segment` whose `last_funding_date` falls within `funding_window`. Keep name, website, latest round and date.
    2. **Find the buyer** with [apollo/search-people](../companies/apollo/tools/search-people.md). For each company's domain, find people with `buyer_titles` and keep the most senior, with their Apollo id; note the companies with no match.
    3. **Get their emails** with [apollo/bulk-enrich-people](../companies/apollo/tools/bulk-enrich-people.md). Enrich each buyer, up to 10 per call. Keep their name, title and work email.
    4. **Write emails**. Draft a three-sentence plain-text email per contact: congratulate the round, connect it to `offer`, ask one question. Show the drafts to the user.
    5. **Send** with [lemlist/add-lead-to-campaign](../companies/lemlist/tools/add-lead-to-campaign.md). After the user approves, add each contact to `campaign` with their approved email in `email_variable`.
  5. 6. Check it locally

    Run one command to check everything. It reads every file, checks every link and builds the pages, then lists every problem at once with the file (and line) that caused it. The same check runs again on your pull request.

    Terminal
    pnpm install
    pnpm content:check
    pnpm dev   # then open /workflows/funding-signal-outbound
  6. 7. Open a pull request

    Send one company, tool or workflow per pull request. Say what you added and how you checked the facts. Reviewers check the facts, and the build handles formatting.