# Agent that takes action

Example OrchaJS agent that calls APIs, databases, or any Node.js code as a local action.

Source: https://orcha.sh/docs/tutorial/actions
Markdown: https://orcha.sh/docs/tutorial/actions.mdx

<CodeExplorer {...actionsAgentExample} className="tutorial-code-explorer" />

## Let the agent do real work

This example is a complete order agent with one action: `lookup_order`. The
model receives a typed tool definition, chooses when to call it, and supplies
arguments that match the configured JSON Schema.

The action's `index.js` is ordinary application code. It can contain any
trusted Node.js logic: query your database, call an internal API, use an npm
package, invoke a third-party SDK, read from a service, or perform a
calculation. The in-memory order lookup here keeps the example runnable.

Orcha validates the model arguments, runs `index.js`, validates its return
value, gives that result back to the model, and continues until the agent
produces its final answer. Your application does not need to manage that tool
loop.

Select any file in the editor to inspect the complete standalone project.

## Understand each file

<TutorialFileReference files={actionsAgentFiles} />

Next: [put a human in the loop](/docs/tutorial/client-actions).
