Call an agent, a workflow, or an MCP server

agency runs an agent in this workspace. workflows.run starts another workflow. mcps calls a server you added under AI Integrations.

Agent and workflow

async ({ agency, workflows }) => {
  const listed = await agency.list()
  const agent = agency.get("sales-researcher")
  const answer = agent ? await agent.run("Find one account to review.") : null
  const flow = await workflows.run("weekly-digest", { from: "runtime" })
  return { listed, answer, flow }
}

agency.get takes the agent slug. workflows.run takes the workflow slug and an input object. workflows.list returns the workflows you can call.

MCP server you added

async ({ mcps }) => {
  const server = mcps.get("crm")
  return await server.request("tools/list", {})
}

The name is the name you saved under AI Integrations (MCP). A missing name means that server is not on this workspace.