feat: add per-tool configuration options for agents, including deferred loading and allowed callers

- Introduced `tool_options` in agent forms to manage tool behavior.
- Updated tool classification logic to prioritize agent-level configurations.
- Enhanced UI components to support tool deferral functionality.
- Added localization strings for new tool options and actions.
This commit is contained in:
Danny Avila 2026-01-07 20:16:15 -05:00
parent fff9cecad2
commit 4682f0e370
No known key found for this signature in database
GPG key ID: BF31EEB2C5CA0956
9 changed files with 388 additions and 53 deletions

View file

@ -224,6 +224,7 @@ export const defaultAgentFormValues = {
model: '',
model_parameters: {},
tools: [],
tool_options: {},
provider: {},
projectIds: [],
edges: [],

View file

@ -206,6 +206,38 @@ export type SupportContact = {
email?: string;
};
/**
* Specifies who can invoke a tool.
* - 'direct': LLM can call directly
* - 'code_execution': Only callable via programmatic tool calling (PTC)
*/
export type AllowedCaller = 'direct' | 'code_execution';
/**
* Per-tool configuration options stored at the agent level.
* Keyed by tool_id (e.g., "search_mcp_github").
*/
export type ToolOptions = {
/**
* If true, the tool uses deferred loading (discoverable via tool search).
* @default false
*/
defer_loading?: boolean;
/**
* Specifies who can invoke this tool.
* - 'direct': LLM can call directly (default behavior)
* - 'code_execution': Only callable via PTC sandbox
* @default ['direct']
*/
allowed_callers?: AllowedCaller[];
};
/**
* Map of tool_id to its configuration options.
* Used to customize tool behavior per agent.
*/
export type AgentToolOptions = Record<string, ToolOptions>;
export type Agent = {
_id?: string;
id: string;
@ -241,6 +273,8 @@ export type Agent = {
version?: number;
category?: string;
support_contact?: SupportContact;
/** Per-tool configuration options (deferred loading, allowed callers, etc.) */
tool_options?: AgentToolOptions;
};
export type TAgentsMap = Record<string, Agent | undefined>;
@ -265,6 +299,7 @@ export type AgentCreateParams = {
| 'recursion_limit'
| 'category'
| 'support_contact'
| 'tool_options'
>;
export type AgentUpdateParams = {
@ -291,6 +326,7 @@ export type AgentUpdateParams = {
| 'recursion_limit'
| 'category'
| 'support_contact'
| 'tool_options'
>;
export type AgentListParams = {