Building agents in OneAgentStudio
Audience: agent builders who know the Studio screen (see Studio basics) and want to build real agents: adding steps, filling in settings, working with variables, conditions, loops and error handling.
Contents
- Add steps
- Select, move and arrange steps
- The Action settings panel
- Variables
- Values,
$variablesand${...}text - Calculations (expressions)
- Conditions: the If builder
- Loops
- Error handling
- Step groups, notes and comments
- Disable steps
- Copy, paste and the shared clipboard
- Find and replace, undo and redo
- A worked example
- If it goes wrong
- Related guides
1. Add steps
There are four ways to add an action as a step. Pick whichever suits you.

Click it.
- Open the Actions panel (rail button with four squares).
- Find the action: open its group, or type in Search actions.
- Click the action (or press Enter on it).
It goes where the canvas hint says:
| What is selected | Where the new step goes |
|---|---|
| Nothing | At the end |
| Start | First (step 1) |
| End | At the end |
| A step | Right after it |
| A section of a block (click Then, Repeat, Try …) | At the end of that section, which is highlighted |
Drag it. Drag the action from the Actions panel onto the canvas.
- Drop it on the gap between two steps, on Start or End, or on a section heading.
- Drop it on a step card: the top half puts it before that step, the bottom half after it. On an open block (If, Loop, Try) the bottom half puts it inside, at the start of the first section. A line on the card shows where it will land.
- Near the top or bottom edge of the canvas, the canvas scrolls by itself.
Adding from the search. Type a few words in Search actions at the top of the Actions panel and press Enter: the best match is added after the selected step (or at the end when nothing is selected).
Record or capture. Record, Capture and Capture desktop add steps for what you do on screen (see Web and desktop automation). The Assistant can also propose steps from a description (see AI in agents).
What you see: the toast "Added
Tip: Catch and Finally appear in the Actions panel next to Try. Drop one on a Try (or just after it) to add that section. When there is no Try, Studio makes one for you.
2. Select, move and arrange steps
- Click a step to select it. Ctrl+click adds or removes steps. Shift+click selects a range within the same block. Ctrl+A selects everything. Esc clears the selection. With two or more selected, the toolbar shows "n steps selected" with ✕ to clear.
- Move steps by dragging them (all selected steps move together), with Alt+↑ / Alt+↓, with the ↑ ↓ buttons in the canvas toolbar, or with Move up / Move down at the bottom of Action settings. A block cannot be moved inside itself.
- Fold a block with its arrow (or ← →) to hide its steps; the card then says "n steps hidden".
- The step menu (⋮ on a card, right-click, or Shift+F10) offers: Run from here, Run from here with default values, Run this step only, Open the agent it runs (Run Agent steps), Copy, Cut, Paste after, Duplicate, Delete, Disable / Enable, Toggle breakpoint, Move up, Move down, Add note…, Copy to shared clipboard and Paste from shared clipboard.
Deleting a block asks "Delete this step and the n step(s) inside?".
3. The Action settings panel
Select a step to see its settings on the right. The panel is compact: 26 px rows, the boxes across the whole width, and every field's help behind its ⓘ. From top to bottom:
- Title on one line: the toolkit's mark (its own colour and symbol, such as Aa for text or 123 for numbers), the action's name, its toolkit and line, and Docs and Video; then its description on one line, with more for the rest.
- Inputs: the fields the action needs.
- Outputs: where to keep what the action returns.
- Extra sections for some blocks: Else if branches (If), Catch blocks and Finally (Try), Case and Default (Switch), State (State machine).
- Error handling (folded): Disabled (skip this step), Continue the agent if this step fails, and for toolkit actions Retries on temporary errors and Timeout (seconds).
- General (folded): Step id and Note.
- Buttons: Move up, Move down, Duplicate, Delete. With several steps selected they act on all of them.
3.1 Fields
| Field looks like | What to enter |
|---|---|
| Text box | Text, a $variable$, or text with $variable$ in it, such as Invoice $number$. |
| Number box | A number, a $variable$, or a small calculation such as $n$ - 1. A value outside the allowed range turns red. |
| Drop-down with "(default: …)" | Leave it on the default or pick another choice. |
| true / false drop-down | For Boolean fields. |
| File or folder box with Browse… on its right | Type a path or a $variable$, or click Browse…. A file field asks where the file comes from: This computer (choose it in a folder list) or One CommandCenter (a file kept there; the agent takes it along, so the runner gets it at the same path). A folder field opens the folder list straight away: open the folder and click Use this folder. The same Browse… is on file and folder fields in conditions (File exists, Folder exists), loop types (Each file in folder), the file trigger's Folder, and a File variable's default. |
| "(choose a … variable)" list | For Table, List, Dictionary and Record fields: pick a variable of that type, + New … variable, or Enter a value or expression…. |
| {x} inside the box (on its right) | Opens Insert a value (also F2 or Ctrl+Space, or typing $): a preview of the field with the value in it, Your variables (with their types) first, then System values (each with what it holds) and Shared Global values. Click one to put it at the cursor. New variable makes one of the field's type; from a field its button is Create and use. |
| ⓘ beside the label | Hover or focus it for the field's help, allowed range and an example; click it to show the help under the field. |
A required field that is still empty is marked with ***** and says Required under it, before you even validate.
How variables are written. A variable is written between two dollar signs: $total$, $row.Amount$,
$sys.date$, $global.region$. A field that holds only $total$ passes the value with its type (a Number stays a
Number); inside text, $total$ is replaced by the value (Total $total$ items). Agents made before 14 November 2026
wrote $total and ${total}; they keep working, and saving the agent rewrites its references as $total$. A $ with
no closing $ (such as US$ 5) stays as typed.
Inputs left empty. An agent runs without its inputs; only an input ticked Required stops the run
("Required input 'count' has no value"). An input given as nothing (left empty in the Run dialog, an empty cell, or an
empty value from a parent agent) counts as not given, so its default applies. A variable with no value starts empty
for its type: Text "", an empty List, Dictionary or Table, and No for Yes/No. A Number or a date stays empty until a
step sets it; using an empty one in a calculation stops with "A value used as a number is empty" and says to give it a
value or a default.
3.2 Choices, tick boxes and More options
Toolkits lay out their panels so the common case stays short:
- Choices are a row of buttons that show only the chosen option's fields. Example: Excel > Get cell asks Cell: The active cell / A specific cell; only A specific cell shows the Cell box. Choosing another option clears the fields of the one you left.
- Tick boxes that reveal fields: the fields stay hidden until you tick the box. Example: Excel > Open workbook has The file has a password (reveals Password) and The file is on OneDrive or SharePoint (reveals Access token and Drive). Unticking clears those fields.
- More options folds away settings you rarely need. Its heading shows how many fields it holds and how many you have changed ("· 2 changed"). It opens by itself when one of its fields is set.
- Some fields appear only when another field has a certain value (for example a loop's Number of times only for N times).
3.3 Outputs
Each output reads Save , with the type expected. Choose a variable, or click + New to create one with the right type. Only variables that can hold that type are listed; a Text result may also go into a Number or Boolean variable ("converted from text").
Tip: Actions that change a table, list or dictionary return the changed copy. When you choose a variable as their input, Studio stores the result back into the same variable for you and says so: "The result is stored back in $rows (see Outputs)."
4. Variables
Variables hold values while the agent runs. Open the Variables panel from the rail.
4.1 Create a variable
- Click + New in the Variables panel (or + Add next to a group, or + New variable in the variable picker).
- In New variable, fill in:
- Name: letters, digits and
_, starting with a letter or_. You use it as$name. - Type: one of the tiles below.
- Use: tick Use as input (given when the agent starts, by a person, a schedule or a parent agent) and/or Use as output (returned when the agent ends). Neither ticked: a working value inside the agent.
- Required: the agent cannot start without a value (inputs only).
- Business figure (KPI) (Number, String or Boolean outputs): each successful run records it for dashboards in One One CommandCenter.
- Default value: an editor that suits the type.
- Allowed values (String and Number inputs): a comma-separated list; people then pick from it.
- Description: what it holds. People running the agent, and AI agents, read it.
- Name: letters, digits and
- Click Create variable.
| Type | Holds |
|---|---|
| String | Text |
| Number | A whole or decimal number |
| Boolean | True or false |
| DateTime | A date and time |
| Time | A time of day without a date, such as 14:30:05. Type 14:30 or 2:30 PM |
| TimeSpan | A length of time, such as 2h 15m, 1d 3h or 01:30:00 (kept as PT2H15M). It can be negative |
| List | Ordered items |
| Dictionary | Named keys and values |
| Table | Rows and columns |
| Record | One row of named values |
| File | A file or folder path |
| Image | A picture held in memory (shown as Image 640x480). Its default is a picture file, read when the agent starts. Give it straight to the picture fields of the Image commands |
| Binary | Bytes held in memory, such as a file's contents (shown as Binary 1.2 KB). Its default is a file path or Base64 text |
| Window | An application window |
| UIElement | An element on screen or in a web page |
| Credential | A secret from the vault |
| Any | Any kind of value |
A Time default is picked with a time field; a TimeSpan default is typed as you would say it and shows what it is saved as.
Add a TimeSpan to a date or a time in a calculation ($start + $duration), and use timeBetween($a, $b) for the
time between two dates.
Lists, dictionaries, records and tables get small editors (+ Item, + Key, + Column, + Row) with Edit as JSON for when you prefer to type.
4.2 Work with variables
- Click a variable to edit it. Renaming updates every use in the agent.
- Each row shows the type, default and how often it is used ("3 uses" or "unused").
- → inserts
$nameinto the field you edited last; ⧉ duplicates; ✕ deletes (Studio warns when it is in use). - System variables (
$sys.…) are read-only values from the platform, such as today's date or the machine name. - Shared Global values (
$global.…) are shared by all agents. They are managed in One CommandCenter > Shared Global values (orglobal-values.jsonin the workspace for local runs). Refresh reloads both lists.
4.3 Credentials
Never type a password or token into a step. Use a Credential variable instead:
- Create a variable of type Credential, usually as an input. Credentials never have a default.
- Use
$password(or your name) in the step's credential field. In Set text fields choose Credential and pick the variable. - Whoever runs the agent gives a vault reference in the form
folder/credential/attribute, for examplefinance/erp/password. The secret is fetched only while the step runs and is masked in every log.
Tip: For local test runs in Studio, the reference
finance/erp/passwordis read from the environment variableOOA_SECRET_FINANCE_ERP_PASSWORD, set before ONEOFFICEAUTOMATION starts. Runs in One CommandCenter read One Agent Vault.
5. Values, $variables and ${...} text
| You type | It means |
|---|---|
Hello | The text Hello |
42, true, ["a","b"], {"k": 1} | A number, a Boolean, a list, a dictionary (written as JSON) |
$total | The value of the variable total, with its own type |
$row.Customer or $row["First Name"] | A column of a record, or a key of a dictionary |
$items[0] | The first item of a list |
Invoice ${number} is due | Text with the value put in |
$sys.…, $global.… | System and shared values |
Important: inside other text, write
${name}, not$name.Dear $nameis sent literally. Studio warns you with the toast "Inside text, write ${name} to put in the value of $name."
6. Calculations (expressions)
Calculations are worked out when the step runs.
- Assign variable has two modes: Text or value (saved as typed) and Calculation. Text that looks like a
calculation, such as
$i + 1, is saved as one automatically ("Saved as a calculation: …"). - Assign several variables sets many variables in one step, one row each. Rows run from the top, so a row can use a
variable set above it; reorder them with the arrows. Start a value with
=for a calculation:=$price * $qty. - Number fields accept a calculation directly:
$count - 1. - Set text fields have a Calculation mode too:
upper($row.Name)or$qty * 2.
You can use + - * / %, comparisons (== != < > <= >=), && and ||, and functions such as round($x, 2),
toNumber($text) and upper($name).
Calculate (Number) is the easy way to work out a number. Choose Pick an operation and pick add, subtract,
multiply, divide, remainder, power, square root, absolute, negate, round, round up, round down, integer part, decimal
part, minimum, maximum, sum, average, percent of (A percent of B) or percentage change (from A to B); or choose Write a
formula and type it as in a spreadsheet: ($price$ * $qty$) * (1 + $tax$ / 100). Under the formula Studio shows its
result with your variables' default values while you type, or says which variable needs a default first, or what is
wrong with the formula. Decimals rounds the result. Set Yes/No (Boolean) works the same way for conditions:
$total$ > 1000 and $country$ == 'IN'.
Functions for numbers: round(x, 2), floor(x), ceiling(x), truncate(x, 2), power(x, y), sqrt(x), mod(a, b),
abs(x), min, max, sum($list), average($list) and clamp(x, low, high). For text: indexOf, left, right,
repeat, padLeft, padRight, titleCase, normalizeSpace, upper, lower, trim, replace, substring,
split and join.
Commands for the usual changes, without a formula:
| Toolkit | Commands |
|---|---|
| Number | Calculate, List statistics (count, sum, average, minimum, maximum, median), Round to a step (0.05, 15 minutes, a pack of 12), Format as currency, percent or unit, Number to words (cheques; lakh and crore too); conditions Number is between, Compare numbers (with a tolerance) |
| String | Join texts, Find all matches, Extract with pattern (named parts as a Dictionary), Remove characters (digits, letters, punctuation, accents ...), Normalize spaces, Insert text, Remove part of text, Repeat text, Mask text (cards, e-mail addresses), Shorten text, Count words and lines, Fill a template (Dear {name}), Encode or decode text (URL, HTML, XML, JSON, Base64), Change case (also camelCase, PascalCase, snake_case, kebab-case); conditions Starts with, Ends with, Contains, Is empty, Matches a pattern |
| Boolean | Set Yes/No (from a value or a formula), Combine Yes/No values (all, any, exactly one, none), Number to Yes/No; conditions Is Yes, Is No |
| Convert | Convert value: text, number, Yes/No, date, list, dictionary or JSON text into any other, with a date pattern (dd/MM/yyyy), a locale for numbers (de-DE reads 1.234,50), a list separator, and a fallback value instead of an error |
7. Conditions: the If builder
If, Else if, Wait for condition and Loop > While use the same condition builder.
- Add an If step. It comes with Then and Else sections.
- Under Condition, the first row is Compare two values:
- left box: a
$variableor value; - operator: equals, does not equal, is greater than, is less than, contains, starts with, ends with, matches pattern (regex), is empty, is not empty, is one of (list), is between [low, high] and their opposites;
- right box: the value to compare with.
- left box: a
- Text options (folded) add Ignore case, Ignore spaces around and Ignore line breaks: useful for text read from pages and files.
- Tick Not to reverse a row.
- + Condition adds a row. With two or more rows, choose All of these are true (AND) or Any of these is true (OR).
- + Group adds rows combined the other way, for example A and (B or C).
- The first drop-down of a row also offers Is true, Is false, and conditions from toolkits, such as File exists, Element exists, Window exists, Table is empty or Date is between, with their own fields.
- Prefer typing? Write an expression instead, for example
$amount > 1000 && $status == 'open'. Use the condition builder takes you back.
Else if: open Else if branches in Action settings and click + Else if. Each branch has its own condition and its own section on the canvas.
Test it with sample values. Below the builder, the condition is written as a sentence ("Reads: If $amount is greater than 1000"). Click it to open the test:
- A box appears for each variable the condition uses, filled with its default.
- Type sample values and click Test.
- The answer is True: the steps inside If run. or False: the Else steps run., or the reason it could not be checked.
Switch: one value, many cases. When one value decides between several paths (a status, a country, a file type), a Switch reads better than a chain of Else ifs:
- Add Switch (Logic) and fill in Value, for example
$status. - Select the Case row under it and type the values that select it, one per field (an empty field at the end adds
another). Any one of them selects the case. Values can be text, numbers or
$variables. - Click + Case in the Switch's settings for each further case, and + Default for steps to run when no case matches. Move case up and Move case down change the order.
- Click actions in the library with a case selected to put them in it.
Cases are tried from the top and only the first match runs. Match sets the comparison: equals
(numbers and the same number written as text are equal, so 5 matches "5"), contains, starts with, ends
with, regex (each case value is a pattern), or expression, where each case value is its own condition and
Value is not used. Ignore case compares text without upper and lower case. Exit loop and Continue loop
inside a case act on the loop around the Switch. The run log says which case ran.
State machine: work that moves through stages. When an item goes back and forth between stages until it is done (an invoice waits for approval, is approved or rejected, then paid), a State machine says so directly. Each state has steps that run when it is entered; its transitions say where to go next and when.
- Add State machine (Logic). It starts with a state Start that moves on to a final state Done.
- Select a state's heading (for example State Start (start)) to rename it, tick Final where the work ends, or tick Start here. Click + State in the State machine's settings to add more.
- With a state selected, click + Transition. Select the transition's heading (→ Done (always)), choose where it Goes to, and whether it is taken When a condition holds (the same condition editor as If) or Otherwise, when no transition above it is. Move up and Move down change the order they are tried in.
- Click actions in the library with a state or a transition selected to put them there: a state's steps run each time it is entered, a transition's steps on the way to the next state.
For example, an invoice: Waiting (entry: read the invoice) goes to Approved when $amount <= 1000, otherwise
to Rejected; Approved (entry: post it) goes to Paid; Rejected and Paid are final. The run log
names each state entered and each transition taken. A state that is not final and has no transition that holds
stops the run with STATE.NO_TRANSITION; the Maximum transitions setting (default 1,000) stops a machine that goes round for
ever (STATE.LIMIT). Exit loop and Continue loop inside a state act on the loop around the State machine;
Go to stays within one state's (or transition's) steps. Errors reach a Try around it and the agent's On error. The
check before a run reports states nothing leads to, transitions to states that do not exist, and a machine with no
final state it can reach.
8. Loops
Add a Loop step. Its settings start with Kind of loop:
N times
- Number of times (required): a number or
$count. - Counter (optional): a Number variable that receives 0, 1, 2 … or, with Start counting at
1, 1, 2, 3 …. - More options: Count up by.
For each
- Go through: Each item in a list, Each row in a table, Each key and value in a dictionary, Each key in a dictionary, Each value in a dictionary or record, or an iterator from a toolkit (for example the rows of an Excel sheet, the files of a folder, or the trigger loop's events).
- Table to go through / List to go through: pick the variable.
- Store each row in / Store each item in: the variable that receives the current one. Read columns as
$row.Nameor$row["First Name"]. - Columns into variables (optional): + Column maps a column to its own variable, so later steps can say
$customerinstead of$row.Customer. - Only the first (optional): go through only this many.
- Position (optional): a Number variable with 0 for the first item, 1 for the second ….
- More options: Start at position, Stop after position (0 = first), Take every, Go through in reverse order.
While
- Repeat while: a condition, checked before each pass.
- Check after each pass (the steps run at least once).
All kinds have, under More options, Loop name (so Exit loop and Continue loop can name an outer loop) and Safety limit (the agent stops with an error after that many passes; 100000 by default).
Inside a loop, Exit loop leaves it and Continue loop skips to the next pass.
9. Error handling
9.1 Try / Catch / Finally
- Add a Try step. It has Try and Catch all errors sections.
- Put the steps that may fail in Try.
- Put what to do on an error in Catch: log it, send a notice, skip the item.
- In Action settings, Catch blocks lets you set, for each Catch:
- Errors it catches: tick the kinds in words (Anything not found, A file or folder not found, A window
not open, An element or control not on screen, Waited too long, Sign-in or permission refused, A
service asked to slow down, Any browser error, Any Excel error and so on); none ticked catches every error.
Other error codes takes codes from the error list, such as
SAP.LOGON_FAILEDorPGP.*. The first Catch that matches runs, so put specific ones first. - Error message to, Line number to, All error details to (a Dictionary with code, message, suggestedFix, line, action and stepId).
- Take a screenshot when the error is caught: saved under
screenshots\in the workspace. - Raise the error again after this Catch (the agent still fails).
- + Catch adds another Catch block.
- Errors it catches: tick the kinds in words (Anything not found, A file or folder not found, A window
not open, An element or control not on screen, Waited too long, Sign-in or permission refused, A
service asked to slow down, Any browser error, Any Excel error and so on); none ticked catches every error.
Other error codes takes codes from the error list, such as
- + Finally (in the Finally section of the settings) adds steps that always run at the end, error or not: close a file, log out. Remove Finally works once it is empty.
9.2 Raise your own errors
Throw error stops with your own code and message, for example BUSINESS.DUPLICATE with "Invoice 123 was already
booked". It starts as BUSINESS.ERROR; the list offers BUSINESS.REFUSED, BUSINESS.NOT_FOUND, DATA.INVALID and
others. A Catch for BUSINESS.* handles them.
9.3 Continue on error and retries
In a step's Error handling section:
- Continue the agent if this step fails: the agent carries on after a failure of this one step.
- Retries on temporary errors (0 to 10): retries with growing pauses when the error is temporary (a busy server, a rate limit).
- Timeout (seconds): how long the step may take; the placeholder shows the action's default.
9.4 On error: steps for any error that ends the agent
A Try covers the steps inside it. On error covers the whole agent: its steps run once when an error that no Try caught is about to end the agent, while the browser, workbook and windows the agent opened are still open. Use it to take a screenshot, close applications, write the error to a file or send a mail.
- With no step selected, the Properties tab has If an error ends the agent. Click Add error steps (On error). (Or More step actions > Add error steps (On error).)
- A red ON ERROR heading appears under END. While it is selected, actions you click in the library go into it; you can also drag steps and actions onto it. Its steps are numbered on from the agent's last line.
- Click ON ERROR to set:
- Keep the error in: a Dictionary variable that gets the error:
code,message,suggestedFix,stepId,line,action, andstack(the agents and steps it happened in). For example${err.message}in a mail. - Then: Fail the run (the default) ends the run failed with the original error, so One CommandCenter, retries and the agents that called this one see the real cause. Succeed with a warning ends it as succeeded; the run log says which error was handled.
- Take a screenshot first: saved under
screenshots/in the workspace. - Remove On error removes it with its steps.
- Keep the error in: a Dictionary variable that gets the error:
Good to know:
- On error does not run for an error a Catch handles, for a step set to continue on error, for a Stop agent step, or when someone stops the run.
- If a step inside On error fails, the run log shows that error and the run fails with the original one. On error never runs again for its own errors.
- A child agent has its own On error. The parent's On error sees the child's failure only when the child still fails.
- When the run went over its time limit, On error gets one extra minute.
- Run from here is not offered on On error steps: they run only after an error.
10. Step groups, notes and comments
- Step (in Logic and flow) is a named group of steps. Give it a Title; it changes nothing when the agent runs but keeps long agents readable, and you can fold it.
- Notes: Add note… in the step menu, or the Note field in General. The note replaces the settings summary on the card. Leave it empty to remove it.
- Rename a step: select it and press F2 (or choose Rename in the step menu). The cursor goes to Shown on the step (under Comment in its settings, the step's note): type what the card should say.
- Comment is a step that does nothing; use it for longer explanations.
10.1 Subflows
A subflow is a named list of steps kept inside the agent, beside its main steps: for example Login, used at the start and again after a time-out. It uses the agent's own variables, so there is nothing to pass in or out.
- Add one: More (⋯) > Add a subflow… in the steps toolbar, then give it a name. The agent then shows a row of lists above the steps, Main first and then each subflow; click one to show and edit its steps. Actions you click or drag from the library go into the list shown.
- Rename or delete it: show it and use the ⋯ beside the lists. Renaming also changes the Run subflow steps that run it. Deleting removes its steps too (Ctrl+Z brings it back).
- Run it: add Run subflow (Agent) and choose the subflow. Open the subflow it runs in the step menu shows it. A subflow may run other subflows, and itself, up to 100 deep.
- Leave it early: Exit subflow ends the subflow; the agent carries on after the Run subflow step.
- An error in a subflow goes to the Try around the Run subflow step. Exit loop and Continue loop in a subflow only work on loops inside it.
- Run from here on a step in a subflow runs the rest of that subflow only. When debugging, the steps list follows the run into the subflow where it stops.
10.2 Labels and Go to
Label (Logic) marks a place; Go to carries on from a label, forward or back. Choose the label from the list: it offers only labels Go to can reach, those in the same list of steps and in the blocks around it, never inside another block or across subflows. Blocks it leaves end, and their Finally parts still run. A run that jumps more than 10,000 times stops with GOTO.LIMIT. A Loop is usually clearer; use Go to for a retry from an earlier point.
11. Disable steps
Select steps and press Ctrl+/ (or Disable in the toolbar or step menu). Disabled steps are greyed, marked Disabled, and skipped when the agent runs. The same button then reads Enable.
12. Copy, paste and the shared clipboard
- Copy / Cut / Paste (Ctrl+C / X / V, toolbar or step menu) work within Studio. Pasted steps get new step ids and go after the selection. The variables they use come along when the target agent lacks them: "Pasted 3 steps and 1 variable(s)".
- Duplicate (Ctrl+D) copies the selection right after itself without touching the clipboard.
- Copy to shared / Paste shared use a clipboard kept in the workspace, so you can carry steps to another agent even after reloading Studio.
- Script and Prompt Skill editors have Copy as an agent step: open an agent and press Ctrl+V to add the step.
13. Find and replace, undo and redo
Find and replace changes the same text in many steps at once, for example a folder path or a sheet name.
- Press Ctrl+H (or choose Find and replace… in the steps toolbar's More step actions menu).
- Type the text in Find and the new text in Replace with. Studio looks in the steps' settings, outputs and names, not in step ids or actions.
- Tick Match case to find only the same capitals. When steps are selected, tick Only the n selected steps (and the steps inside them) to leave the rest of the agent alone; otherwise the whole agent is searched.
- The dialog shows how many places it found. Press Replace all. The toast says how many places changed.
Undo (Ctrl+Z, ↶) and Redo (Ctrl+Y or Ctrl+Shift+Z, ↷) cover your last 100 changes to the open agent, a whole Replace all included. Undo history starts again when you open another agent.
14. A worked example
Goal: read data/orders.csv, and log every order above 1,000.
- + Create > Agent from a blueprint > Loop through a CSV file. Name it Big orders.
- Open Variables. Edit
csv_fileand set its default todata/orders.csv. - Select the Comment inside the loop and delete it (Del).
- Click the Repeat section of the loop, then add If.
- In the condition: left
$row.amount, operator is greater than, right1000. Open "Reads: If …", type a sample value and click Test. - Click the If's Then section and add Log message with Message
Big order ${row.order_id}: ${row.amount}. - Drag the existing Log message ("Row: ${row}") into Else, or delete it.
- Click Validate; the Problems tab should say "No problems." Save with Ctrl+S.
- Click Run. See Running and debugging.
15. If it goes wrong
| What you see | Cause and fix |
|---|---|
| A field is outlined and says Required | Fill it in, or choose the option that does not need it. |
| A number box turns red | The value is outside the allowed range shown in ⓘ. |
| "Step ids use letters, digits, '.', '-' and '_'." / "Another step already has id …" | Pick another step id in General. |
| "Variable names start with a letter or _ and use letters, digits and _." | Rename the variable. |
| "A block cannot be moved inside itself." | Drop the block outside its own sections. |
The text $name appears literally in an email | Write ${name} inside text. |
| The output list does not offer your variable | Its type cannot hold the result; create one with + New. |
| "Unknown condition … (is its toolkit installed?)" / "Unknown iterator …" | The toolkit is missing or switched off. Ask your administrator. |
| "Invalid JSON: …" after Apply JSON | Fix the JSON text, or use Format to find the error. |
Agents written in code (Python)
Developers can write an agent's work in Python and still run it like any agent: from schedules, triggers, queues and the API, with its runs, logs and audit in One CommandCenter. Add the Coded agents toolkit's Run Python agent step and give it a module, as a file in the agent's files or typed in the step:
def main(inputs, ooa):
rows = ooa.call("ooa.csv/read", path=inputs["file"])["table"]["rows"]
ooa.log("Read %d rows" % len(rows))
for row in rows:
ooa.call("ooa.workload/add_item", queue="Invoices", data={"number": row[0], "amount": row[3]})
return {"queued": len(rows)}
main(inputs, ooa)gets the step's inputs and returns a dictionary, the step's outputs (anything else comes back asresult). Entry names another function.ooa.call("toolkit/command", name=value, ...)runs any toolkit command as part of the step, with the same checks, vault references and logging as a step. Only the toolkits listed in Toolkits it may call can be called, so toolkits switched off in One CommandCenter stay off for code too. A failing command raisesOoaErrorwith itscode.ooa.log(message, level)andprint(...)write to the run's log.- Python 3 must be on the runner (or name it in Interpreter, such as a virtual environment's python).
- Test the module with plain Python and pytest by passing your own stand-in for
ooawithcallandlog.
Git as the source of truth. With Git set up (Manage > Settings > Agents and repository), developers can
work on agents in Git: Pull from Git reads every agent changed on the branch since the last sync as a new version
(checked like a check-in; production stays as it was), with the Git commit and its author in the version's comment, and
makes new files new agents. An agent changed both in One CommandCenter and in Git since the last sync is left alone and
listed, as is a file that is not valid JSON; a file deleted in Git is only listed. A pipeline can do the same after a
merge with POST /api/git/pull and an API key (Bearer), so reviewed pull requests become versions.