Skip to main content

Tutorial: How to build your first thunk!

Welcome to AI agent automation. Create your first thunk!

Updated over 2 months ago

In this article, you will learn how to build and execute custom thunks.

Step 1: Create an Account

Sign up for Thunk.AI using your Google Workspace or Microsoft 365 account.

During sign-on, grant Thunk.AI access to your drive. This access allows your AI to read and index files to synthesize relevant information for your projects and generate new files or images as needed. For more details, refer to our Privacy Policy.

Complete a few onboarding forms where you tell us a bit about yourself. Your AI agent will work better if it knows who you are, your role, and your company. This information helps it tailor its actions to your needs and behave "intelligently". It’s not sold or used for ads, just to personalize your experience on the platform.

We recommend that you go to your account page , use the Connections tab to find the Google/Microsoft connection used to sign in, and extend the permissions to allow your AI agents more permissions to access your cloud file system. Many useful scenarios need the ability to read cloud files provides as links, and/or write to them. This is not absolutely essential for use of the platform, but since a lot of business work is associated with files, most users find that this extra permission adds significant value.


Step 2: Understand Key Concepts

  • The Thunk.AI mental model centers around "thunks," AI-native workflows that represent a business process. Thunks are first designed and then executed.

  • Each thunk describes a workflow with steps. Thunk owners provide workflow logic in natural language at design-time.

  • Every user who designs or participates in a thunk is paired with an AI agent that assists them in the design and execution of work in a thunk. AI agents leverage LLMs (e.g., GPT-4) to automate tasks and perform meaningful application work within a thunk.

  • The runtime environment of Thunk.AI runs each AI agent within a control sandbox to tightly control, constrain, and guide the execution towards reliable outcomes.

Those are the basic concepts. There are a few additional concepts you may also find useful.

  • Thunks can optionally define and utilize Content Folders, including documents and images, to provide the AI agents with relevant information for tasks.

  • AI tools, organized into tool libraries, can extend an agent's capabilities, enabling actions like web search, database update, or file management.

  • Thunks can receive new requests not just from UI, but also from emails, form submissions, or events from external applications.

  • During execution, the platform can enforce security, compliance with policies, and implement different levels of "human-in-the-loop" interactions with human agents as appropriate for the particular workflow process.

Because Thunk.AI is hosted on a scalable platform, you and your team can build, test, and run many different thunks to bring AI automation to diverse business processes. Read this article for details on the concepts mentioned above.


Step 3: Browse Sample Thunks

After you sign in, you'll find a collection of live, intelligent AI applications across various industries—these aren’t just templates; they’re fully functional sample thunks.

For example, in the Expense Receipt Processing sample, your AI extracts receipt details, checks them against company policy, recommends a decision, and drafts an email—automating the entire process. Watch this video to explore the Thunk and learn how to build one yourself!

You can copy any sample to make it your own, add or remove steps, alter step instructions, add your own documents and try it out on your data. Your AI will help process your data through the sample thunk’s plan.


Step 4: Build your first, custom Thunk

We will use this sample thunk "Processing purchase orders" as a running example in this tutorial.

Thunks are first designed and then executed. In this section we will cover how to:

  1. Design your thunk with AI-driven planning

  2. Execute your thunk

  3. Customize and refine your thunk

4.1 Design your thunk with AI-Driven Planning

To start designing your thunk, you'll need to answer a few simple questions about your desired workflow. Click on the Create a New Workflow button on the thunk homepage.

  • What is the goal?: Define a concise description for your workflow (eg: "Process purchase orders."). Aim for less than 7 words, usually a verb followed by a noun.

  • What is the workflow input? This is usually a short descriptive noun from the particular domain of the business workflow (eg: "Purchase Order"). The platform will prompt you with a suggestion which you can, of course, edit. Aim for semantic names here (eg: these names are good --- "Job Applicant", "Purchase Order", "Sales Lead", "Payment Transaction") rather than some low-level implementation term (eg: these names are not optimal -- "database row", "spreadsheet row", "data file", "email message", etc). Remember that the AI agent usually does better the more it is able to deduce the semantic meaning of what it is supposed to do. You can also provide examples of inputs. Especially when dealing with files and images, this can be extremely useful to help the AI planning process. You can also provide details about the inputs (eg: "Each purchase order will include product details, quantities, and payment information.").

  • What is the workflow process?: Outline your process as a list of steps, as you would explain it to a co-worker. The platform will provide an initial process suggestion, but almost always, you'd want to customize this to reflect your specific business process. For example: "(1) Extract and validate the order details, (2) ensure payment terms are acceptable, and (3) forward the confirmed order to the fulfillment team.". You also have the opportunity to provide any other information about the process.

Your AI will now take a minute or so to navigate you through (i) plan outline generation (ii) workflow state generation and (iii) plan details generation.

(i) Plan generation: Your AI uses information you provided to create a workflow with sequential steps.


(ii) Data Structure Identification: Your AI determines the important data to record during execution—e.g., invoices, payment amounts, approvals for invoice processing.

(iii) Plan Details: Finally, your AI planning agent refines the Plan Details to prepare the AI agents for execution.

At this crucial stage of planning, it is useful to look at the AI Instructions associated with each step and modify them as appropriate. AI Instructions include at least the following components: (a) Guidance for the AI Agent -- this includes instructions and examples, and (b) Definition of the Control Sandbox -- this includes constraints on input and output data, constraints on AI tools, and consistency check definitions. You do not need to get all of this perfect initially, but as you test your prototype, you will probably come back to change these components of your thunk.

Pro Tip: Detailed instructions and control sandbox constraints ensure consistent execution and reliable results. Learn more about how Thunk.AI ensures reliable agent behavior.

Hit the "Proceed" button to tell your AI agent to complete its planning work, and that's it! Your thunk is live and ready to execute!

4.2 Execute your thunk

Your thunk is now ready to accept workflow requests. As requests arrive, your AI will process them step by step, following your instructions. After each step, you can review outputs, adjust data, update instructions, and rerun the work if needed. Let’s dive into the details!

Add a workflow request

To begin, click on the Add button to create a new workflow request. This brings up a dialog that shows you a chat window with your AI agent. That gives you the flexibility to add multiple rows (eg: "open this spreadsheet https:.... and import each row as a workflow request"). All the same, the simplest way to start is to use the "Add using a form" option and that lets you add a single request.


Later, you can explore the various input options (like the email inbox or webhook endpoint that every thunk has). These are potentially more efficient and automated mechanisms to bring requests into a thunk.

When a request is added, a new workflow entry is created and the Thunk.AI runtime begins working on it following the defined workflow orchestration.

Pro Tip: New thunks are optimized for quick onboarding. By default, when new entries are added, they are processed immediately (instead of starting in a "draft" mode waiting for you to kick off the work) and move through each step without waiting for approval. You can adjust these settings under AI Governance > Human-in-the-Loop to enable more control.


Workflow Execution

The workflow orchestration logic in the platform kicks off each step in sequence and sets up the appropriate AI agent to run it.


Most likely, at this stage of early prototyping, you do not have any collaborators or human agents participating in this thunk. So every step will be assigned to you. However, be aware that if there were more users with access to the thunk, you can set up assignment logic that your AI agent will use to assign the step to an appropriate user. Learn how to add users and define assignment logic.

Step Execution

When a step is assigned to you, you will be able to observe your AI agent execute the step on your behalf. Your AI agent follows the instructions laid out for the step, relies on the inputs provided, utilizes tools available to it, does the work and records results in the appropriate result data properties. You do not need to be signed in or watching this happen. However, both in real time or after the fact, you can examine a log of the interaction between the control sandbox and the AI agent in doing the task and completing the work. If you human-in-the-loop intervention is needed, the platform or the AI agent itself will request your intervention with appropriate context.

Monitor & Review AI Work

The collapsible/expandable AI pane on the right shows you the working of your AI agent. You can track it in real-time or review it after the fact. Of course, the results of each step are stored in workflow state properties, that are persistent, easily visible to you and other users of the thunk, and these properties become inputs into subsequent workflow steps.


Step 5: Congratulations!

🎉

There's so many more thunks you can build and workflows you can automate with AI agents. Happy thunking! Please reach out to us via https://community.thunk.ai or [email protected] if you have questions or need assistance in building your thunks.

Did this answer your question?