> For the complete documentation index, see [llms.txt](https://docs.contextual.io/documentation-and-resources/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/creating-an-agent.md).

# Creating an Agent

Here is a quick guide for creating your first Agent in Contextual.

1. Access your Contextual Tenant Workspace
2. Select **Components** > **Agents** from the main menu
3. Select <img src="https://2803907488-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FJF7AoTYz7NHacejws5p9%2Fuploads%2Fgit-blob-faedf1235e3edc1835451972934d384aedd8a401%2Fadd-icon.svg?alt=media" alt="" data-size="line"> to Create an Agent
4. Provide the basic [**Definition**](/documentation-and-resources/components-and-data/agents/agent-details/definition.md)...
   * Agent Id - permanent, must be unique
   * Agent Name - required, editable
   * Agent Description - optional, editable
   * Agent Type - Specifies the trigger type for the agent:
     * Event to Flow - Agent receives asynchronous events from Object Type triggers or other Agents
     * Cron to Flow - Agent executes a flow on a cron schedule
     * HTTP to Flow - Agent processing incoming HTTP requests on an agent-specific URL:\
       \<agentId>.service.\<tenantName>.my.contextual.io
   * Flow - once you specify the agent type, a drop-down list of available flows will appear and allow you to select a flow to be used for this agent.
   * Entry Point - for Event to Flow agents, if the flow supports more than one Event Start entry point, then a drop-down will appear that allows you to select which entry point this specific agent deployment should use.
   * Processing Type (Event to Flow only, under **Advanced**) - choose **Ordered** (default) or **Unordered**. See [Definition](/documentation-and-resources/components-and-data/agents/agent-details/definition.md) for guidance on choosing.
   * Image (version) - specifies the version of the agent runtime to be used for this agent.
   * Parallel Instance Scaling Type - allows for the specification of the auto-scaling type:
     * Compute Threshold - specifies a percentage CPU threshold which, if exceeded consistently, will cause additional instances of the agent to be deployed. Available for HTTP to Flow and Event to Flow agents.
     * Event Lag - specifies the number of unprocessed events which, if exceeded, will cause additional instances of the agent to be deployed. Available only for Event to Flow agents.
   * Parallel Instances - specifies the number of agents to be deployed, as a minimum and a maximum number of instances:
     * Minimum - the minimum number of instances to keep running. A value of 0 is available to Event to Flow agents using Event Lag (lag-based) scaling, on tenant plans that support parallel instance scaling (with Maximum Instances of at least 1). For Compute Threshold scaling, and for HTTP to Flow agents, the minimum must be at least 1. For HTTP to Flow availability during planned infrastructure maintenance, [set the minimum to 2 or more](/documentation-and-resources/components-and-data/agents/types-of-agents/http-to-flow.md#keep-the-agent-available-during-maintenance). See [Parallel Instances](https://docs.contextual.io/documentation-and-resources/components-and-data/agents/scale-and-performance/parallel-instances) for full configuration guidance and tradeoffs.
     * Maximum - the maximum number of instances must be greater than or equal to the minimum.
     * **Note:** if the minimum and maximum number of instances are the same, then auto-scaling is effectively disabled.
   * Event Lag Threshold - if "Event Lag" is selected for the scaling type, then this field specifies the number of unprocessed events which, if exceeded, will trigger the deployment of an additional agent.
   * Instance Compute - if "Compute Threshold" is selected for the scaling type, then this field specifies the percentage of CPU utilization which, if exceeded, will trigger the deployment of an additional agent.
   * Instance Compute - specifies the size of the agent (small, medium, large). The agent sizes correspond to a specific mCPU capacity assigned to the agent.
   * Schedule - if "Cron to Flow" is selected, this field defines when the flow should run.
   * Environment Variables - allows the user to add environment variable name and value pairs that are accessible at runtime by the flow that is being executed, allowing for flows to be made configurable based on the environment variables provided.
5. Click **Create**


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.contextual.io/documentation-and-resources/components-and-data/agents/creating-an-agent.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
