Developer Guide · 16
Extension Development
16.1 Adding a New Tool
- Define factory function with
@tooldecorator inapp/services/tools.py - Inject into Admin Agent toolset in
agent.py::create_user_agent - For Consumer support, conditionally inject by capability in
consumer_agent.py - For channel distinction (like
send_message), inject based onchannelparam inconsumer_agent.create_consumer_agent - Add corresponding capability prompt in
tools.py::CAPABILITY_PROMPTS - For Subagent accessibility, add to
subagents.py::SHARED_TOOL_NAMESorMEMORY_TOOL_NAMES
16.2 Adding a New Route
- Create new module in
app/routes/usingAPIRouter - Register in
app/main.pywithapp.include_router(...) - Admin routes:
Depends(get_current_user); Consumer routes:Depends(get_service_context)
16.3 Adding a New Frontend Page
- Create page component in
frontend/src/pages/ - Add
<Route>infrontend/src/router/index.tsx - For sidebar nav item, add to
settingsNavarray inSettingsLayout - Wrap with
ErrorBoundary(reference:<ErrorBoundary scope="settings">)
16.4 Adding a New API Call
- Add typed function in
frontend/src/services/api.ts - Add type definitions in
frontend/src/types/index.ts
16.5 Adding a New Subagent
- Modify
app/services/subagents.py::DEFAULT_SUBAGENTS(default) or CRUD via/api/subagentsAPI - Select tools from
SHARED_TOOL_NAMES + MEMORY_TOOL_NAMES - Frontend
SubagentManager.tsxadapts automatically (readsavailable_toolsfromGET /api/subagents)
16.6 Adding a New Theme
- Copy a
[data-theme]block infrontend/src/styles/themes.cssand adjust variables - Add
THEMESentry + AntdThemeConfiginthemeContext.tsx - Add new theme to the theme toggle button at the bottom of the sidebar in
AppLayout.tsx
16.7 Adding a New Tauri Command
- Define function with
#[tauri::command]intauri-launcher/src-tauri/src/lib.rs - Register in
invoke_handler!macro - Call in
dist/index.htmlviawindow.__TAURI__.invoke('cmd_name', { args }) - Re-run
npx tauri build