An agent can have up to 500 procedures. Manage them in the console on the agent’s Procedures tab, or with the API:
Links
A procedure’s text can link the agent’s tools and its other procedures. In the console, type@ (or [[ for a procedure) and pick one; it shows as a chip, with what it points at on hover. In the API, write [[tool:<name or id>]] and [[procedure:<title or id>]]: they’re kept by id, so renaming the tool or the procedure keeps the link, and references lists each with what it points at now. A link to something that isn’t there is refused (400), unless it was already in the text (a tool removed since, say): then it stays, marked missing. A tool a procedure links is unlocked with it, as if it were in tools. The agent reads a tool link as its name and a procedure link as its title and id, so it can open that procedure. Type { for one of its inputs.
Many at once
POST /v1/agents/{agent_id}/procedures/batch takes up to 50 procedures in procedures. One without an id is added; one with an id changes only the fields you send (with revision, only while it’s still at that revision, or you get a 409). Each can bring up to 20 test_cases (500 in all), written as for POST /v1/test_cases: they’re tied to that procedure, and one whose key you already have is replaced. With test_set_id, the cases are added to that test set too. All of it is saved, or none: the first thing that can’t be saved says where (procedures[1].test_cases[0]: …). It returns the procedures in the order sent, each with its test_cases, and the counts created, updated, unchanged and test_cases.created / test_cases.updated.
How the agent finds one
- With up to 20 active procedures, they’re listed in the agent’s instructions (title and “use when”), and it reads the one that fits with
read_procedure. - With more, it searches them with
find_procedure, describing the request; Eager picks the best match, or none. - It follows the steps itself, or passes the procedure to the browser or computer task it starts, so the task follows it too.
GET /v1/tasks/{task_id}lists theproceduresa task used, and a task that looked one up itself has aprocedureevent (“Following …”).
find_procedure searches them as they are now).
POST /v1/agents/{agent_id}/procedures/match with { "need": "is my laptop still under warranty?" } shows what a lookup would pick: the procedure, how sure it is (confidence), why (reason), and the candidates it chose from. The Test lookup box on the Procedures tab does the same. It needs the admin role or an API key, 30 a minute per org.
Procedures the agent writes
When a browser or computer task the agent ran in a conversation works without a procedure, Eager reads what the task did and writes the procedure for next time: when to use it, the steps with placeholders for the inputs, and what to check. When the answer came from a JSON or API address that can be filled in directly, that address becomes the first step, so the next run is one page load instead of a click-through. (Tasks you start on a session don’t write procedures.) It’s savedactive, with written_by: "agent" and the source_task_id it came from, so you can replay the run it learned from and check each step against what really happened. Fix any step in the console like any procedure; your change is the next revision. No procedure is written when an active one already covers the same requests, or during a cold eval run.
Approval
Turn on Approval for a procedure whose runs someone must sign off first, like an order or a refund:approval: { required: true, by, who, covers, note }.
- Before a browser or computer task follows it, the conversation is asked to approve the run, and the reply waits (see Approvals). That holds when the agent names it as it starts the task, when it read the procedure and starts a task without naming it (the most recently read one asks), and when a task finds it with
find_procedure(the task gets its steps and the tools it unlocks once approved; denied, it’s told not to follow it, and those tools stay locked, also after a deploy). byisanyone(the person in the chat, or your team) orteam. A run only your team may approve keeps its whole task your team’s: every step the task hands back is yours to decide.wholabels who signs off, andnotesays what to check; both show on the request.coverslists the agent’s “Ask first” categories (purchase,send, …) the approved run may do without asking again. Anything else still asks.
covers: []: every “Ask first” step still asks until your team reviews it and widens it.
Model
A procedure runs on the agent’s model unless you give it its own:model (or its Model row in the console), one of the agent model values, or null for the agent’s own.
- Once a conversation reads the procedure, Eager hands the conversation to that model: it reads the conversation so far and carries on, for the rest of the reply and the replies after it. Reading a procedure without a model of its own hands it back to the agent’s model.
- While it’s on the procedure’s model, each new message from the person is checked first by a small model (the cheapest of the same provider, not charged): more of the same job, or a quick side question, stays on the procedure’s model; a clear move to another job goes back to the agent’s model before the reply, which reads the conversation so far; and when it’s unclear, it stays and the agent is told to ask the person first.
- A browser or computer task that follows the procedure runs on its model too.
- A task you start on a session, which finds a procedure partway through, stays on the agent’s model.
- The easy way to pick one: run the procedure’s evals, then Compare models on the run. The run’s pick sets the procedure’s model, not the agent’s (see Comparing models). An eval run that tries the agent on models keeps the models it tries.
Category
category (or its Category box in the console) is the kind of request the procedure is for, like Warranty status. It comes from the same set as your test cases’ category, which the eval charts group pass rates by, so a procedure and the cases that check it line up.
- A test case tied to the procedure is always in the procedure’s category: a
categorysent for it is ignored, and when the procedure’s category changes, its cases move with it. A case tied to no procedure, or to one without a category, keeps its own. - A category is spelled as the org already has it, whatever its capitals:
warranty statusis saved asWarranty statuswhen a case or procedure has that already. - Changing only the category makes no new revision.
nullis none. - List an agent’s procedures in one category with
?category=Warranty%20status(any capitals), or those with none with?category=.
Managing categories
The console’s Procedures tab groups procedures by category. Its Categories button, or the categories API (client.categories in the SDKs), manages the org’s set, which every agent and test case shares:
- Add one before anything is in it (
POST /v1/categories). It shows on the Procedures tab as an empty group, with a way to start a procedure in it. Giving a procedure or test case a new category adds it too. - Rename one (
PATCH /v1/categories/{name}): every procedure and test case in it moves, and so do past eval runs’ copies of the cases, so the charts keep it as one. Renaming to a name the org already has merges the two. - Remove one (
DELETE /v1/categories/{name}): whatever was in it has no category any more. Past eval runs keep theirs.
GET /v1/categories lists them A–Z with how many procedures and test cases are in each (?agent_id= also counts one agent’s procedures).
Tools a procedure unlocks
Some HTTP tools should only be called the way a procedure says, such as a refund after checking the order. List them in the procedure’stools (or its Tools row in the console): in a conversation, and in a task you start on a session, a tool any active procedure lists stays locked until the agent has read that procedure, so the steps come before the call. The browser and computer tasks a conversation starts aren’t locked this way yet: they can call every one of the agent’s HTTP tools.
- Names must be HTTP tools of the agent’s published version;
[]detaches them all. Publish a new tool before attaching it. - If you later remove a tool from the agent, procedures keep its name (the console marks it “not on the agent”) until you take it off.
- A tool no active procedure lists isn’t locked: the agent can call it any time.