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

# Agent

The `Agent` class defines an agent that can be run on the Ardent platform.

```ts theme={null}
import { Agent, Tool, anthropic } from '@ardent-ai/sdk';
import { z } from 'zod';

const addTwo = new Tool({
  name: 'addTwo',
  description: 'Add two numbers and generate a result',
  parameters: {
    one: z.number(),
    two: z.number(),
  },
  async execute({one, two}) {
    return one + two;
  }
});

const agent = new Agent({
  model: anthropic('claude-opus-4-0'),
  instructions: "You are a helpful assistant",
  tools: [addTwo]
});
```

## Constructor

The `Agent` constructor accepts a configuration object with the following properties:

<ParamField path="model" type="Model" required>
  The [Model](/reference/models/overview) to use for the agent's operations.
</ParamField>

<ParamField path="instructions" type="string">
  Instructions that guide the agent's behavior, often called a **system prompt** or **role prompt**.
</ParamField>

<ParamField path="prompts" type="Prompt[]">
  An array of prompts that the agent can call.
</ParamField>

<ParamField path="tools" type="Tool[]">
  An array of tools that the agent can call.
</ParamField>

<ParamField path="workflows" type="Workflow[]">
  An array of workflows that the agent can execute.
</ParamField>

## Methods

In addition to passing [Tools](/reference/tool), [Prompts](/reference/prompt), and [Workflows](/reference/workflow)
into the `Agent` constructor, you can also add them after the fact:

```ts theme={null}
import { Agent, Prompt, Tool, anthropic } from '@ardent-ai/sdk';
import { z } from 'zod';

const agent = new Agent({
  model: anthropic()
});

const addTwo = new Tool({...});
agent.addTool(addTwo);

const summarize = new Prompt({...})
agent.addPrompt(summarize);
```

<MethodField name="addPrompt" params={[{ name: "prompt", type: "Prompt" }]}>
  Adds a prompt to the agent's capabilities. Throws an error if a capability with the same name already exists.
</MethodField>

<MethodField name="addTool" params={[{ name: "tool", type: "Tool" }]}>
  Adds a tool to the agent's capabilities. Throws an error if a capability with the same name already exists.
</MethodField>

<MethodField name="addWorkflow" params={[{ name: "workflow", type: "Workflow" }]}>
  Adds a workflow to the agent's capabilities. Throws an error if a capability with the same name already exists.
</MethodField>

There's no difference between passing these objects to the `Agent` constructor, or by calling a method like
`addTool()`. It's up to you and your preferred style.

## See also

<Card icon="book-open-cover" title="Agents" href="/concepts/agents">
  Read more about agents
</Card>
