> ## Documentation Index
> Fetch the complete documentation index at: https://docs.eigenpal.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Your first agent

> Clone, edit, release, run, and inspect a Git-backed agent.

Agents are best when the task needs code, tools, or per-input adaptation instead
of a fixed workflow graph. The source lives in Git, so you work with normal files
and commits.

## 1. Clone the agent source

```bash theme={null}
eigenpal agents clone --out tmp/org-repos/acme-local
cd tmp/org-repos/acme-local
```

Use a directory name that makes the organization and environment obvious.

## 2. Edit the agent

Define the agent in `agents/extract-invoice/agent.ts`, using the public SDK:

```ts theme={null}
import { createAgent } from '@eigenpal/automations';
import { z } from 'zod';

export default createAgent({
  name: 'Invoice extractor',
  instructions: 'Extract the invoice total from invoiceText.',
  triggers: { api: true },
  inputSchema: z.object({ invoiceText: z.string() }),
  outputSchema: z.object({ total: z.number().nonnegative() }),
});
```

You can move inline instructions into `AGENT.md` in the same directory. Attach
[shared resources](https://docs.eigenpal.com/sdks/automations/resources.md) through typed imports. Validate
with `eigenpal agents validate agents/extract-invoice`; source is compiled in
the platform sandbox. Each run captures its compiled definition and exact Git
commit in `eigenpal.lock`. Resumes reuse that snapshot.

```bash theme={null}
git status
```

## 3. Commit, push, and release

Run release from the agent package directory (the folder that contains
`agent.ts`), not the organization repo root:

```bash theme={null}
cd agents/extract-invoice
eigenpal agents save
eigenpal agents release patch
eigenpal agents sync agents.extract-invoice
```

`save` validates, commits, and pushes local changes. `release` creates an
immutable source tag from the current package, and `sync` points the automation
at the latest release.

## 4. Run the agent

```bash theme={null}
eigenpal run agents.extract-invoice --input-json '{"invoiceText":"Invoice total: 120 EUR"}'
```

This example uses structured input and needs no filesystem sandbox. To process
uploaded files with shell/read tools, add
[`.withFilesystem()`](https://docs.eigenpal.com/sdks/automations/filesystem) first.

The command prints a run id. Poll or watch it like any other run:

```bash theme={null}
eigenpal runs watch <run-id>
eigenpal runs trace <run-id>
```

## 5. Improve with reviews

When a run is wrong, add a review and promote the corrected case into the
dataset:

```bash theme={null}
eigenpal runs reviews update <run-id> --verdict incorrect --note "Missed the VAT id"
eigenpal runs promote <run-id> --name missed-vat-id
```

The next experiment can now catch the same miss before it ships again. For a
full review workflow, see [Review production runs](https://docs.eigenpal.com/guides/review-runs.md).

For the full authoring API, see [Agent authoring SDK](https://docs.eigenpal.com/sdks/automations.md). To start
these agents from an application, use the [API client](https://docs.eigenpal.com/sdks/typescript.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.