Skip to content

Build your first agent

An agent is an AI assistant in a workspace that people can chat with. It answers questions about the workspace, looks at runs and escalations, and, only if you allow it, proposes changes such as draft edits to automations. This guide is for authors setting one up.

Every agent is backed by an automation. The automation decides how the agent thinks and what it may use; the agent gives it a name, an avatar and a budget. So you build an agent the way you build any automation, then assign it to work.

You need permission to create and publish automations, and an AI provider connection.

In a workspace with no agents yet, the Agents page offers a shortcut: Add workspace assistant asks for an AI provider, a model and a monthly budget, then builds, publishes and assigns an agent that answers questions about Lainstack and can read automations, runs and escalations. It can’t change anything, and you can edit it in the editor like any automation. To build your own, follow the steps below.

  1. Create an automation; see Build your first automation.
  2. Add the Agent work item trigger. It starts a run each time the agent receives work.
  3. Add an AI Agent block and connect the trigger to it.
The smallest agent: every chat message starts a run, and the AI Agent block writes the answer.
An agent automation in the editor, with the Agent work item trigger wired to an AI Agent block.

In the block’s Setup tab:

  • Connection and Model: your AI provider and the model to use.
  • Profile: a starting set of instructions for the kind of agent. Operations is the default; Workspace assistant, Automation reviewer, Escalation triager and Plain are the others.
  • System message: your own instructions, such as what the agent is for and how it should answer.
  • Thinking effort, if the model supports it.
An AI Agent block's Setup tab with its profile, system message, connection and model, and Workspace access and Write access.
  • The Lainstack docs are always open to an agent you chat with, whatever you tick below, so people can ask it how to use the product.
  • Workspace access decides what the agent can read in this workspace: Automations and runs, Escalations and Data Lake. Nothing is ticked by default, so an agent with no area can’t look around the workspace. It still reads the page the person chatting is looking at, and with a block selected only that block’s settings. An agent can’t show a person more than that person may see themselves.
  • Allowed tools adds tools from MCP server connections, for systems outside Lainstack. If a server does not answer, the agent loses that server’s tools for that step, is told they are unavailable, and carries on with the rest.
  • Write access decides whether it can change anything:
Write access What happens
Off (default) The agent can read but never change anything.
Ask Every change is shown to the person in the chat as a card to approve or discard before it happens.
Smart Draft edits to automations happen on their own; anything else, such as publishing, running, deleting or changing what a block may read in the workspace, still asks first.

With Ask or Smart, the agent can also read what it is editing: the automation’s blocks and connections and the available block types. It can also test a draft. With Off it gets none of this.

Change cards say what kind of change it is, such as Access change, Publish or activate or Destructive change, and can be shown on the canvas before you decide.

With Write access set to Ask, the agent can propose a change, but only your Apply makes it.

When a chat agent states something it read, a number can appear after the claim, with a list of sources under the answer. Click a number or a row to see the words it relied on and a link where one exists.

A number means Lainstack checked that the agent really read that source while answering, and that any quote really appears in it. It doesn’t prove the source supports the claim, so check the quote when it matters. An answer can have no sources, and the agent should say what it couldn’t verify.

Sources appear only when the chat reply is the agent’s own plain text. An answer built with Reply text around it, or with declared output fields, has none.

Maximum steps (25 by default, up to 50) stops an agent that goes round in circles. Expense guardrail (USD) stops it before the next model call once its estimated cost reaches the limit. One call can go over it.

  1. Open the trigger’s Samples tab and write a sample in its form: pick Chat, type a message a teammate might send, and click Save sample.
  2. Click Run draft, then Start. The agent’s answer appears on the canvas as a draft, and the run is listed under Runs with the Draft runs filter. The agent’s model and read tools run for real; it gets no write tools.

Try a few messages, including ones it should decline.

Click Publish. If this changes what an AI Agent block may read in the workspace, Publish this access change? lists the change, and you click Publish again to confirm.

Because the automation starts with Agent work item, Lainstack then offers Assign to work:

The Assign to work dialog creating a new persona with a name and monthly budget.
  1. Under Persona, choose Create a new persona.
  2. Enter the Persona name your team will see and a Monthly budget (USD) for its AI spending.
  3. Click Assign to work.

The agent now appears under Agents. A persona works for one automation at a time. If you choose Not now, the offer comes back the next time you publish.

  • Open Agents and start a conversation, or click Open agent chat in the top bar from anywhere in the workspace.
  • From a failed run or step, Ask followed by the agent’s name opens the chat with that failure attached.
  • In the editor, Ask followed by the agent’s name in the top bar attaches the whole automation, and the same button in a block’s settings (or Cmd or Ctrl + I) attaches that block.
  • With the chat closed, each Ask starts a new conversation. With it open, Ask adds to the conversation on screen.
  • Search conversations on the Agents page finds a conversation by its title, what it is attached to, what people wrote, or the agent’s final replies.
A conversation on the Agents page: a person asks which runs are waiting for review, and the workspace assistant answers.

Nothing is sent until you send it. Each agent reply links to the run behind it, and agent runs carry an Agent label under Runs.

On a failure group, Ask asks the agent to find the cause and propose a fix. It can diagnose and test fixes on its own, and needs your approval to resume runs. See Work with the Agent.

Besides chat, an agent can take corrections. In a block’s Correction section, choose Request correction and retry, then add the agent to a Set Assignees block before it. When that block fails on data that can be corrected, the agent gets the work, and a person starts it from Assigned to. See Put a person in the loop. An agent first on a failure group starts by itself: see Decide who owns the work.

The agent’s page shows its avatar and name, which you can change, and Details: its budget, the automation behind it, its authority, and the Workspace access of its published version. To change how it behaves, use Edit automation, change the AI Agent block, test, and publish again.

Last updated: