n8n
Version:
n8n Workflow Automation Tool
251 lines (250 loc) • 8.62 kB
TypeScript
import { type AgentConfigValidationResponse, UpdateAgentConfigDto } from '@n8n/api-types';
import type { AuthenticatedRequest } from '@n8n/db';
import type { Response } from 'express';
import { AgentConfigService } from './agent-config.service';
import { AgentCustomToolsService } from './agent-custom-tools.service';
import { AgentValidationService } from './agent-validation.service';
import { AgentRepository } from './repositories/agent.repository';
import { CredentialsService } from '../../credentials/credentials.service';
export declare class AgentsConfigController {
private readonly agentConfigService;
private readonly agentCustomToolsService;
private readonly agentValidationService;
private readonly credentialsService;
private readonly agentRepository;
constructor(agentConfigService: AgentConfigService, agentCustomToolsService: AgentCustomToolsService, agentValidationService: AgentValidationService, credentialsService: CredentialsService, agentRepository: AgentRepository);
getConfig(req: AuthenticatedRequest<{
projectId: string;
agentId: string;
}>): Promise<{
name: string;
model: string;
credential?: string | undefined;
instructions: string;
personalisation?: {
icon: string;
gradient: {
from: string;
to: string;
angle: number;
fromStop: number;
toStop: number;
};
} | undefined;
memory?: {
enabled: boolean;
storage: "n8n";
observationalMemory?: {
enabled?: boolean | undefined;
observerModel?: {
model: string;
credential: string;
} | undefined;
reflectorModel?: {
model: string;
credential: string;
} | undefined;
observerThresholdTokens?: number | undefined;
reflectorThresholdTokens?: number | undefined;
renderTokenBudget?: number | undefined;
observationLogTailLimit?: number | undefined;
lockTtlMs?: number | undefined;
} | undefined;
episodicMemory?: {
enabled: false;
} | {
enabled: true;
credential: string;
extractorModel?: {
model: string;
credential: string;
} | undefined;
reflectorModel?: {
model: string;
credential: string;
} | undefined;
topK?: number | undefined;
maxEntriesPerRun?: number | undefined;
} | undefined;
} | undefined;
subAgents?: {
maxChildren?: number | undefined;
agents?: {
agentId: string;
useWhen?: string | undefined;
}[] | undefined;
modelsByDifficulty?: {
low?: {
model: string;
credential: string;
} | undefined;
medium?: {
model: string;
credential: string;
} | undefined;
high?: {
model: string;
credential: string;
} | undefined;
} | undefined;
} | undefined;
tools?: ({
type: "custom";
id: string;
requireApproval?: boolean | undefined;
} | {
type: "workflow";
workflow: string;
name?: string | undefined;
description?: string | undefined;
requireApproval?: boolean | undefined;
allOutputs?: boolean | undefined;
} | {
type: "node";
name: string;
description?: string | undefined;
inputSchema?: undefined;
node: {
nodeType: string;
nodeTypeVersion: number;
nodeParameters: Record<string, unknown>;
credentials?: Record<string, {
id: string;
name: string;
}> | undefined;
};
requireApproval?: boolean | undefined;
})[] | undefined;
skills?: {
type: "skill";
id: string;
}[] | undefined;
tasks?: {
type: "task";
id: string;
enabled: boolean;
}[] | undefined;
providerTools?: Record<string, Record<string, unknown>> | undefined;
integrations?: ({
type: "telegram";
credentialId: string;
settings?: {
accessMode: "private" | "public";
allowedUsers: string[];
} | undefined;
} | {
type: "slack";
credentialId: string;
} | {
type: "linear";
credentialId: string;
})[] | undefined;
mcpServers?: {
name: string;
description?: string | undefined;
url: string;
transport: "sse" | "streamableHttp";
authentication: string;
credential?: string | undefined;
metadata?: {
nodeTypeName?: string | undefined;
} | undefined;
toolFilter?: {
mode: "allow";
tools: string[];
} | {
mode: "exclude";
tools: string[];
} | undefined;
approval?: {
mode: "global";
} | {
mode: "selected";
tools: string[];
} | undefined;
connectionTimeoutMs?: number | undefined;
}[] | undefined;
vectorStores?: ({
name: string;
credential: string;
useWhen: string;
embedding: {
model: string;
credential: string;
};
provider: "pinecone";
indexName: string;
namespace?: string | undefined;
} | {
name: string;
credential: string;
useWhen: string;
embedding: {
model: string;
credential: string;
};
provider: "qdrant";
collectionName: string;
} | {
name: string;
credential: string;
useWhen: string;
embedding: {
model: string;
credential: string;
};
provider: "supabase";
tableName: string;
queryName?: string | undefined;
} | {
name: string;
credential: string;
useWhen: string;
embedding: {
model: string;
credential: string;
};
provider: "postgres";
tableName: string;
})[] | undefined;
config?: {
thinking?: {
provider: "anthropic" | "openai";
budgetTokens?: number | undefined;
reasoningEffort?: string | undefined;
} | undefined;
promptCaching?: {
enabled: boolean;
anthropic?: {
ttl?: "1h" | "5m" | undefined;
} | undefined;
} | undefined;
webSearch?: {
enabled: boolean;
provider?: "auto" | "brave" | "native" | "searxng" | undefined;
credential?: string | undefined;
} | undefined;
toolCallConcurrency?: number | undefined;
maxIterations?: number | undefined;
} | undefined;
}>;
getValidation(req: AuthenticatedRequest<{
projectId: string;
agentId: string;
}>): Promise<AgentConfigValidationResponse>;
putConfig(req: AuthenticatedRequest<{
projectId: string;
agentId: string;
}>, _res: Response, agentId: string, payload: UpdateAgentConfigDto): Promise<{
config: import("@n8n/api-types").AgentJsonConfig;
updatedAt: string;
versionId: string | null;
}>;
deleteTool(req: AuthenticatedRequest<{
projectId: string;
agentId: string;
toolId: string;
}>, _res: Response, agentId: string, toolId: string): Promise<{
ok: boolean;
}>;
}