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. 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 when it helps. 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_id`: the lemlist campaign that sends the emails from your mailbox, e.g. cam_123
    - `email_variable`: the custom variable that campaign's email prints as its body, e.g. drafted_email
  3. 4. 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_id` with their approved email in `email_variable`.
  4. 5. Say when it is done

    Under ## Done when, list at least one check that shows the job is finished. Leave out safety rules like asking before sending. Every file adds them at the end automatically.

    workflows/funding-signal-outbound.md
    ## Done when
    
    - Every funded company has a contact, or a note explaining why not.
    - Every approved contact is in the campaign, and the user has a summary table.
  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.