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
8 changes: 4 additions & 4 deletions apps/ui/src/components/instances/AgentConfigForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface AgentConfigFormProps {
export function AgentConfigForm({ instance }: AgentConfigFormProps) {
const [selectedProviderId, setSelectedProviderId] = useState<string | null>(instance.agentProviderId ?? null);
const [selectedAgentId, setSelectedAgentId] = useState<string | null>(instance.agentId ?? null);
const [agentTimeout, setAgentTimeout] = useState(instance.agentTimeout ?? 60);
const [agentTimeout, setAgentTimeout] = useState(instance.agentTimeout ?? 600);
const [streamMode, setStreamMode] = useState(instance.agentStreamMode ?? false);
const [isDirty, setIsDirty] = useState(false);

Expand All @@ -34,7 +34,7 @@ export function AgentConfigForm({ instance }: AgentConfigFormProps) {
const hasChanges =
selectedProviderId !== (instance.agentProviderId ?? null) ||
selectedAgentId !== (instance.agentId ?? null) ||
agentTimeout !== (instance.agentTimeout ?? 60) ||
agentTimeout !== (instance.agentTimeout ?? 600) ||
streamMode !== (instance.agentStreamMode ?? false);
setIsDirty(hasChanges);
}, [selectedProviderId, selectedAgentId, agentTimeout, streamMode, instance]);
Expand Down Expand Up @@ -231,12 +231,12 @@ export function AgentConfigForm({ instance }: AgentConfigFormProps) {
id="agent-timeout"
type="number"
min={10}
max={300}
max={600}
value={agentTimeout}
onChange={(e) => setAgentTimeout(Number(e.target.value))}
className="max-w-[120px]"
/>
<p className="text-xs text-muted-foreground">Maximum time to wait for agent response (10-300 seconds)</p>
<p className="text-xs text-muted-foreground">Maximum time to wait for agent response (10-600 seconds)</p>
</div>

<div className="flex items-center justify-between rounded-lg border p-3">
Expand Down
2 changes: 1 addition & 1 deletion docs/architecture/provider-system.md
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ export const agentProviders = pgTable('agent_providers', {

// Default settings
defaultStream: boolean('default_stream').notNull().default(true),
defaultTimeout: integer('default_timeout').notNull().default(60),
defaultTimeout: integer('default_timeout').notNull().default(600),

// Capabilities (auto-detected or manually set)
supportsStreaming: boolean('supports_streaming').notNull().default(true),
Expand Down
12 changes: 6 additions & 6 deletions packages/api/src/plugins/agent-dispatcher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3427,15 +3427,15 @@ function createAgnoProvider(provider: AgentProvider, instance: DispatchInstance)
schema: provider.schema,
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

const schemaConfig = (provider.schemaConfig ?? {}) as Record<string, unknown>;

return new AgnoAgentProvider(provider.id, provider.name, client, {
agentId: resolveRequiredAgentId(instance, schemaConfig, provider.id),
agentType: (instance.agentType ?? 'agent') as 'agent' | 'team' | 'workflow',
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 60) * 1000,
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 600) * 1000,
enableAutoSplit: instance.enableAutoSplit ?? true,
prefixSenderName: instance.agentPrefixSenderName ?? true,
});
Expand Down Expand Up @@ -3518,12 +3518,12 @@ function createAgUiProviderInstance(provider: AgentProvider, instance: DispatchI
schema: provider.schema,
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

return new AgUiAgentProvider(provider.id, provider.name, client, {
agentId: resolveRequiredAgentId(instance, schemaConfig, provider.id),
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 60) * 1000,
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 600) * 1000,
enableAutoSplit: instance.enableAutoSplit ?? true,
prefixSenderName: instance.agentPrefixSenderName ?? true,
});
Expand All @@ -3541,12 +3541,12 @@ function createA2AProviderInstance(provider: AgentProvider, instance: DispatchIn
schema: provider.schema,
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

return new A2AAgentProvider(provider.id, provider.name, client, {
agentId: resolveRequiredAgentId(instance, schemaConfig, provider.id),
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 60) * 1000,
timeoutMs: (instance.agentTimeout ?? provider.defaultTimeout ?? 600) * 1000,
enableAutoSplit: instance.enableAutoSplit ?? true,
prefixSenderName: instance.agentPrefixSenderName ?? true,
});
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/routes/v2/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const createInstanceSchema = z.object({
name: z.string().min(1).max(255).describe('Unique name for the instance'),
channel: ChannelTypeSchema.describe('Channel type (e.g., whatsapp-baileys, discord)'),
agentId: z.string().uuid().nullable().optional().describe('Agent UUID referencing agents table'),
agentTimeout: z.number().int().positive().default(60).describe('Agent timeout in seconds'),
agentTimeout: z.number().int().positive().default(600).describe('Agent timeout in seconds'),
agentStreamMode: z.boolean().default(false).describe('Enable streaming responses'),
agentReplyFilter: agentReplyFilterSchema.optional().nullable().describe('When agent should reply'),
agentSessionStrategy: z
Expand Down
8 changes: 4 additions & 4 deletions packages/api/src/routes/v2/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const providerBaseSchema = z.object({
'Note: apiKey in schemaConfig overrides the provider-level apiKey.',
),
defaultStream: z.boolean().default(true).describe('Default streaming setting'),
defaultTimeout: z.number().int().positive().default(60).describe('Default timeout in seconds'),
defaultTimeout: z.number().int().positive().default(600).describe('Default timeout in seconds'),
supportsStreaming: z.boolean().default(true).describe('Provider supports streaming'),
supportsImages: z
.boolean()
Expand Down Expand Up @@ -211,7 +211,7 @@ providersRoutes.get('/:id/agents', async (c) => {
const client = createAgnoClient({
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

const allEntries = (await client.discover?.()) ?? [];
Expand Down Expand Up @@ -240,7 +240,7 @@ providersRoutes.get('/:id/teams', async (c) => {
const client = createAgnoClient({
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

const allEntries = (await client.discover?.()) ?? [];
Expand Down Expand Up @@ -269,7 +269,7 @@ providersRoutes.get('/:id/workflows', async (c) => {
const client = createAgnoClient({
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

const allEntries = (await client.discover?.()) ?? [];
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/schemas/openapi/instances.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const CreateInstanceSchema = z.object({
name: z.string().min(1).max(255).openapi({ description: 'Unique name for the instance' }),
channel: ChannelTypeSchema.openapi({ description: 'Channel type' }),
agentId: z.string().uuid().nullable().optional().openapi({ description: 'Agent UUID (agents table)' }),
agentTimeout: z.number().int().positive().default(60).openapi({ description: 'Agent timeout in seconds' }),
agentTimeout: z.number().int().positive().default(600).openapi({ description: 'Agent timeout in seconds' }),
agentStreamMode: z.boolean().default(false).openapi({ description: 'Enable streaming responses' }),
isDefault: z.boolean().default(false).openapi({ description: 'Set as default instance for channel' }),
token: z.string().optional().openapi({ description: 'Bot token for Discord instances' }),
Expand Down
2 changes: 1 addition & 1 deletion packages/api/src/schemas/openapi/providers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const CreateProviderSchema = z.object({
example: { projectPath: '/home/user/my-project', model: 'claude-haiku-4-5-20251001', maxTurns: 5 },
}),
defaultStream: z.boolean().default(true).openapi({ description: 'Default streaming' }),
defaultTimeout: z.number().int().positive().default(60).openapi({ description: 'Default timeout' }),
defaultTimeout: z.number().int().positive().default(600).openapi({ description: 'Default timeout' }),
supportsStreaming: z.boolean().default(true).openapi({ description: 'Supports streaming' }),
supportsImages: z
.boolean()
Expand Down
6 changes: 3 additions & 3 deletions packages/api/src/services/agent-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ export class AgentRunnerService {
schema: provider.schema,
baseUrl: provider.baseUrl,
apiKey: provider.apiKey,
defaultTimeoutMs: (provider.defaultTimeout ?? 60) * 1000,
defaultTimeoutMs: (provider.defaultTimeout ?? 600) * 1000,
});

// Cache it
Expand Down Expand Up @@ -465,7 +465,7 @@ export class AgentRunnerService {
name: chatName,
participantCount,
},
timeoutMs: (instance.agentTimeout ?? 60) * 1000,
timeoutMs: (instance.agentTimeout ?? 600) * 1000,
files,
};

Expand Down Expand Up @@ -589,7 +589,7 @@ export class AgentRunnerService {
name: chatName,
participantCount,
},
timeoutMs: (instance.agentTimeout ?? 60) * 1000,
timeoutMs: (instance.agentTimeout ?? 600) * 1000,
};

// Client routes by agentType internally
Expand Down
4 changes: 2 additions & 2 deletions packages/api/src/trpc/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const appRouter = t.router({
channel: ChannelTypeSchema,
agentProviderId: z.string().uuid().optional(),
agentId: z.string().max(255).default('default'),
agentTimeout: z.number().int().positive().default(60),
agentTimeout: z.number().int().positive().default(600),
agentStreamMode: z.boolean().default(false),
isDefault: z.boolean().default(false),
}),
Expand Down Expand Up @@ -336,7 +336,7 @@ export const appRouter = t.router({
apiKey: z.string().optional(),
schemaConfig: z.record(z.string(), z.unknown()).optional(),
defaultStream: z.boolean().default(true),
defaultTimeout: z.number().int().positive().default(60),
defaultTimeout: z.number().int().positive().default(600),
}),
)
.mutation(async ({ ctx, input }) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/schemas/instance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export const CreateAgentProviderSchema = z.object({
apiKey: z.string().optional(),
schemaConfig: MetadataSchema.optional(),
defaultStream: z.boolean().default(true),
defaultTimeout: z.number().int().positive().default(60),
defaultTimeout: z.number().int().positive().default(600),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The default agent timeout value of 600 is hardcoded in multiple schemas, database definitions, and runtime fallbacks across the codebase. To prevent code duplication and make future updates easier, consider defining a shared constant (e.g., DEFAULT_AGENT_TIMEOUT_SECONDS = 600) in a central location like packages/core and importing it where needed.

supportsStreaming: z.boolean().default(true),
supportsImages: z.boolean().default(false),
supportsAudio: z.boolean().default(false),
Expand Down Expand Up @@ -151,7 +151,7 @@ export const CreateInstanceSchema = z.object({
name: z.string().max(255),
channel: ChannelTypeSchema,
agentId: z.string().uuid().nullable().optional(),
agentTimeout: z.number().int().positive().default(60),
agentTimeout: z.number().int().positive().default(600),
agentStreamMode: z.boolean().default(false),
isDefault: z.boolean().default(false),
});
Expand Down
4 changes: 2 additions & 2 deletions packages/db/src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ export const agentProviders = pgTable(

// Default settings
defaultStream: boolean('default_stream').notNull().default(true),
defaultTimeout: integer('default_timeout').notNull().default(60),
defaultTimeout: integer('default_timeout').notNull().default(600),

// Capabilities (auto-detected or manually set)
supportsStreaming: boolean('supports_streaming').notNull().default(true),
Expand Down Expand Up @@ -690,7 +690,7 @@ export const instances = pgTable(
agentId: uuid('agent_id').references(() => agents.id, { onDelete: 'set null' }),

// ---- Agent Configuration (Instance Override) ----
agentTimeout: integer('agent_timeout').notNull().default(60),
agentTimeout: integer('agent_timeout').notNull().default(600),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add a migration for timeout defaults

Changing the Drizzle schema default here does not update the actual Postgres defaults on existing deployments: the checked-in migrations still create instances.agent_timeout and agent_providers.default_timeout with DEFAULT 60, and this commit does not add an ALTER TABLE ... SET DEFAULT 600 migration. Any insert path that relies on the database default (for example service/direct Drizzle inserts with the timeout omitted, or operational SQL) will continue creating 60-second timeouts after migration, so the promoted default is only partially applied.

Useful? React with 👍 / 👎.

agentStreamMode: boolean('agent_stream_mode').notNull().default(false),
/** When agent should reply to messages */
agentReplyFilter: jsonb('agent_reply_filter').$type<AgentReplyFilter>(),
Expand Down
Loading
Loading