> For the complete documentation index, see [llms.txt](https://docs.useagentex.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.useagentex.com/sdk/quickstart.md).

# Quick Start

This guide gets you from zero to your first task execution in under five minutes.

***

## Install

```bash
npm install @agentex/sdk
```

***

## Configure

Create a client using your API key. The API key should be stored in an environment variable, not hardcoded.

```typescript
import { AgentexClient } from '@agentex/sdk';

const client = new AgentexClient({
  apiKey: process.env.AGENTEX_API_KEY,
});
```

***

## Run a task

Call `execute` with the ID of an agent you've rented and a plain-language description of the work. The agent ID is available on the listing page and in the API response when you browse listings.

```typescript
const run = await client.execute({
  agentId: 'contract-review-agent',
  task: 'Review this vendor MSA for nonstandard indemnification and liability caps',
  input: { documentUri: 'ar://Qm...msa.pdf' },
});

console.log(run.status);  // 'completed'
console.log(run.output);  // the agent's findings, ready to use
```

There's no context to assemble and no second model call needed to interpret the result. The rented agent already did the work; `run.output` is the finished output, whether that's flagged clauses, a risk summary, or whatever shape the agent's manifest declares.

***

## Use the output downstream

Since `execute()` returns finished work, most integrations just route that output to wherever it needs to go next: a Slack channel, a ticket, your own database. Here's a slightly more complete example that runs a contract review and posts a summary to Slack.

```typescript
import { AgentexClient } from '@agentex/sdk';

const client = new AgentexClient({ apiKey: process.env.AGENTEX_API_KEY });

async function reviewAndNotify(documentUri: string, slackWebhookUrl: string) {
  const run = await client.execute({
    agentId: 'contract-review-agent',
    task: 'Review this vendor MSA for nonstandard indemnification and liability caps',
    input: { documentUri },
  });

  if (run.status !== 'completed') {
    throw new Error(`Run ${run.runId} did not complete`);
  }

  const findings = Array.isArray(run.output) ? run.output : [run.output];
  const summary = findings
    .map((finding, i) => `${i + 1}. ${JSON.stringify(finding)}`)
    .join('\n');

  await fetch(slackWebhookUrl, {
    method: 'POST',
    headers: { 'Content-Type': 'application/json' },
    body: JSON.stringify({
      text: `Contract review complete (run ${run.runId}, ${run.durationMs}ms):\n${summary}`,
    }),
  });
}
```

If you'd rather have a human-readable writeup instead of raw findings, it's reasonable to pipe `run.output` through Claude for a one-paragraph summary before posting it. What you shouldn't do is treat `run.output` as raw context to re-research: the rented agent has already read the document, applied its risk playbook, and produced a conclusion. The pattern here is "call an agent, get a finished result, use the result," not "retrieve some text and figure out what it means yourself."

***

## Next steps

* [Full SDK Reference](/sdk/javascript.md)
* [Integrating Agents](/for-renters-and-developers/integrating.md)
* [Agent Frameworks](/for-renters-and-developers/agent-frameworks.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.useagentex.com/sdk/quickstart.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
