Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ const TOOL_CATEGORIES: Record<string, ToolName[]> = {
],
Integrations: ['integration', 'integration_batch', 'integration_introspect'],
Data: ['database_schema'],
Other: ['verify_approval', 'request_human_input'],
Other: ['request_human_input'],
};

function categorizeTools(toolNames: string[]) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import { SUPPORTED_TEMPLATE_VARIABLES } from '@/convex/lib/agent_response/resolv
import { STRUCTURED_RESPONSE_INSTRUCTIONS } from '@/convex/lib/agent_response/structured_response_instructions';
import { toId } from '@/convex/lib/type_cast_helpers';
import { useT } from '@/lib/i18n/client';
import { FILE_PREPROCESSING_INSTRUCTIONS } from '@/lib/shared/constants/custom-agents';
import { seo } from '@/lib/utils/seo';

export const Route = createFileRoute(
Expand All @@ -42,7 +41,6 @@ export const Route = createFileRoute(
interface InstructionsFormData {
systemInstructions: string;
modelId: string;
filePreprocessingEnabled: boolean;
structuredResponsesEnabled: boolean;
}

Expand Down Expand Up @@ -98,7 +96,6 @@ function InstructionsTab() {
? {
systemInstructions: agent.systemInstructions,
modelId: initialModelId,
filePreprocessingEnabled: agent.filePreprocessingEnabled ?? false,
structuredResponsesEnabled: agent.structuredResponsesEnabled ?? true,
}
: undefined,
Expand All @@ -117,7 +114,6 @@ function InstructionsTab() {
systemInstructions: data.systemInstructions,
modelPreset,
modelId: data.modelId,
filePreprocessingEnabled: data.filePreprocessingEnabled,
structuredResponsesEnabled: data.structuredResponsesEnabled,
});
},
Expand Down Expand Up @@ -196,34 +192,6 @@ function InstructionsTab() {
/>
</PageSection>

<PageSection
title={t('customAgents.form.sectionFilePreprocessing')}
description={t('customAgents.form.sectionFilePreprocessingDescription')}
>
<Switch
checked={formValues.filePreprocessingEnabled}
onCheckedChange={(checked) => {
form.setValue('filePreprocessingEnabled', checked);
void save({
...form.getValues(),
filePreprocessingEnabled: checked,
});
}}
label={t('customAgents.form.filePreprocessingEnabled')}
description={t('customAgents.form.filePreprocessingEnabledHelp')}
disabled={isReadOnly}
/>
{formValues.filePreprocessingEnabled && (
<CodeBlock
label={t('customAgents.form.filePreprocessingInjectedPrompt')}
copyValue={FILE_PREPROCESSING_INSTRUCTIONS}
copyLabel={t('customAgents.form.copyPrompt')}
>
{FILE_PREPROCESSING_INSTRUCTIONS}
</CodeBlock>
)}
</PageSection>

<PageSection
title={t('customAgents.form.sectionStructuredResponses')}
description={t(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ function ToolsTab() {
const hiddenTools = useMemo(() => {
const hidden = new Set<string>();
hidden.add('rag_search');
if (webSearchMode !== 'off') {
hidden.add('web');
}
hidden.add('web');
return hidden;
}, [webSearchMode]);
}, []);

// Auto-save web search mode
const webModeData = useMemo(() => ({ webSearchMode }), [webSearchMode]);
Expand Down
2 changes: 0 additions & 2 deletions services/platform/convex/_generated/api.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ import type * as agent_tools_integrations_integration_tool from "../agent_tools/
import type * as agent_tools_integrations_internal_actions from "../agent_tools/integrations/internal_actions.js";
import type * as agent_tools_integrations_internal_mutations from "../agent_tools/integrations/internal_mutations.js";
import type * as agent_tools_integrations_types from "../agent_tools/integrations/types.js";
import type * as agent_tools_integrations_verify_approval_tool from "../agent_tools/integrations/verify_approval_tool.js";
import type * as agent_tools_load_convex_tools_as_object from "../agent_tools/load_convex_tools_as_object.js";
import type * as agent_tools_location_internal_mutations from "../agent_tools/location/internal_mutations.js";
import type * as agent_tools_location_mutations from "../agent_tools/location/mutations.js";
Expand Down Expand Up @@ -928,7 +927,6 @@ declare const fullApi: ApiFromModules<{
"agent_tools/integrations/internal_actions": typeof agent_tools_integrations_internal_actions;
"agent_tools/integrations/internal_mutations": typeof agent_tools_integrations_internal_mutations;
"agent_tools/integrations/types": typeof agent_tools_integrations_types;
"agent_tools/integrations/verify_approval_tool": typeof agent_tools_integrations_verify_approval_tool;
"agent_tools/load_convex_tools_as_object": typeof agent_tools_load_convex_tools_as_object;
"agent_tools/location/internal_mutations": typeof agent_tools_location_internal_mutations;
"agent_tools/location/mutations": typeof agent_tools_location_mutations;
Expand Down

This file was deleted.

1 change: 0 additions & 1 deletion services/platform/convex/agent_tools/tool_names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ export const TOOL_NAMES = [
'integration',
'integration_batch',
'integration_introspect',
'verify_approval',
'database_schema',
'request_human_input',
'document_find',
Expand Down
2 changes: 0 additions & 2 deletions services/platform/convex/agent_tools/tool_registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import { requestHumanInputTool } from './human_input/request_human_input_tool';
import { integrationBatchTool } from './integrations/integration_batch_tool';
import { integrationIntrospectTool } from './integrations/integration_introspect_tool';
import { integrationTool } from './integrations/integration_tool';
import { verifyApprovalTool } from './integrations/verify_approval_tool';
import { requestUserLocationTool } from './location/request_user_location_tool';
import { productReadTool } from './products/product_read_tool';
import { ragSearchTool } from './rag/rag_search_tool';
Expand Down Expand Up @@ -61,7 +60,6 @@ export const TOOL_REGISTRY = [
integrationTool,
integrationBatchTool,
integrationIntrospectTool,
verifyApprovalTool,
databaseSchemaTool,
requestHumanInputTool,
documentFindTool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,7 @@ import { jsonRecordValidator } from '../../../lib/shared/schemas/utils/json-valu
import { components, internal } from '../../_generated/api';
import { internalMutation } from '../../_generated/server';
import { createApproval } from '../../approvals/helpers';
import {
createCustomAgentHookHandles,
toSerializableConfig,
} from '../../custom_agents/config';
import { toSerializableConfig } from '../../custom_agents/config';
import { getDefaultAgentRuntimeConfig } from '../../lib/agent_runtime_config';
import { checkOrganizationRateLimit } from '../../lib/rate_limiter/helpers';
import { persistentStreaming } from '../../streaming/helpers';
Expand Down Expand Up @@ -141,11 +138,6 @@ export const triggerWorkflowCompletionResponse = internalMutation({
});
}

const hooks = await createCustomAgentHookHandles(
ctx,
chatAgent.filePreprocessingEnabled,
);

await ctx.scheduler.runAfter(
0,
internal.lib.agent_chat.internal_actions.runAgentGeneration,
Expand All @@ -156,7 +148,6 @@ export const triggerWorkflowCompletionResponse = internalMutation({
provider,
debugTag: `[Agent:${chatAgent.name}:WorkflowComplete]`,
enableStreaming: true,
hooks,
threadId,
organizationId,
promptMessage: messageContent,
Expand Down
3 changes: 0 additions & 3 deletions services/platform/convex/agents/integration/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ You do not access the internal customer/product database — for that, the user
- integration: Execute a single operation on an integration
- integration_batch: Execute multiple parallel read operations
- integration_introspect: Discover available integrations and their operations
- verify_approval: Verify approval card was created

**INTEGRATION NAMES**
Only use integrations listed in "## Available Integrations". Never guess names.
Expand Down Expand Up @@ -109,7 +108,6 @@ Your workflow for write operations:
Understanding the response:
- \`requiresApproval: true\` + \`approvalId\` = SUCCESS! Approval card was created
- \`approvalCreated: true\` = Confirmation that card exists
- You can optionally call \`verify_approval(approvalId)\` to double-check it exists

CRITICAL RULES:
- NEVER call write operations without ALL required parameter values
Expand All @@ -133,7 +131,6 @@ export function createIntegrationAgent(options?: {
'integration',
'integration_batch',
'integration_introspect',
'verify_approval',
];

debugLog('createIntegrationAgent', {
Expand Down
40 changes: 3 additions & 37 deletions services/platform/convex/custom_agents/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,16 @@
* - 'advanced' → OPENAI_CODING_MODEL
*/

import { createFunctionHandle, makeFunctionReference } from 'convex/server';

import type { Doc } from '../_generated/dataModel';
import type { MutationCtx } from '../_generated/server';
import type { ToolName } from '../agent_tools/tool_names';
import type {
AgentHooksConfig,
SerializableAgentConfig,
} from '../lib/agent_chat/types';
import type { SerializableAgentConfig } from '../lib/agent_chat/types';

import { FILE_PREPROCESSING_INSTRUCTIONS } from '../../lib/shared/constants/custom-agents';
import {
getCodingModelOrThrow,
getDefaultModel,
getFastModel,
} from '../lib/agent_runtime_config';

const beforeGenerateHookRef = makeFunctionReference<'action'>(
'lib/agent_chat/internal_actions:beforeGenerateHook',
);

function resolveModel(agent: Doc<'customAgents'>): string {
if (agent.modelId) return agent.modelId;

Expand All @@ -47,20 +36,14 @@ function resolveModel(agent: Doc<'customAgents'>): string {
export function toSerializableConfig(
agent: Doc<'customAgents'>,
): SerializableAgentConfig {
const instructions = agent.filePreprocessingEnabled
? [agent.systemInstructions, FILE_PREPROCESSING_INSTRUCTIONS]
.filter(Boolean)
.join('\n\n')
: agent.systemInstructions;

const knowledgeMode =
agent.knowledgeMode ?? (agent.knowledgeEnabled ? 'tool' : 'off');
const webSearchMode =
agent.webSearchMode ?? (agent.toolNames.includes('web') ? 'tool' : 'off');

return {
name: agent.isSystemDefault ? agent.name : `custom:${agent.name}`,
instructions,
name: `${agent.name}:v${agent.versionNumber}`,
instructions: agent.systemInstructions,
// oxlint-disable-next-line typescript/no-unsafe-type-assertion -- toolNames are filtered via filterValidToolNames() on insert; always valid ToolName values
convexToolNames: agent.toolNames as ToolName[],
integrationBindings: agent.integrationBindings,
Expand All @@ -84,20 +67,3 @@ export function toSerializableConfig(
outputReserve: agent.outputReserve,
};
}

/**
* Create FunctionHandles for custom agent file preprocessing hooks.
* Returns undefined when file preprocessing is disabled.
*/
export async function createCustomAgentHookHandles(
_ctx: MutationCtx,
filePreprocessingEnabled: boolean | undefined,
): Promise<AgentHooksConfig | undefined> {
if (!filePreprocessingEnabled) {
return undefined;
}

const beforeGenerate = await createFunctionHandle(beforeGenerateHookRef);

return { beforeGenerate };
}
2 changes: 0 additions & 2 deletions services/platform/convex/custom_agents/mutations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const agentFieldsValidator = {
knowledgeEnabled: v.optional(v.boolean()),
includeOrgKnowledge: v.optional(v.boolean()),
knowledgeTopK: v.optional(v.number()),
filePreprocessingEnabled: v.optional(v.boolean()),
structuredResponsesEnabled: v.optional(v.boolean()),
teamId: v.optional(v.string()),
delegateAgentIds: v.optional(v.array(v.id('customAgents'))),
Expand Down Expand Up @@ -343,7 +342,6 @@ export const updateCustomAgent = mutation({
includeOrgKnowledge: v.optional(v.boolean()),
includeTeamKnowledge: v.optional(v.boolean()),
knowledgeTopK: v.optional(v.number()),
filePreprocessingEnabled: v.optional(v.boolean()),
structuredResponsesEnabled: v.optional(v.boolean()),
teamId: v.optional(v.string()),
conversationStarters: v.optional(v.array(v.string())),
Expand Down
Loading
Loading