@exulu/backend 1.48.2 → 1.49.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +351 -42
- package/dist/index.d.cts +96 -1
- package/dist/index.d.ts +96 -1
- package/dist/index.js +340 -38
- package/ee/{markdown.ts → chunking/markdown.ts} +2 -2
- package/ee/python/README.md +295 -0
- package/ee/python/documents/processing/README.md +155 -0
- package/ee/{documents → python/documents}/processing/doc_processor.ts +25 -17
- package/ee/{documents/processing/pdf_to_markdown.py → python/documents/processing/document_to_markdown.py} +3 -10
- package/ee/python/setup.sh +180 -0
- package/package.json +14 -3
- package/scripts/postinstall.cjs +149 -0
- package/.agents/skills/mintlify/SKILL.md +0 -347
- package/.editorconfig +0 -15
- package/.eslintrc.json +0 -52
- package/.github/workflows/release-backend.yml +0 -38
- package/.husky/commit-msg +0 -1
- package/.jscpd.json +0 -18
- package/.mcp.json +0 -25
- package/.nvmrc +0 -1
- package/.prettierignore +0 -5
- package/.prettierrc.json +0 -12
- package/CHANGELOG.md +0 -8
- package/SECURITY.md +0 -5
- package/commitlint.config.js +0 -4
- package/devops/documentation/patch-older-releases.md +0 -42
- package/ee/documents/processing/build_pdf_processor.sh +0 -35
- package/ee/documents/processing/chunk_markdown.py +0 -263
- package/ee/documents/processing/pdf_processor.spec +0 -115
- package/eslint.config.js +0 -88
- package/jest.config.ts +0 -25
- package/mintlify-docs/.mintignore +0 -7
- package/mintlify-docs/AGENTS.md +0 -33
- package/mintlify-docs/CLAUDE.MD +0 -50
- package/mintlify-docs/CONTRIBUTING.md +0 -32
- package/mintlify-docs/LICENSE +0 -21
- package/mintlify-docs/README.md +0 -55
- package/mintlify-docs/ai-tools/claude-code.mdx +0 -43
- package/mintlify-docs/ai-tools/cursor.mdx +0 -39
- package/mintlify-docs/ai-tools/windsurf.mdx +0 -39
- package/mintlify-docs/api-reference/core-types/agent-types.mdx +0 -110
- package/mintlify-docs/api-reference/core-types/analytics-types.mdx +0 -95
- package/mintlify-docs/api-reference/core-types/configuration-types.mdx +0 -83
- package/mintlify-docs/api-reference/core-types/evaluation-types.mdx +0 -106
- package/mintlify-docs/api-reference/core-types/job-types.mdx +0 -135
- package/mintlify-docs/api-reference/core-types/overview.mdx +0 -73
- package/mintlify-docs/api-reference/core-types/prompt-types.mdx +0 -102
- package/mintlify-docs/api-reference/core-types/rbac-types.mdx +0 -163
- package/mintlify-docs/api-reference/core-types/session-types.mdx +0 -77
- package/mintlify-docs/api-reference/core-types/user-management.mdx +0 -112
- package/mintlify-docs/api-reference/core-types/workflow-types.mdx +0 -88
- package/mintlify-docs/api-reference/core-types.mdx +0 -585
- package/mintlify-docs/api-reference/dynamic-types.mdx +0 -851
- package/mintlify-docs/api-reference/endpoint/create.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/delete.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/get.mdx +0 -4
- package/mintlify-docs/api-reference/endpoint/webhook.mdx +0 -4
- package/mintlify-docs/api-reference/introduction.mdx +0 -661
- package/mintlify-docs/api-reference/mutations.mdx +0 -1012
- package/mintlify-docs/api-reference/openapi.json +0 -217
- package/mintlify-docs/api-reference/queries.mdx +0 -1154
- package/mintlify-docs/backend/introduction.mdx +0 -218
- package/mintlify-docs/changelog.mdx +0 -387
- package/mintlify-docs/community-edition.mdx +0 -304
- package/mintlify-docs/core/exulu-agent/api-reference.mdx +0 -894
- package/mintlify-docs/core/exulu-agent/configuration.mdx +0 -690
- package/mintlify-docs/core/exulu-agent/introduction.mdx +0 -552
- package/mintlify-docs/core/exulu-app/api-reference.mdx +0 -481
- package/mintlify-docs/core/exulu-app/configuration.mdx +0 -319
- package/mintlify-docs/core/exulu-app/introduction.mdx +0 -117
- package/mintlify-docs/core/exulu-authentication.mdx +0 -810
- package/mintlify-docs/core/exulu-chunkers/api-reference.mdx +0 -1011
- package/mintlify-docs/core/exulu-chunkers/configuration.mdx +0 -596
- package/mintlify-docs/core/exulu-chunkers/introduction.mdx +0 -403
- package/mintlify-docs/core/exulu-context/api-reference.mdx +0 -911
- package/mintlify-docs/core/exulu-context/configuration.mdx +0 -648
- package/mintlify-docs/core/exulu-context/introduction.mdx +0 -394
- package/mintlify-docs/core/exulu-database.mdx +0 -811
- package/mintlify-docs/core/exulu-default-agents.mdx +0 -545
- package/mintlify-docs/core/exulu-eval/api-reference.mdx +0 -772
- package/mintlify-docs/core/exulu-eval/configuration.mdx +0 -680
- package/mintlify-docs/core/exulu-eval/introduction.mdx +0 -459
- package/mintlify-docs/core/exulu-logging.mdx +0 -464
- package/mintlify-docs/core/exulu-otel.mdx +0 -670
- package/mintlify-docs/core/exulu-queues/api-reference.mdx +0 -648
- package/mintlify-docs/core/exulu-queues/configuration.mdx +0 -650
- package/mintlify-docs/core/exulu-queues/introduction.mdx +0 -474
- package/mintlify-docs/core/exulu-reranker/api-reference.mdx +0 -630
- package/mintlify-docs/core/exulu-reranker/configuration.mdx +0 -663
- package/mintlify-docs/core/exulu-reranker/introduction.mdx +0 -516
- package/mintlify-docs/core/exulu-tool/api-reference.mdx +0 -723
- package/mintlify-docs/core/exulu-tool/configuration.mdx +0 -805
- package/mintlify-docs/core/exulu-tool/introduction.mdx +0 -539
- package/mintlify-docs/core/exulu-variables/api-reference.mdx +0 -699
- package/mintlify-docs/core/exulu-variables/configuration.mdx +0 -736
- package/mintlify-docs/core/exulu-variables/introduction.mdx +0 -511
- package/mintlify-docs/development.mdx +0 -94
- package/mintlify-docs/docs.json +0 -248
- package/mintlify-docs/enterprise-edition.mdx +0 -538
- package/mintlify-docs/essentials/code.mdx +0 -35
- package/mintlify-docs/essentials/images.mdx +0 -59
- package/mintlify-docs/essentials/markdown.mdx +0 -88
- package/mintlify-docs/essentials/navigation.mdx +0 -87
- package/mintlify-docs/essentials/reusable-snippets.mdx +0 -110
- package/mintlify-docs/essentials/settings.mdx +0 -318
- package/mintlify-docs/favicon.svg +0 -3
- package/mintlify-docs/frontend/introduction.mdx +0 -39
- package/mintlify-docs/getting-started.mdx +0 -267
- package/mintlify-docs/guides/custom-agent.mdx +0 -608
- package/mintlify-docs/guides/first-agent.mdx +0 -315
- package/mintlify-docs/images/admin_ui.png +0 -0
- package/mintlify-docs/images/contexts.png +0 -0
- package/mintlify-docs/images/create_agents.png +0 -0
- package/mintlify-docs/images/evals.png +0 -0
- package/mintlify-docs/images/graphql.png +0 -0
- package/mintlify-docs/images/graphql_api.png +0 -0
- package/mintlify-docs/images/hero-dark.png +0 -0
- package/mintlify-docs/images/hero-light.png +0 -0
- package/mintlify-docs/images/hero.png +0 -0
- package/mintlify-docs/images/knowledge_sources.png +0 -0
- package/mintlify-docs/images/mcp.png +0 -0
- package/mintlify-docs/images/scaling.png +0 -0
- package/mintlify-docs/index.mdx +0 -411
- package/mintlify-docs/logo/dark.svg +0 -9
- package/mintlify-docs/logo/light.svg +0 -9
- package/mintlify-docs/partners.mdx +0 -558
- package/mintlify-docs/products.mdx +0 -77
- package/mintlify-docs/snippets/snippet-intro.mdx +0 -4
- package/mintlify-docs/styles.css +0 -207
- package/ngrok.bash +0 -1
- package/ngrok.md +0 -6
- package/ngrok.yml +0 -10
- package/release.config.cjs +0 -15
- package/skills-lock.json +0 -10
- package/types/context-processor.ts +0 -45
- package/types/enums/eval-types.ts +0 -5
- package/types/enums/field-types.ts +0 -1
- package/types/enums/jobs.ts +0 -11
- package/types/enums/statistics.ts +0 -13
- package/types/exulu-table-definition.ts +0 -79
- package/types/file-types.ts +0 -18
- package/types/models/agent-session.ts +0 -27
- package/types/models/agent.ts +0 -68
- package/types/models/context.ts +0 -53
- package/types/models/embedding.ts +0 -17
- package/types/models/eval-run.ts +0 -40
- package/types/models/exulu-agent-tool-config.ts +0 -11
- package/types/models/item.ts +0 -21
- package/types/models/job.ts +0 -8
- package/types/models/project.ts +0 -16
- package/types/models/rate-limiter-rules.ts +0 -7
- package/types/models/test-case.ts +0 -25
- package/types/models/tool.ts +0 -9
- package/types/models/user-role.ts +0 -12
- package/types/models/user.ts +0 -20
- package/types/models/variable.ts +0 -8
- package/types/models/vector-methods.ts +0 -7
- package/types/provider-config.ts +0 -21
- package/types/queue-config.ts +0 -16
- package/types/rbac-rights-modes.ts +0 -1
- package/types/statistics.ts +0 -20
- package/types/workflow.ts +0 -31
- /package/ee/{documents → python/documents}/THIRD_PARTY_LICENSES/docling.txt +0 -0
- /package/ee/{documents/processing → python}/requirements.txt +0 -0
|
@@ -1,608 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Custom Agents"
|
|
3
|
-
description: "Learn how to create custom agent backends by defining ExuluAgent classes in TypeScript"
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
## Introduction
|
|
7
|
-
|
|
8
|
-
This guide shows you how to create custom agent backends by defining ExuluAgent classes in code. You'll learn about the agent structure, configuration options, provider setup, and how to integrate your custom agents into the Exulu IMP.
|
|
9
|
-
|
|
10
|
-
<iframe
|
|
11
|
-
width="100%"
|
|
12
|
-
height="400"
|
|
13
|
-
src="https://share.descript.com/embed/1sPSgMBDqfN"
|
|
14
|
-
title="Creating a Custom ExuluAgent in Code"
|
|
15
|
-
frameborder="0"
|
|
16
|
-
allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
|
|
17
|
-
allowfullscreen
|
|
18
|
-
></iframe>
|
|
19
|
-
|
|
20
|
-
## Prerequisites
|
|
21
|
-
|
|
22
|
-
Before you begin, ensure you have:
|
|
23
|
-
|
|
24
|
-
- A working Exulu IMP development environment (see [Getting Started](/getting-started))
|
|
25
|
-
- TypeScript and Node.js knowledge
|
|
26
|
-
- An API key for your chosen LLM provider
|
|
27
|
-
- The example repository cloned locally
|
|
28
|
-
|
|
29
|
-
## Understanding Backends vs Agent Instances
|
|
30
|
-
|
|
31
|
-
An important concept to understand:
|
|
32
|
-
|
|
33
|
-
**Backend (ExuluAgent class)**: The code-level definition of a language model + provider combination. This is what you create in TypeScript.
|
|
34
|
-
|
|
35
|
-
**Agent Instance**: A UI-level configuration that uses a backend. Multiple agent instances can share the same backend with different system instructions, tools, and settings.
|
|
36
|
-
|
|
37
|
-
**Example**: You might create one `Claude Sonnet 4.5` backend in code, then create multiple agent instances in the UI like "Customer Service Agent", "Financial Analysis Agent", and "Coding Assistant" - all using the same backend but with different configurations.
|
|
38
|
-
|
|
39
|
-
## Project Structure
|
|
40
|
-
|
|
41
|
-
There's no required structure for organizing your agents, but we recommend this pattern:
|
|
42
|
-
|
|
43
|
-
```
|
|
44
|
-
src/
|
|
45
|
-
├── agents/
|
|
46
|
-
│ ├── index.ts # Central export file
|
|
47
|
-
│ ├── claude-sonnet.ts # Individual agent files
|
|
48
|
-
│ ├── gpt4o.ts
|
|
49
|
-
│ └── gemini.ts
|
|
50
|
-
├── contexts/ # Knowledge base definitions
|
|
51
|
-
├── tools/ # Tool definitions
|
|
52
|
-
├── embedders/ # Embedding model definitions
|
|
53
|
-
└── exulu.ts # Main ExuluApp configuration
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
This structure provides a clean separation of concerns and makes it easy to manage multiple agents.
|
|
57
|
-
|
|
58
|
-
## Step 1: Create an Agent File
|
|
59
|
-
|
|
60
|
-
Navigate to your agents folder and create a new TypeScript file for your agent:
|
|
61
|
-
|
|
62
|
-
```bash
|
|
63
|
-
# In your project root
|
|
64
|
-
cd src/agents
|
|
65
|
-
touch claude-sonnet.ts
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
## Step 2: Define the ExuluAgent Class
|
|
69
|
-
|
|
70
|
-
Open your new file and create an ExuluAgent instance. Here's a complete example:
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
import { ExuluAgent } from '@exulu/backend';
|
|
74
|
-
import { anthropic } from '@ai-sdk/anthropic';
|
|
75
|
-
|
|
76
|
-
export const claudeSonnetAgent = new ExuluAgent({
|
|
77
|
-
// Unique identifier - never change this after creation
|
|
78
|
-
id: 'claude_sonnet_4_5',
|
|
79
|
-
|
|
80
|
-
// Display name (can be changed anytime)
|
|
81
|
-
name: 'Claude Sonnet 4.5',
|
|
82
|
-
|
|
83
|
-
// Provider name
|
|
84
|
-
provider: 'Anthropic',
|
|
85
|
-
|
|
86
|
-
// Description shown in UI
|
|
87
|
-
description: 'Advanced reasoning model powered by Anthropic Claude Sonnet 4.5',
|
|
88
|
-
|
|
89
|
-
// Agent type
|
|
90
|
-
type: 'agent', // 'agent' or 'flow'
|
|
91
|
-
|
|
92
|
-
// Supported capabilities and file types
|
|
93
|
-
capabilities: {
|
|
94
|
-
image: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
|
|
95
|
-
file: ['pdf', 'txt', 'csv'],
|
|
96
|
-
},
|
|
97
|
-
|
|
98
|
-
// Model configuration
|
|
99
|
-
config: {
|
|
100
|
-
name: 'Anthropic Claude Sonnet 4.5',
|
|
101
|
-
|
|
102
|
-
// Optional: code-level custom instructions
|
|
103
|
-
customInstructions: '',
|
|
104
|
-
|
|
105
|
-
// Model factory function
|
|
106
|
-
model: (apiKey: string) => {
|
|
107
|
-
return anthropic(apiKey).languageModel('claude-sonnet-4-5-20250929');
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
});
|
|
111
|
-
```
|
|
112
|
-
|
|
113
|
-
### Understanding the Properties
|
|
114
|
-
|
|
115
|
-
#### `id` (Required, Immutable)
|
|
116
|
-
|
|
117
|
-
A unique string identifier for your agent backend.
|
|
118
|
-
|
|
119
|
-
**Important**: This ID is stored in the database and must never change after creation. Use descriptive names with underscores.
|
|
120
|
-
|
|
121
|
-
```typescript
|
|
122
|
-
// Good IDs
|
|
123
|
-
id: 'claude_sonnet_4_5'
|
|
124
|
-
id: 'gpt_4o_mini'
|
|
125
|
-
id: 'gemini_pro_experimental'
|
|
126
|
-
|
|
127
|
-
// Bad IDs
|
|
128
|
-
id: 'agent1' // Not descriptive
|
|
129
|
-
id: 'claude-sonnet' // Use underscores, not hyphens
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
#### `name` (Required, Mutable)
|
|
133
|
-
|
|
134
|
-
The display name shown in the UI. This can be changed anytime without breaking anything.
|
|
135
|
-
|
|
136
|
-
```typescript
|
|
137
|
-
name: 'Claude Sonnet 4.5' // User-friendly name
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
#### `provider` (Required)
|
|
141
|
-
|
|
142
|
-
The name of the LLM provider.
|
|
143
|
-
|
|
144
|
-
```typescript
|
|
145
|
-
provider: 'Anthropic' // or 'OpenAI', 'Google', 'Azure', etc.
|
|
146
|
-
```
|
|
147
|
-
|
|
148
|
-
#### `description` (Optional)
|
|
149
|
-
|
|
150
|
-
A brief description of what the agent does or what it's optimized for.
|
|
151
|
-
|
|
152
|
-
```typescript
|
|
153
|
-
description: 'Advanced reasoning model with strong coding and analysis capabilities'
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
#### `type` (Required)
|
|
157
|
-
|
|
158
|
-
The agent type. Currently supports:
|
|
159
|
-
|
|
160
|
-
- `'agent'`: Standard conversational agent
|
|
161
|
-
- `'flow'`: Workflow agent (covered in another guide)
|
|
162
|
-
|
|
163
|
-
#### `capabilities` (Optional)
|
|
164
|
-
|
|
165
|
-
Defines which file types and modalities the model supports. This ensures only compatible files are sent to the agent.
|
|
166
|
-
|
|
167
|
-
```typescript
|
|
168
|
-
capabilities: {
|
|
169
|
-
image: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
|
|
170
|
-
file: ['pdf', 'txt', 'csv', 'json', 'md'],
|
|
171
|
-
audio: ['mp3', 'wav'], // If supported
|
|
172
|
-
video: ['mp4', 'mov'], // If supported
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
The IDE will provide TypeScript autocomplete for valid file extensions.
|
|
177
|
-
|
|
178
|
-
#### `config.model` (Required)
|
|
179
|
-
|
|
180
|
-
A factory function that receives an API key and returns a configured language model instance.
|
|
181
|
-
|
|
182
|
-
```typescript
|
|
183
|
-
model: (apiKey: string) => {
|
|
184
|
-
return anthropic(apiKey).languageModel('claude-sonnet-4-5-20250929');
|
|
185
|
-
}
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
## Step 3: Understanding the AI SDK
|
|
189
|
-
|
|
190
|
-
Exulu uses the Vercel AI SDK under the hood, which provides a unified interface for multiple LLM providers.
|
|
191
|
-
|
|
192
|
-
### Supported Providers
|
|
193
|
-
|
|
194
|
-
The AI SDK supports many providers out of the box. Here are some popular ones:
|
|
195
|
-
|
|
196
|
-
**Major Providers**
|
|
197
|
-
- OpenAI
|
|
198
|
-
- Anthropic
|
|
199
|
-
- Google (Generative AI & Vertex AI)
|
|
200
|
-
- Azure OpenAI
|
|
201
|
-
- Amazon Bedrock
|
|
202
|
-
|
|
203
|
-
**Alternative Providers**
|
|
204
|
-
- Groq
|
|
205
|
-
- Together AI
|
|
206
|
-
- Mistral
|
|
207
|
-
- Cohere
|
|
208
|
-
- Fireworks
|
|
209
|
-
- DeepSeek
|
|
210
|
-
- Cerebras
|
|
211
|
-
- Perplexity
|
|
212
|
-
|
|
213
|
-
**Local/Self-hosted**
|
|
214
|
-
- Ollama
|
|
215
|
-
- VLLM
|
|
216
|
-
- Any OpenAI-compatible endpoint
|
|
217
|
-
|
|
218
|
-
For the full list, visit the [AI SDK providers documentation](https://sdk.vercel.ai/providers).
|
|
219
|
-
|
|
220
|
-
### Switching Providers
|
|
221
|
-
|
|
222
|
-
You can easily switch providers by changing the import and model configuration:
|
|
223
|
-
|
|
224
|
-
**OpenAI Example**
|
|
225
|
-
|
|
226
|
-
```typescript
|
|
227
|
-
import { openai } from '@ai-sdk/openai';
|
|
228
|
-
|
|
229
|
-
export const gpt4oAgent = new ExuluAgent({
|
|
230
|
-
id: 'gpt_4o',
|
|
231
|
-
name: 'GPT-4o',
|
|
232
|
-
provider: 'OpenAI',
|
|
233
|
-
description: 'OpenAI GPT-4o with vision and advanced reasoning',
|
|
234
|
-
type: 'agent',
|
|
235
|
-
capabilities: {
|
|
236
|
-
image: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
|
|
237
|
-
file: ['pdf', 'txt', 'csv'],
|
|
238
|
-
},
|
|
239
|
-
config: {
|
|
240
|
-
name: 'GPT-4o',
|
|
241
|
-
model: (apiKey: string) => {
|
|
242
|
-
return openai(apiKey).languageModel('gpt-4o');
|
|
243
|
-
},
|
|
244
|
-
},
|
|
245
|
-
});
|
|
246
|
-
```
|
|
247
|
-
|
|
248
|
-
**Google Gemini Example**
|
|
249
|
-
|
|
250
|
-
```typescript
|
|
251
|
-
import { google } from '@ai-sdk/google';
|
|
252
|
-
|
|
253
|
-
export const geminiAgent = new ExuluAgent({
|
|
254
|
-
id: 'gemini_2_0_flash',
|
|
255
|
-
name: 'Gemini 2.0 Flash',
|
|
256
|
-
provider: 'Google',
|
|
257
|
-
description: 'Google Gemini 2.0 Flash with multimodal capabilities',
|
|
258
|
-
type: 'agent',
|
|
259
|
-
capabilities: {
|
|
260
|
-
image: ['png', 'jpg', 'jpeg', 'gif', 'webp'],
|
|
261
|
-
file: ['pdf', 'txt'],
|
|
262
|
-
video: ['mp4'],
|
|
263
|
-
},
|
|
264
|
-
config: {
|
|
265
|
-
name: 'Gemini 2.0 Flash',
|
|
266
|
-
model: (apiKey: string) => {
|
|
267
|
-
return google(apiKey).languageModel('gemini-2.0-flash-exp');
|
|
268
|
-
},
|
|
269
|
-
},
|
|
270
|
-
});
|
|
271
|
-
```
|
|
272
|
-
|
|
273
|
-
**Ollama (Local Models) Example**
|
|
274
|
-
|
|
275
|
-
```typescript
|
|
276
|
-
import { ollama } from 'ollama-ai-provider';
|
|
277
|
-
|
|
278
|
-
export const llamaAgent = new ExuluAgent({
|
|
279
|
-
id: 'llama_3_70b',
|
|
280
|
-
name: 'Llama 3 70B (Local)',
|
|
281
|
-
provider: 'Ollama',
|
|
282
|
-
description: 'Self-hosted Llama 3 70B model',
|
|
283
|
-
type: 'agent',
|
|
284
|
-
config: {
|
|
285
|
-
name: 'Llama 3 70B',
|
|
286
|
-
model: (apiKey: string) => {
|
|
287
|
-
// Ollama typically doesn't need an API key
|
|
288
|
-
return ollama('llama3:70b');
|
|
289
|
-
},
|
|
290
|
-
},
|
|
291
|
-
});
|
|
292
|
-
```
|
|
293
|
-
|
|
294
|
-
**OpenAI-Compatible Endpoint Example**
|
|
295
|
-
|
|
296
|
-
```typescript
|
|
297
|
-
import { openai } from '@ai-sdk/openai';
|
|
298
|
-
|
|
299
|
-
export const customAgent = new ExuluAgent({
|
|
300
|
-
id: 'custom_vllm_model',
|
|
301
|
-
name: 'Custom VLLM Model',
|
|
302
|
-
provider: 'Custom',
|
|
303
|
-
description: 'Self-hosted model via VLLM',
|
|
304
|
-
type: 'agent',
|
|
305
|
-
config: {
|
|
306
|
-
name: 'Custom Model',
|
|
307
|
-
model: (apiKey: string) => {
|
|
308
|
-
return openai(apiKey, {
|
|
309
|
-
baseURL: 'https://your-vllm-endpoint.com/v1',
|
|
310
|
-
}).languageModel('your-model-identifier');
|
|
311
|
-
},
|
|
312
|
-
},
|
|
313
|
-
});
|
|
314
|
-
```
|
|
315
|
-
|
|
316
|
-
## Step 4: Custom Instructions (Three Layers)
|
|
317
|
-
|
|
318
|
-
Exulu supports three layers of custom instructions, allowing flexibility at different levels:
|
|
319
|
-
|
|
320
|
-
### Layer 1: Code-Level Instructions (Global)
|
|
321
|
-
|
|
322
|
-
Defined in the agent class and applied to all instances of this backend.
|
|
323
|
-
|
|
324
|
-
```typescript
|
|
325
|
-
config: {
|
|
326
|
-
name: 'Claude Sonnet 4.5',
|
|
327
|
-
customInstructions: 'You are a helpful assistant. Always be concise and accurate.',
|
|
328
|
-
model: (apiKey: string) => anthropic(apiKey).languageModel('claude-sonnet-4-5-20250929'),
|
|
329
|
-
}
|
|
330
|
-
```
|
|
331
|
-
|
|
332
|
-
### Layer 2: Agent Instance Instructions (Admin-Configured)
|
|
333
|
-
|
|
334
|
-
Set in the UI when creating an agent instance. Admins can add specific instructions for each agent instance.
|
|
335
|
-
|
|
336
|
-
### Layer 3: User Session Instructions (User-Configured)
|
|
337
|
-
|
|
338
|
-
Individual users can add their own instructions for their sessions with the agent.
|
|
339
|
-
|
|
340
|
-
**Instruction Priority**: Layer 3 (User) > Layer 2 (Instance) > Layer 1 (Code)
|
|
341
|
-
|
|
342
|
-
All layers are combined when the agent processes a request.
|
|
343
|
-
|
|
344
|
-
## Step 5: Export Your Agent
|
|
345
|
-
|
|
346
|
-
Add your agent to the `agents/index.ts` file:
|
|
347
|
-
|
|
348
|
-
```typescript
|
|
349
|
-
// src/agents/index.ts
|
|
350
|
-
export { claudeSonnetAgent } from './claude-sonnet';
|
|
351
|
-
export { gpt4oAgent } from './gpt4o';
|
|
352
|
-
export { geminiAgent } from './gemini';
|
|
353
|
-
```
|
|
354
|
-
|
|
355
|
-
This creates a central place to import all your agents.
|
|
356
|
-
|
|
357
|
-
## Step 6: Add to ExuluApp
|
|
358
|
-
|
|
359
|
-
Import and register your agents in your main ExuluApp configuration:
|
|
360
|
-
|
|
361
|
-
```typescript
|
|
362
|
-
// src/exulu.ts
|
|
363
|
-
import { ExuluApp } from '@exulu/backend';
|
|
364
|
-
import { claudeSonnetAgent, gpt4oAgent, geminiAgent } from './agents';
|
|
365
|
-
|
|
366
|
-
export const exuluApp = new ExuluApp({
|
|
367
|
-
config: {
|
|
368
|
-
// Your app configuration
|
|
369
|
-
},
|
|
370
|
-
agents: [
|
|
371
|
-
claudeSonnetAgent,
|
|
372
|
-
gpt4oAgent,
|
|
373
|
-
geminiAgent,
|
|
374
|
-
// Add as many agents as you need
|
|
375
|
-
],
|
|
376
|
-
contexts: [],
|
|
377
|
-
tools: [],
|
|
378
|
-
});
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
When you save this file, the development server will automatically restart and your agents will be available.
|
|
382
|
-
|
|
383
|
-
## Step 7: Create an Agent Instance in the UI
|
|
384
|
-
|
|
385
|
-
Now that your backend is registered, create an agent instance through the UI:
|
|
386
|
-
|
|
387
|
-
1. Navigate to `http://localhost:3000` and log in
|
|
388
|
-
2. Go to **Agents** in the sidebar
|
|
389
|
-
3. Click **Create New Agent**
|
|
390
|
-
4. Select your backend from the dropdown (e.g., "Claude Sonnet 4.5")
|
|
391
|
-
5. Give it a name (e.g., "Financial Analysis Agent")
|
|
392
|
-
6. Add a description
|
|
393
|
-
7. Set a category
|
|
394
|
-
8. Configure an API key (see next section)
|
|
395
|
-
9. Toggle **Active** to ON
|
|
396
|
-
10. Click **Save**
|
|
397
|
-
|
|
398
|
-
## Step 8: Configure the API Key
|
|
399
|
-
|
|
400
|
-
Before your agent can make API calls, you need to add an encrypted API key:
|
|
401
|
-
|
|
402
|
-
1. Navigate to **Variables** in the sidebar
|
|
403
|
-
2. Click **Add Variable**
|
|
404
|
-
3. Enter a name (e.g., `ANTHROPIC_API_KEY`)
|
|
405
|
-
4. Paste your API key
|
|
406
|
-
5. **Enable "Encrypt this variable"** (required for security)
|
|
407
|
-
6. Click **Save**
|
|
408
|
-
|
|
409
|
-
Now go back to your agent configuration and select this variable from the API Key dropdown.
|
|
410
|
-
|
|
411
|
-
<Warning>
|
|
412
|
-
Always encrypt API key variables. The system will reject unencrypted API keys for security reasons.
|
|
413
|
-
</Warning>
|
|
414
|
-
|
|
415
|
-
## Step 9: Test Your Agent
|
|
416
|
-
|
|
417
|
-
Test your newly created agent:
|
|
418
|
-
|
|
419
|
-
1. Navigate to **Chat** in the sidebar
|
|
420
|
-
2. Click **Start New Session**
|
|
421
|
-
3. Select your agent from the dropdown
|
|
422
|
-
4. Send a test message
|
|
423
|
-
5. You should see a streaming response from your agent
|
|
424
|
-
|
|
425
|
-
<Check>Your custom agent backend is now live and working!</Check>
|
|
426
|
-
|
|
427
|
-
## Advanced Configuration
|
|
428
|
-
|
|
429
|
-
### Multiple Agents with Same Backend
|
|
430
|
-
|
|
431
|
-
You can create multiple agent instances using the same backend:
|
|
432
|
-
|
|
433
|
-
```typescript
|
|
434
|
-
// In UI, create multiple instances:
|
|
435
|
-
// 1. "Customer Support Agent" using claude_sonnet_4_5
|
|
436
|
-
// 2. "Code Review Assistant" using claude_sonnet_4_5
|
|
437
|
-
// 3. "Financial Analyst" using claude_sonnet_4_5
|
|
438
|
-
|
|
439
|
-
// Each instance can have different:
|
|
440
|
-
// - System instructions
|
|
441
|
-
// - Tools
|
|
442
|
-
// - Access control
|
|
443
|
-
// - Categories
|
|
444
|
-
```
|
|
445
|
-
|
|
446
|
-
### Model-Specific Settings
|
|
447
|
-
|
|
448
|
-
Some providers support additional configuration:
|
|
449
|
-
|
|
450
|
-
```typescript
|
|
451
|
-
model: (apiKey: string) => {
|
|
452
|
-
return anthropic(apiKey, {
|
|
453
|
-
// Optional: custom headers
|
|
454
|
-
headers: {
|
|
455
|
-
'anthropic-beta': 'max-tokens-3-5-sonnet-2024-07-15',
|
|
456
|
-
},
|
|
457
|
-
}).languageModel('claude-sonnet-4-5-20250929', {
|
|
458
|
-
// Model-specific settings
|
|
459
|
-
maxTokens: 4096,
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
```
|
|
463
|
-
|
|
464
|
-
### TypeScript Autocomplete
|
|
465
|
-
|
|
466
|
-
The ExuluAgent class is fully typed. Use your IDE's autocomplete to explore available options:
|
|
467
|
-
|
|
468
|
-
```typescript
|
|
469
|
-
const agent = new ExuluAgent({
|
|
470
|
-
// Press Ctrl+Space to see all available options
|
|
471
|
-
id: 'my_agent',
|
|
472
|
-
// TypeScript will show you required vs optional fields
|
|
473
|
-
});
|
|
474
|
-
```
|
|
475
|
-
|
|
476
|
-
## Next Steps
|
|
477
|
-
|
|
478
|
-
Now that you have a custom agent backend, enhance it further:
|
|
479
|
-
|
|
480
|
-
### Add Tools
|
|
481
|
-
|
|
482
|
-
Give your agent capabilities beyond conversation.
|
|
483
|
-
|
|
484
|
-
See the [ExuluTool guides](/core/exulu-tool/introduction)
|
|
485
|
-
|
|
486
|
-
### Add Context
|
|
487
|
-
|
|
488
|
-
Provide domain-specific knowledge through vector databases.
|
|
489
|
-
|
|
490
|
-
See the [ExuluContext guides](/core/exulu-context/introduction)
|
|
491
|
-
|
|
492
|
-
### Create Workflows
|
|
493
|
-
|
|
494
|
-
Build automated workflows using your agents.
|
|
495
|
-
|
|
496
|
-
See the [ExuluApp guides](/core/exulu-app/introduction)
|
|
497
|
-
|
|
498
|
-
### API Integration
|
|
499
|
-
|
|
500
|
-
Interact with your agents programmatically via GraphQL.
|
|
501
|
-
|
|
502
|
-
See the [API Reference](/api-reference/introduction)
|
|
503
|
-
|
|
504
|
-
## Troubleshooting
|
|
505
|
-
|
|
506
|
-
### "Agent backend not showing in UI"
|
|
507
|
-
|
|
508
|
-
Make sure you have added the agent to the ExuluApp agents array and restarted the development server.
|
|
509
|
-
|
|
510
|
-
Check the server logs for any errors during startup.
|
|
511
|
-
|
|
512
|
-
### "Module not found" errors
|
|
513
|
-
|
|
514
|
-
Ensure you have installed the required AI SDK provider package:
|
|
515
|
-
|
|
516
|
-
```bash
|
|
517
|
-
npm install @ai-sdk/anthropic # For Anthropic
|
|
518
|
-
npm install @ai-sdk/openai # For OpenAI
|
|
519
|
-
npm install @ai-sdk/google # For Google
|
|
520
|
-
```
|
|
521
|
-
|
|
522
|
-
### "Invalid API key" errors
|
|
523
|
-
|
|
524
|
-
Verify that the API key variable is encrypted and contains a valid key.
|
|
525
|
-
|
|
526
|
-
Check that you have selected the correct variable in the agent configuration.
|
|
527
|
-
|
|
528
|
-
### TypeScript errors
|
|
529
|
-
|
|
530
|
-
Make sure you have the latest version of the Exulu backend package and that your `tsconfig.json` is properly configured.
|
|
531
|
-
|
|
532
|
-
### Agent responds but output is incorrect
|
|
533
|
-
|
|
534
|
-
Check the custom instructions at all three layers. They might be conflicting or poorly defined.
|
|
535
|
-
|
|
536
|
-
Review the model's capabilities to ensure you're not requesting unsupported features.
|
|
537
|
-
|
|
538
|
-
## Best Practices
|
|
539
|
-
|
|
540
|
-
### Naming Conventions
|
|
541
|
-
|
|
542
|
-
**For agent IDs:**
|
|
543
|
-
- Use underscores, not hyphens
|
|
544
|
-
- Include the model version
|
|
545
|
-
- Be descriptive
|
|
546
|
-
- Never change after creation
|
|
547
|
-
|
|
548
|
-
**For display names:**
|
|
549
|
-
- User-friendly and clear
|
|
550
|
-
- Include provider and model info
|
|
551
|
-
- Can be changed anytime
|
|
552
|
-
|
|
553
|
-
### API Key Management
|
|
554
|
-
|
|
555
|
-
**Separate keys for development and production.**
|
|
556
|
-
|
|
557
|
-
Use different variables for different environments.
|
|
558
|
-
|
|
559
|
-
**Monitor usage and costs.**
|
|
560
|
-
|
|
561
|
-
Set up billing alerts with your provider.
|
|
562
|
-
|
|
563
|
-
**Rotate keys periodically.**
|
|
564
|
-
|
|
565
|
-
Update the encrypted variables in the system.
|
|
566
|
-
|
|
567
|
-
### Code Organization
|
|
568
|
-
|
|
569
|
-
**One agent per file.**
|
|
570
|
-
|
|
571
|
-
Makes it easier to maintain and test.
|
|
572
|
-
|
|
573
|
-
**Group related agents.**
|
|
574
|
-
|
|
575
|
-
For example, all Anthropic models in one folder.
|
|
576
|
-
|
|
577
|
-
**Document your agents.**
|
|
578
|
-
|
|
579
|
-
Add comments explaining the use case and configuration.
|
|
580
|
-
|
|
581
|
-
### Testing
|
|
582
|
-
|
|
583
|
-
**Test locally first.**
|
|
584
|
-
|
|
585
|
-
Verify the agent works in development before deploying.
|
|
586
|
-
|
|
587
|
-
**Use test API keys.**
|
|
588
|
-
|
|
589
|
-
Many providers offer test keys with limited quotas.
|
|
590
|
-
|
|
591
|
-
**Check capabilities.**
|
|
592
|
-
|
|
593
|
-
Ensure file type restrictions match the model's actual capabilities.
|
|
594
|
-
|
|
595
|
-
## Summary
|
|
596
|
-
|
|
597
|
-
You've learned how to create custom agent backends in code by defining ExuluAgent classes. You now understand:
|
|
598
|
-
|
|
599
|
-
- The difference between backends and agent instances
|
|
600
|
-
- How to structure your agent code
|
|
601
|
-
- All ExuluAgent configuration options
|
|
602
|
-
- How to use the AI SDK with multiple providers
|
|
603
|
-
- The three layers of custom instructions
|
|
604
|
-
- How to register agents with ExuluApp
|
|
605
|
-
- How to create agent instances in the UI
|
|
606
|
-
- Best practices for agent development
|
|
607
|
-
|
|
608
|
-
Your custom agents can now be used to create multiple specialized agent instances through the UI, each with their own configuration, tools, and access controls.
|