Skip to main content
Tools are the functions agents call during a conversation. This tutorial builds two tools: a standard async function that looks up an order from a REST API and returns JSON, and a streaming generator variant that yields progress updates while processing a batch operation.

Prerequisites

What you will build

  1. order_lookup — a standard tool with a Zod schema, two admin config params, needsApproval: false, and a {result} return.
  2. batch_report_generator — a streaming tool that yields results incrementally as it processes items.
1

Create the tools file

Create src/tools/index.ts:
src/tools/index.ts
You will fill in orderLookupTool and batchReportTool in the following steps.
2

Build the order lookup tool

The order lookup tool fetches order details from an internal API. Because it is read-only and low-risk, needsApproval is false — the agent calls it without interrupting the user:
src/tools/order-lookup.ts
A few points about this tool:
  • config paramsorders_api_url (type "string") and orders_api_key (type "variable") are set by an administrator in the agent workbench, not in code. Variable-type params are stored encrypted and looked up at call time. The agent never sees them.
  • needsApproval: false — read-only, reversible operations should not block the user. Set true (the default) for any action that modifies data or has side effects.
  • Return shape{ result: string } is the standard return for tools that produce a text or JSON response. Always JSON.stringify objects before returning — agents parse JSON automatically.
3

Build a streaming tool

Return an AsyncGenerator from execute for long-running operations that should stream progress to the agent. Each yielded value is the same { result } shape:
src/tools/batch-report.ts
The async function* syntax marks execute as an async generator. IMP’s framework handles both the regular Promise and AsyncGenerator return types — the agent sees a stream of result tokens as each yield resolves.
4

Register the tools on the app

src/exulu.ts
After starting the server, both tools appear in the agent workbench under Build → Agents → [agent] → Tools & skills. An administrator enables them per agent and fills in the config param values.
5

Verify tool behavior

Start the server and open the agent workbench. Enable order_lookup on an agent, set the config params, and send a test message that prompts the agent to look up an order. Because needsApproval: false, the agent calls the tool immediately without a confirmation prompt.Enable batch_report_generator on the same agent. When prompted to generate a report, the agent surfaces a Confirm dialog (because needsApproval: true) before calling the tool. After approval, streaming results appear in the conversation.

What you built

  • order_lookup — a standard async tool with a Zod schema, two admin config params (one a "variable" for secrets), and needsApproval: false.
  • batch_report_generator — a streaming AsyncGenerator tool that yields progress for each processed account.

Next steps

OAuth tools

Wrap a tool in an OAuth 2.0 flow so agents can act on behalf of the signed-in user.

ExuluTool — configuration

Full reference for every constructor option including the ExuluOauthConfig shape.

Tools and skills

Enable and configure tools in the agent workbench UI.