An agent is an AI agent that answers questions and performs tasks on the platform. It is not built and deployed on its own: an agent is a feature of a service component, and one service can provide more than one agent. You reach an agent through the service that provides it, so an agent has no endpoint of its own.
How an Agent Is Deployed
An agent belongs to the service that provides it, and that service belongs to a project (refer to Key Concepts for the definitions of project, component, deployment, and platform). It reaches a platform as part of the project that ships its service:
-
A developer creates a service using the PAS command-line interface (CLI) and creates one or more agents in it.
-
The build pipeline publishes the project the service belongs to, as a version.
-
You deploy that version to a platform from the Projects. The services of the project start, and the agents they provide start with them.
Each deployment of the project produces one deployed agent per agent and platform. An agent that is deployed to several platforms therefore exists several times, once per platform, and each of these deployed agents has its own status, its own model access, and its own usage figures. You can inspect them in the Agents view in the Control Hub.
The Agents view lists deployed agents only. An agent that a project declares but that is not deployed anywhere is not listed.
Refer to Deploying a Project for details on the deployment of a project.
The Status of an Agent
A deployed agent reports the status of the service deployment that hosts it: running, starting, stopped, updating, degraded, failed, or unknown.
A running agent that cannot call a large language model (LLM) reports API Key missing or Model missing instead. A running agent whose deployment configuration still states an API Key or a model reports Config conflict. Refer to The Model Access of an Agent below for details.
Refer to Control Hub Status and Badge Reference for all status values of the Control Hub, and to Working With the Agents View for the statuses of an agent.
The Model Access of an Agent
Every call of a deployed agent to a large language model (LLM) passes through the Agent Gateway of its platform. Use the Agent Gateway section of the Control Hub to decide, for the platforms you administer, which LLM providers the agents can call, with which keys, and which models they may use.
The model access of an agent defines how it does that:
-
The virtual API Key assigned to the agent. A virtual API Key belongs to one LLM provider and permits a set of models of this provider. One virtual API Key can be assigned to several agents.
-
The model the agent uses. An agent without a model uses the default model of the provider of its virtual API Key.
The Agent Gateway rejects every call of an agent without a virtual API Key, and every call without a model if the provider has no default model. This reflects in the status of the agent (see The Status of an Agent above).
The model access belongs to the deployed agent, not to the project. A deploy and an update of the deployment keep the model and the virtual API Key of each agent that the service still provides. An agent that was deployed before its platform could store a model access has none that you can change: deploy its deployment again to make the model access available.
You assign the model access on the agent details page (refer to Working With the Agent Details). You manage the LLM providers and virtual API Keys in the Agent Gateway section of the Control Hub (refer to Agent Gateway).
Config Conflict
The status Config conflict shows that the configuration of the component deployment that runs the agent still states an API Key or a model for the agent, in the section model below the configuration key of the agent, for example agents.chat.model. Such a section comes from a deployment that was created with an older version, before virtual API Keys were available. Its values replace the virtual API Key and the model that you assign in the Control Hub.
Assign the API Key and the model of an agent only through its virtual API Key. To resolve the conflict, remove the section model of the agent from the configuration of the component deployment. Do the same for an agent that has no virtual API Key yet: it shows no conflict, but it uses the API Key of its configuration. Assign a virtual API Key to this agent first. Refer to Configuring a Deployment for how to change the configuration.
The Control Hub finds a conflict only if you have the right to view the deployments of the platform.
Agent Records
The platform tracks the extent to which individual agents are used: how many input and output tokens they consumed. By default, the figures cover the activity of the last 365 days. They are kept when the Agent Gateway is restarted or replaced. They are recorded while agents are handling calls, so there may be a slight delay compared to a call that has just been made.
The Control Hub displays the consumed tokens in the column Tokens of the Agents view.
Refer to Working With the Agents View for reading the usage figures.
Limitations
The Agents view is a read-only overview. You do not create, start, stop, restart, or delete an agent on its own. An agent follows the service deployment that hosts it: it runs while that deployment runs, and it stops when that deployment stops. Refer to Operating a Deployment for the lifecycle actions of a deployment, and to Deploying a Project for details on how to deploy a project.
The only setting of an agent that you change in the Control Hub is its model access: the virtual API Key and the model that the agent uses. You change it on the agent details page. Refer to Working With the Agent Details Page for details.
You configure an agent through the configuration of the deployment or of the service that provides it. Refer to Configuring a Deployment for details.
Developing an Agent
You develop an agent as a TypeScript class in a service of your project. The runtime package @pas/agent-module builds the agent from the @Agent decorator of the class and from the configuration of the service. The sections below describe what you state as a developer.
Generating an Agent
Run pas generate agent <name> --directory <directory>, or ask your AI coding assistant, which uses the skill pas-generate-agent. The generator creates the agent class, declares the agent as a feature in the component.json of the service, and adds the agent to both configuration files of the service:
|
File |
Generated Entry |
|---|---|
|
|
|
|
|
|
An existing entry for the same agent stays unchanged. If a configuration cannot be found or updated, the generator prints a warning with the entry to add manually. To activate the generated agent:
-
Register the class in a module of the service, for example
@AgentModule({ agents: [EchoAgent] }). -
Make sure that
AgentModuleof@pas/agent-moduleis registered increatePasModule([...])inmain.ts. -
Optional: Set your API Key in
agents.<name>.modelofconfig/local/config.json, changeproviderandmodelthere as needed, and remove the model placeholders in the@Agentdecorator.
Do not state a model section in the default configuration or in the deployment configuration of the service. A deployed agent gets its API Key and its model only from the virtual API Key and the model that you assign in the Control Hub. A model section causes the status Config conflict (refer to section Config Conflict above).
The Agent Runtime
@pas/agent-module is the runtime of every agent. It provides stateless agents, conversational memory, and skills. You need no further package, no registration, and no license key.
@pas/agent-pro-module is deprecated, and version 27.0 removes it. It is now an alias of @pas/agent-module. Move your application to @pas/agent-module: replace every import from @pas/agent-pro-module with an import from @pas/agent-module, replace ProAgentService with AgentService, install the optional packages your agents need (see below), and remove @pas/agent-pro-module from your dependencies. Your agents, their @Agent options, and their configuration do not change.
Conversational Memory
A stateless agent treats every call as independent. A conversational agent keeps the state of a conversation per thread: a call on the same thread continues the conversation, and a call on a new thread starts a new one. To make an agent conversational:
-
Add the option
checkpointto@Agent, for examplecheckpoint: 'memory', or setcheckpointin the configuration of the agent. The configuration replaces the value of the decorator. -
Give a
threadIdon every call ofinvoke()andstream(). A call without athreadIdfails.
The runtime provides the following checkpoint providers:
|
Provider |
Storage |
|---|---|
|
|
The memory of the process. The conversations are lost when the process ends. Use it for tests and short-lived sessions. |
|
|
A PostgreSQL database. The conversations stay after a restart. Install the packages |
You can also add a provider of your own by extending CheckpointProvider of @pas/agent-api. The conversation of a thread is not trimmed or summarized, so a long thread uses more tokens on each call.
Skills
A skill is a named unit of instructions that an agent reads only when a request needs it. The agent knows only the name and the description of each skill until it decides that a skill applies. A skill is a directory with a SKILL.md and the files it refers to, in the format of the Agent Skills specification.
-
Install the package
deepagents. Agents without skill sources do not need it. -
Add the option
skillsto@Agent, for exampleskills: ['filesystem']. The sourcefilesystemreads the skills from a directory next to the service (defaultskills). The sourcepackagereads them from an installed package. -
Add the skills directory to the
assetsof the build target inproject.json, so that the build ships it. -
Optional: Set
skillsin the configuration of the agent. The configuration replaces the sources of the decorator, so you can change the skills per environment.
Skills and conversational memory can be used together.
Step Limit
A run of an agent is a sequence of steps. A model call is one step, and a tool call is one step. The step limit recursionLimit is the maximum number of steps in one run. The default is 25, which allows approximately 12 tool calls. Set a higher limit for an agent whose tasks need more tool calls. The value is a whole number greater than 0. If you set it in more than one place, the value with the highest priority applies:
|
Priority |
Where |
Applies To |
|---|---|---|
|
1 |
The options of |
That run only |
|
2 |
The configuration of the agent, for example |
Each run that starts after the change |
|
3 |
|
Each run of the agent |
|
4 |
No value |
Each run, with the limit 25 |
A run that reaches the limit fails with an error that states the limit. An invalid value in the configuration makes the whole configuration entry of the agent invalid: the agent logs a warning and ignores the entry.
Failed Builds and Failed Tool Calls
An agent is built when its service starts and again after every change of its configuration. The agent recovers from the following failures:
-
Failed build: A build can fail, for example because a Model Context Protocol (MCP) server cannot be reached yet. The error is logged with the name of the agent, and the service keeps running. The next call to the agent builds it again before the agent answers. If that build fails as well, the call fails with the error of the build.
-
Failed tool call: A tool call that fails is handed to the model as a failed tool call that carries the error. The model can report the failure, and the call of the agent goes on. An interrupt and an aborted run still end the call of the agent.
An MCP server that you state in code can state beforeToolCall, a function that runs before each call of one of its tools. If the function throws an error, the call is not sent, and the agent sees a failed tool call.
Refer to Error Handling Agents for the error messages of agent development and how to resolve them.
Related Content
Related Documentation: