Skip to main content

Configuration

Overview of all AgentXP configuration options and how to apply them.
Configure AgentXP by passing an options object directly to withAgentXP() in your middleware.ts. No separate config file is required.
middleware.ts

Type-safe config with defineConfig()

For projects where you want to define configuration separately and get full TypeScript inference, import defineConfig() from @reaganhsu/agentxp-core:
agentxp.config.ts
Then spread it into withAgentXP():
middleware.ts
defineConfig() is a zero-overhead identity function — it exists solely for TypeScript autocompletion and type-checking. It does not load, validate, or transform your config at runtime.

Configuration shape

The object passed to withAgentXP() accepts the following top-level keys:

Complete example

middleware.ts

Configuration sections

Detection

Configure which signals AgentXP uses to identify AI agents.

Transform

Control how HTML pages are converted to markdown.

Permissions

Signal what agents may do with your content.

llms.txt

Configure the auto-generated site index for AI agents.