@devries-cameron20 / composio-1 / commits / d545254f4
Fork 0

Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

docs: Add LLM guardrails system for AI code generators

Invisible instructions appended to every .md endpoint that steer AI code generators toward the session-based pattern (composio.create + session.tools) and provide correct direct execution patterns on tagged pages. - Session guardrails (default): correct pattern, ALWAYS/NEVER/DISCOURAGED rules - Direct execution guardrails: auth link flow, tool execute flow, key rules - Frontmatter-scoped via llmGuardrails field (Zod-validated) - llms-full.txt prepends guardrails once at top, not per-page - 12 MDX pages tagged with llmGuardrails: "direct-execution" - Remove dead /cookbooks path check from nav components Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

Sushmithamallesh committed Feb 16, 2026 at 14:22 UTC d545254f46e372246ebdffdff77aab2f5a3624b5
23 files changed +303 -11
docs/.claude/decisions/llm-guardrails.md new
+101
@@ -0,0 +1,101 @@
1 +# LLM Guardrails
2 +
3 +## Decision
4 +
5 +Inject invisible guardrail instructions into every `.md` response so AI code generators use the correct Composio SDK patterns. Guardrails are scoped per-page via frontmatter — different pages can get different instruction sets.
6 +
7 +## Problem
8 +
9 +LLMs that crawl or receive Composio docs generate code using the old direct tool execution pattern (`composio.tools.get()`, `composio.provider.handle_tool_calls()`) instead of the current session-based pattern (`composio.create()`, `session.tools()`).
10 +
11 +## Architecture
12 +
13 +```
14 +lib/llm-guardrails/
15 +├── index.ts ← getGuardrails(type), module-private GuardrailType
16 +├── session.ts ← SESSION_GUARDRAILS constant (default)
17 +└── direct-execution.ts ← DIRECT_EXECUTION_GUARDRAILS constant
18 +```
19 +
20 +### How it flows
21 +
22 +1. `getLLMText()` in `lib/source.ts` reads `page.data.llmGuardrails` from frontmatter
23 +2. Passes it to `getGuardrails(type)` which returns the right guardrail string
24 +3. Appends it to the markdown output
25 +
26 +### Scoping via frontmatter
27 +
28 +Pages control which guardrails they get:
29 +
30 +| Frontmatter value | What gets appended |
31 +|---|---|
32 +| *(omitted — default)* | `SESSION_GUARDRAILS` — full "use composio.create() + session.tools()" instructions, ALWAYS/NEVER rules, deprecated patterns, verification checklist |
33 +| `llmGuardrails: "direct-execution"` | `DIRECT_EXECUTION_GUARDRAILS` — acknowledges direct execution is valid, but strongly recommends sessions unless user explicitly asks for it |
34 +| `llmGuardrails: "none"` | Nothing |
35 +
36 +The Zod schema in `source.config.ts` validates the field at build time — typos cause build failures.
37 +
38 +### Tagged pages (12 total)
39 +
40 +`tools-direct/` (8):
41 +- executing-tools, fetching-tools, authenticating-tools, custom-tools
42 +- toolkit-versioning
43 +- modify-tool-behavior/schema-modifiers, before-execution-modifiers, after-execution-modifiers
44 +
45 +`auth-configuration/` (4):
46 +- connected-accounts, custom-auth-configs, custom-auth-params, programmatic-auth-configs
47 +
48 +### Endpoint behavior
49 +
50 +| Endpoint | Guardrails behavior |
51 +|---|---|
52 +| `/:path*.md` (per-page) | Appended per page based on frontmatter |
53 +| `llms.txt` (index) | One-liner note at top pointing to session pattern |
54 +| `llms-full.txt` (all pages) | `SESSION_GUARDRAILS` once at the top, per-page guardrails disabled (`includeGuardrails: false`) to avoid 1148x repetition |
55 +| Copy Page button | Fetches `.md` endpoint, so guardrails are included automatically |
56 +
57 +### getLLMText options
58 +
59 +```typescript
60 +getLLMText(page, {
61 + includeFooter?: boolean; // default true — nav links at bottom
62 + includeGuardrails?: boolean; // default true — guardrail block
63 +})
64 +```
65 +
66 +`llms-full.txt` passes both as `false` and handles them at the route level instead.
67 +
68 +## Why this approach
69 +
70 +| Alternative | Why not |
71 +|---|---|
72 +| Per-page component/accordion | Requires adding to every page, new pages miss it |
73 +| URL-path matching in code | Implicit — moving a file breaks it silently |
74 +| Separate "Copy Prompt" button (Clerk-style) | Clashes with existing "Copy Page" button |
75 +| Guardrails in frontmatter content | Visible to humans on the site |
76 +
77 +Frontmatter tag + pipeline injection = zero visual impact, zero per-page maintenance, explicit opt-in for different behavior, build-time validation.
78 +
79 +## Adding a new guardrail set
80 +
81 +1. Create `lib/llm-guardrails/your-set.ts` exporting a string constant
82 +2. Add the enum value to `llmGuardrails` in `source.config.ts`
83 +3. Add a case to `getGuardrails()` in `lib/llm-guardrails/index.ts`
84 +4. Tag pages with `llmGuardrails: "your-set"` in frontmatter
85 +
86 +## Session guardrails content
87 +
88 +The default guardrails include:
89 +- Correct pattern code (Python + TypeScript)
90 +- Provider packages table (9 providers)
91 +- ALWAYS rules (4)
92 +- NEVER rules (4)
93 +- Deprecated patterns with markers
94 +- Verification checklist (5 items)
95 +
96 +## Direct execution guardrails content
97 +
98 +The softer guardrails include:
99 +- Note that this page documents the low-level API
100 +- Recommended session pattern code (Python + TypeScript)
101 +- "When to use direct execution" — only when user explicitly asks for it
docs/CLAUDE.md
+5 -2
@@ -18,7 +18,7 @@ docs/
18 ├── app/ # Next.js app router
19 ├── content/ # MDX content
20 │ ├── docs/ # Main documentation
21 -│ ├── examples/ # Example guides
21 +│ ├── cookbooks/ # Cookbooks & guides
22 │ ├── changelog/ # Release notes
23 │ └── reference/ # SDK & API reference
24 ├── components/ # React components
@@ -42,8 +42,9 @@ Detailed documentation for Claude is organized in `.claude/`:
42
43 ### Decisions (ADRs)
44 - [toolkits.md](.claude/decisions/toolkits.md) - Toolkits page implementation
45 -- [examples.md](.claude/decisions/examples.md) - Examples page plan
45 +- [examples.md](.claude/decisions/examples.md) - Examples/cookbooks page plan
46 - [feedback.md](.claude/decisions/feedback.md) - Feedback system
47 +- [llm-guardrails.md](.claude/decisions/llm-guardrails.md) - LLM guardrails system (frontmatter-scoped, pipeline-injected)
48
49 ## Key Rules
50
@@ -62,3 +63,5 @@ Detailed documentation for Claude is organized in `.claude/`:
63 ## AI-Native Documentation
64
65 **Prefer cURL over "click"** - Most docs traffic comes from AI crawlers. When documenting API interactions, prefer showing cURL commands over UI instructions like "click this button" or "navigate to settings". cURL is machine-readable and can be directly executed by AI agents.
66 +
67 +**LLM guardrails** - Every `.md` endpoint appends invisible guardrails steering AI code generators toward the session-based pattern. Controlled via `llmGuardrails` frontmatter field. See [llm-guardrails.md](.claude/decisions/llm-guardrails.md).
docs/app/llms-full.txt/route.ts
+3 -2
@@ -1,4 +1,5 @@
1 import { getLLMText, source, cookbooksSource, referenceSource, toolkitsSource } from '@/lib/source';
2 +import { SESSION_GUARDRAILS } from '@/lib/llm-guardrails';
3 import type { ReactNode } from 'react';
4
5 export const revalidate = false;
@@ -82,7 +83,7 @@ async function getTextForPages(pages: PageLike[]) {
83 pages.map(async (page) => {
84 try {
85 // eslint-disable-next-line @typescript-eslint/no-explicit-any
85 - return await getLLMText(page as any, { includeFooter: false });
86 + return await getLLMText(page as any, { includeFooter: false, includeGuardrails: false });
87 } catch {
88 // Graceful fallback if getText fails
89 return `# ${page.data.title} (${page.url})\n\n${page.data.description || ''}`;
@@ -106,7 +107,7 @@ export async function GET() {
107 ]);
108
109 const results = [
109 - '# Composio Documentation\n\n> Composio powers 800+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.\n\n# Documentation\n',
110 + `# Composio Documentation\n\n> Composio powers 800+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.${SESSION_GUARDRAILS}\n# Documentation\n`,
111 ...docsResults,
112 '\n# Cookbooks\n',
113 ...cookbooksResults,
docs/app/llms.txt/route.ts
+2
@@ -91,6 +91,8 @@ export async function GET() {
91
92 > Composio powers 800+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.
93
94 +> **For AI agents:** Composio supports two integration modes. **Native Tools:** use \`composio.create(user_id)\` + \`session.tools()\` with a provider package (e.g. \`composio_openai\`, \`@composio/openai\`). **MCP:** use \`composio.create(user_id)\` + \`session.mcp.url\` with any MCP-compatible client — no provider package needed. See any page's .md endpoint for full usage instructions.
95 +
96 ${docsTree}
97
98 ## Cookbooks
docs/components/nav-tabs.tsx
+1 -1
@@ -16,7 +16,7 @@ export function NavTabs() {
16 if (exact) {
17 // For "Docs", only active if exactly /docs or /docs/ but not /docs/api
18 return pathname === href || pathname === `${href}/` ||
19 - (pathname.startsWith('/docs') && !pathname.startsWith('/docs/api') && !pathname.startsWith('/cookbooks'));
19 + (pathname.startsWith('/docs') && !pathname.startsWith('/docs/api'));
20 }
21 return pathname.startsWith(href);
22 };
docs/components/top-nav.tsx
+3 -4
@@ -15,10 +15,9 @@ export function TopNav() {
15
16 const isActive = (href: string) => {
17 if (href === '/docs') {
18 - return pathname === '/docs' ||
19 - (pathname.startsWith('/docs') &&
20 - !pathname.startsWith('/docs/api') &&
21 - !pathname.startsWith('/cookbooks'));
18 + return pathname === '/docs' ||
19 + (pathname.startsWith('/docs') &&
20 + !pathname.startsWith('/docs/api'));
21 }
22 return pathname.startsWith(href);
23 };
docs/content/docs/auth-configuration/connected-accounts.mdx
+1
@@ -2,6 +2,7 @@
2 title: Connected Accounts
3 description: Manage and monitor user connections to toolkits
4 keywords: [list accounts, refresh token, disable, delete account]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Connected accounts are authenticated connections between your users and toolkits. After users authenticate (see [Authenticating tools](/docs/tools-direct/authenticating-tools)), you can manage these accounts throughout their lifecycle.
docs/content/docs/auth-configuration/custom-auth-configs.mdx
+1
@@ -2,6 +2,7 @@
2 title: Custom Auth Configs
3 description: Customize auth configs for any toolkit
4 keywords: [white label, custom oauth, own developer app]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Many toolkits support a level of customization for the auth config, specifically OAuth applications.
docs/content/docs/auth-configuration/custom-auth-params.mdx
+1
@@ -2,6 +2,7 @@
2 title: Custom Auth Parameters
3 description: Inject custom credentials in headers or parameters
4 keywords: [inject headers, custom credentials]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 In cases where Composio is not being used for managing the auth but only for the tools, it is possible to use the `beforeExecute` hook to inject custom auth headers or parameters for a toolkit.
docs/content/docs/auth-configuration/programmatic-auth-configs.mdx
+1
@@ -2,6 +2,7 @@
2 title: Programmatic Auth Configs
3 description: Create auth configs programmatically
4 keywords: [create auth config, sdk]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Auth configs are created once and reused many times. However, when managing multiple toolkits, you may want to create auth configs programmatically.
docs/content/docs/tools-direct/authenticating-tools.mdx
+1
@@ -2,6 +2,7 @@
2 title: Authenticating Tools
3 description: Create auth configs and connect user accounts
4 keywords: [oauth, api key, auth config, connect account, credentials]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 The first step in authenticating your users is to create an **Auth Config**. Every toolkit has its own authentication method such as `OAuth`, `API key`, `Basic Auth`, or custom schemes.
docs/content/docs/tools-direct/custom-tools.mdx
+1
@@ -2,6 +2,7 @@
2 title: Creating Custom Tools
3 description: Learn how to extend Composio's toolkits with your own tools
4 keywords: [create tool, custom action, extend, standalone tool]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Custom tools allow you to create your own tools that can be used with Composio.
docs/content/docs/tools-direct/executing-tools.mdx
+1
@@ -2,6 +2,7 @@
2 title: Executing Tools
3 description: Learn how to execute Composio tools with different providers and frameworks
4 keywords: [execute, run, tool calling, function calling, direct execution]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 LLMs on their own can only do generation. Tool calling changes that by letting them interact with external services. Instead of just drafting an email, the model can call `GMAIL_SEND_EMAIL` to actually send it. The tool's results feed back to the LLM, closing the loop so it can decide, act, observe, and adapt.
docs/content/docs/tools-direct/fetching-tools.mdx
+1
@@ -2,6 +2,7 @@
2 title: Fetching tools and schemas
3 description: Fetch and filter tools, and inspect schemas
4 keywords: [get tools, list tools, filter, schema]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Fetch specific tools, filter by permissions or search, and inspect schemas for type information. Tools are automatically formatted for your provider.
docs/content/docs/tools-direct/modify-tool-behavior/after-execution-modifiers.mdx
+1
@@ -1,6 +1,7 @@
1 ---
2 title: After Execution Modifiers
3 description: Transform tool results after execution
4 +llmGuardrails: "direct-execution"
5 ---
6
7 After execution modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
docs/content/docs/tools-direct/modify-tool-behavior/before-execution-modifiers.mdx
+1
@@ -1,6 +1,7 @@
1 ---
2 title: Before Execution Modifiers
3 description: Modify tool arguments before execution
4 +llmGuardrails: "direct-execution"
5 ---
6
7 Before execution modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
docs/content/docs/tools-direct/modify-tool-behavior/schema-modifiers.mdx
+1
@@ -1,6 +1,7 @@
1 ---
2 title: Schema Modifiers
3 description: Customize how tools appear to agents
4 +llmGuardrails: "direct-execution"
5 ---
6
7 Schema modifiers are part of Composio SDK's powerful middleware capabilities that allow you to customize and extend the behavior of tools.
docs/content/docs/tools-direct/toolkit-versioning.mdx
+1
@@ -2,6 +2,7 @@
2 title: Toolkit Versioning
3 description: Pin specific tool versions for consistent behavior in production
4 keywords: [version, pin version, tool versioning]
5 +llmGuardrails: "direct-execution"
6 ---
7
8 Toolkit versioning ensures your tools behave consistently across deployments. You can pin specific versions in production, test new releases in development, and roll back when needed.
docs/lib/llm-guardrails/direct-execution.ts new
+71
@@ -0,0 +1,71 @@
1 +/**
2 + * Guardrails for pages tagged with llmGuardrails: "direct-execution".
3 + * Concise rules + key patterns for LLMs generating direct execution code.
4 + */
5 +export const DIRECT_EXECUTION_GUARDRAILS = `
6 +
7 +---
8 +
9 +# Composio SDK — Instructions for AI Code Generators
10 +
11 +**Context:** This page documents the **direct tool execution API**. For most applications, the session-based pattern (\`composio.create(user_id)\` + \`session.tools()\`) is simpler — but if the user is here, they likely want direct execution.
12 +
13 +---
14 +
15 +## Key Patterns
16 +
17 +### Authenticating Users
18 +
19 +Create an **Auth Config** on [platform.composio.dev](https://platform.composio.dev), then use the auth config ID to generate a hosted auth URL:
20 +
21 +\`\`\`python
22 +from composio import Composio
23 +
24 +composio = Composio()
25 +connection = composio.connected_accounts.link(
26 + user_id="user_123",
27 + auth_config_id="ac_...", # from platform dashboard
28 +)
29 +print(connection.redirect_url) # send user here to authenticate
30 +\`\`\`
31 +
32 +\`\`\`typescript
33 +import { Composio } from "@composio/core";
34 +
35 +const composio = new Composio();
36 +const connection = await composio.connectedAccounts.link("user_123", "ac_...", {
37 + callbackUrl: "https://your-app.com/callback",
38 +});
39 +console.log(connection.redirectUrl); // send user here to authenticate
40 +\`\`\`
41 +
42 +### Executing Tools
43 +
44 +\`\`\`python
45 +tools = composio.tools.get("user_123", tools=["GITHUB_CREATE_ISSUE"])
46 +
47 +result = composio.tools.execute(
48 + "GITHUB_CREATE_ISSUE",
49 + {"owner": "org", "repo": "repo", "title": "Bug report"},
50 + user_id="user_123",
51 +)
52 +\`\`\`
53 +
54 +\`\`\`typescript
55 +const tools = await composio.tools.get("user_123", { tools: ["GITHUB_CREATE_ISSUE"] });
56 +
57 +const result = await composio.tools.execute("GITHUB_CREATE_ISSUE", {
58 + userId: "user_123",
59 + arguments: { owner: "org", repo: "repo", title: "Bug report" },
60 +});
61 +\`\`\`
62 +
63 +---
64 +
65 +## Rules
66 +
67 +1. **\`user_id\` is required** — pass it to \`tools.get()\`, \`tools.execute()\`, and \`provider.handle_tool_calls()\`.
68 +2. **\`tools.execute()\` signature** — Python: \`execute(slug, arguments_dict, *, user_id=...)\` (arguments is the second positional param). TypeScript: \`execute(slug, { userId, arguments })\`.
69 +3. **Provider at init** — \`Composio(provider=OpenAIProvider())\` in Python, \`new Composio({ provider: new OpenAIProvider() })\` in TypeScript. Defaults to OpenAI if omitted.
70 +4. **Correct provider imports** — \`composio_<provider>\` for Python, \`@composio/<provider>\` for TypeScript. For OpenAI Agents SDK use \`composio_openai_agents\` / \`@composio/openai-agents\`.
71 +`;
docs/lib/llm-guardrails/index.ts new
+26
@@ -0,0 +1,26 @@
1 +/**
2 + * LLM guardrails — appended to .md responses by getLLMText().
3 + *
4 + * Pages opt into a guardrail set via frontmatter:
5 + * llmGuardrails: "direct-execution" | "none"
6 + *
7 + * No frontmatter (default) → session guardrails.
8 + */
9 +
10 +import { SESSION_GUARDRAILS } from './session';
11 +import { DIRECT_EXECUTION_GUARDRAILS } from './direct-execution';
12 +
13 +type GuardrailType = 'direct-execution' | 'none' | undefined;
14 +
15 +export function getGuardrails(type: GuardrailType): string {
16 + switch (type) {
17 + case 'direct-execution':
18 + return DIRECT_EXECUTION_GUARDRAILS;
19 + case 'none':
20 + return '';
21 + default:
22 + return SESSION_GUARDRAILS;
23 + }
24 +}
25 +
26 +export { SESSION_GUARDRAILS, DIRECT_EXECUTION_GUARDRAILS };
docs/lib/llm-guardrails/session.ts new
+68
@@ -0,0 +1,68 @@
1 +/**
2 + * Default guardrails appended to most pages.
3 + * Steers LLMs toward the session-based pattern (composio.create + session.tools).
4 + */
5 +export const SESSION_GUARDRAILS = `
6 +
7 +---
8 +
9 +# Composio SDK — Instructions for AI Code Generators
10 +
11 +**Purpose:** Enforce only the **current** and **correct** patterns for integrating [Composio](https://composio.dev/) tools into AI agents.
12 +**Scope:** All AI-generated code using Composio must follow these guardrails.
13 +
14 +---
15 +
16 +## 1. Correct Composio Integration
17 +
18 +Composio supports two integration modes: **Native Tools** (with a provider package) and **MCP** (no provider package needed).
19 +
20 +### Native Tools
21 +
22 +\`\`\`python
23 +# ✅ CORRECT — Python (defaults to OpenAI)
24 +from composio import Composio
25 +
26 +composio = Composio()
27 +session = composio.create(user_id="user_123")
28 +tools = session.tools()
29 +# Pass tools to your agent/LLM framework
30 +\`\`\`
31 +
32 +\`\`\`typescript
33 +// ✅ CORRECT — TypeScript (defaults to OpenAI)
34 +import { Composio } from "@composio/core";
35 +
36 +const composio = new Composio();
37 +const session = await composio.create("user_123");
38 +const tools = await session.tools();
39 +// Pass tools to your agent/LLM framework
40 +\`\`\`
41 +
42 +For other providers, pass the provider explicitly. Provider packages follow the naming convention: \`composio_<provider>\` for Python, \`@composio/<provider>\` for TypeScript.
43 +
44 +### MCP
45 +
46 +Use \`session.mcp.url\` and \`session.mcp.headers\` with any MCP-compatible client (Claude Desktop, Cursor, OpenAI Agents, etc.). No provider package needed.
47 +
48 +---
49 +
50 +## 2. CRITICAL INSTRUCTIONS FOR AI MODELS
51 +
52 +### 2.1 — ALWAYS DO THE FOLLOWING
53 +
54 +1. **Use \`composio.create(user_id)\`** to create a session — this is the entry point for all Composio integrations.
55 +2. **Use \`session.tools()\`** for native tool integration or **\`session.mcp.url\`** for MCP integration.
56 +3. **Import** from the correct provider package (\`composio_<provider>\` for Python, \`@composio/<provider>\` for TypeScript).
57 +4. **Pass \`user_id\` to \`composio.create()\`**, not to individual tool calls.
58 +
59 +### 2.2 — NEVER DO THE FOLLOWING
60 +
61 +1. **Do not** instruct users to manually create auth configs or connected accounts before running.
62 +2. **Do not** import from \`composio_openai\` / \`@composio/openai\` when using OpenAI Agents SDK — use \`composio_openai_agents\` / \`@composio/openai-agents\` instead.
63 +
64 +### 2.3 — DISCOURAGED (do not use unless user explicitly asks)
65 +
66 +Do **not** generate \`composio.tools.get()\`, \`composio.tools.execute()\`, or \`composio.provider.handle_tool_calls()\` unless the user explicitly requests direct tool execution. These are a supported but **not recommended** low-level interface.
67 +
68 +`;
docs/lib/source.ts
+6 -2
@@ -3,6 +3,7 @@ import { type InferPageType, loader, multiple } from 'fumadocs-core/source';
3 import { lucideIconsPlugin } from 'fumadocs-core/source/lucide-icons';
4 import { openapi } from './openapi';
5 import { openapiSource, openapiPlugin } from 'fumadocs-openapi/server';
6 +import { getGuardrails } from './llm-guardrails';
7
8 /**
9 * Transformer to set defaultOpen: true for specific folders in the reference sidebar.
@@ -317,8 +318,9 @@ function stripTwoslashFromCodeBlocks(content: string): string {
318 });
319 }
320
320 -export async function getLLMText(page: InferPageType<typeof source>, options?: { includeFooter?: boolean }) {
321 +export async function getLLMText(page: InferPageType<typeof source>, options?: { includeFooter?: boolean; includeGuardrails?: boolean }) {
322 const includeFooter = options?.includeFooter ?? true;
323 + const includeGuardrails = options?.includeGuardrails ?? true;
324 // Fall back to description if getText is not available
325 if (typeof page.data.getText !== 'function') {
326 return `# ${page.data.title} (${page.url})
@@ -353,9 +355,11 @@ ${page.data.description || ''}`;
355 ? `\n\n---\n\n📚 **More documentation:** [View all docs](https://docs.composio.dev/llms.txt) | [Cookbooks](https://docs.composio.dev/llms.mdx/cookbooks) | [API Reference](https://docs.composio.dev/llms.mdx/reference)`
356 : '';
357
358 + const guardrails = includeGuardrails ? getGuardrails(page.data.llmGuardrails) : '';
359 +
360 return `# ${page.data.title} (${page.url})
361
358 -${cleanContent}${footer}`;
362 +${cleanContent}${footer}${guardrails}`;
363 }
364
365 export function formatDate(dateStr: string): string {
docs/source.config.ts
+5
@@ -17,6 +17,11 @@ import { z } from 'zod';
17 // Extended schema with keywords for search
18 const docsSchema = frontmatterSchema.extend({
19 keywords: z.array(z.string()).optional(),
20 + /** Controls which LLM guardrail set is appended to the .md output.
21 + * - undefined / omitted → default session-based guardrails
22 + * - "direct-execution" → softer guardrails acknowledging this is the low-level API
23 + * - "none" → no guardrails appended */
24 + llmGuardrails: z.enum(['direct-execution', 'none']).optional(),
25 });
26
27 export const docs = defineDocs({