An Agentic App is not just a longer prompt, and it is not finished when a few tools are attached to an agent. A production-ready Agentic App usually combines five parts:Documentation Index
Fetch the complete documentation index at: https://docs.xpertai.cn/llms.txt
Use this file to discover all available pages before exploring further.
- Business plugin: declares app metadata, configuration, lifecycle hooks, and target product surfaces.
- Agent middleware tools: tools exposed by Agent middleware that turn business actions into schema-driven model calls.
- Services and data models: persist structured outputs, review states, source evidence, and execution records.
- Workbench view: gives users a place to review, correct, approve, reject, and submit results.
- Assistant template: lets business users create a pre-wired assistant with tools, prompts, and runtime settings.
Related Feature Docs
Use these platform docs alongside this tutorial:- Plugin development, plugin concepts, and plugin schema
- Agent middleware, custom middleware, and the tools exposed by middleware
- Workbench and ChatKit, ChatKit, and remote components
- Assistant configuration and plugin install/use
Reference Architecture
A BOM Document Intake style plugin turns contract packages, technical agreements, drawings, BOM Excel files, and engineering change documents into structured data that can be reviewed, traced, and matched. Its key pattern is simple: the Agent extracts, compares, and calls tools in batches, while the Workbench handles upload, inspection, confirmation, rejection, and human review. A typical flow looks like this: For a new Agentic App, start by separating these responsibilities: what the Agent should automate, what a human must confirm, and what must be persisted with traceable evidence.Step 1: Define the Plugin Entry and Target App Capabilities
The plugin entry declares plugin metadata, config schema, template contributions, and the server module to register. In the BOM plugin, theXpertPlugin entry includes:
meta.name: the plugin package name, such as@acme/plugin-contract-review.meta.level: system, global, or organization scope.meta.targetApps: the product surfaces where the plugin should appear, such asdata-xpert.meta.targetAppMeta["data-xpert"].types: app-specific business types, such asworkbench-view,assistant-tool, andbusiness-app.meta.targetAppMeta["data-xpert"].capabilities: business capabilities used by plugin centers, templates, and governance rules.config.schemaandconfig.formSchema: runtime validation and optional frontend configuration.templates: assistant templates contributed by the plugin.
- Treat
targetAppMetaas the capability contract for the upper-level app. Do not hide business capabilities only in description text. - To show the plugin in the data-xpert plugin center, declare
targetApps: ['data-xpert']and non-emptytargetAppMeta["data-xpert"].types. - Keep config for values that really need deployment-time or admin control, such as default resource IDs, retrieval modes, or external service endpoints.
Step 2: Register Server Modules, Entities, and Lifecycle Hooks
Server modules are registered with@XpertServerPlugin; see plugin concepts for the surrounding model. A BOM-style plugin registers TypeORM entities, business services, Agent middleware, and a Workbench view provider in its server module.
An Agentic App usually needs at least three provider categories:
- Business services: save, query, review, match, submit, or write back business data.
- Agent middleware: convert selected business actions into middleware tools.
- View provider: expose data and actions to Workbench.
- Source evidence, file names, page numbers, and confidence.
- Agent judgments, human review status, and review comments.
- Failure reasons and retry jobs.
- Matching records for external systems or knowledge bases.
Step 3: Expose Business Actions as Agent Middleware Tools
Agent middleware is the automation entry point of an Agentic App. In this tutorial, “tools” means callable tools returned by middleware to the agent runtime. The BOM plugin does not expose one giant “parse contract” tool. Instead, it uses an ordered middleware tool sequence:- Keep each tool focused on one business action.
- Use zod schemas for inputs, and describe when to call the tool, how to call it, and which fields are required.
- Put call order and boundary conditions in the tool description.
- For long lists, save one item at a time instead of submitting a huge array.
- Provide a failure-reporting tool so the Agent can end incomplete work explicitly.
sourceRole, sourceDocumentName, page, evidenceText, and confidence, so reviewers can trace each judgment back to the original document.
Step 4: Create the Workbench Review UI
A real business app should not leave results only in chat. Users need a Workbench surface for lists, filters, source files, field edits, difference review, and final submission. A BOM-style plugin registers a fixed view, such asBOM Review, through a view provider. For iframe-based plugin UI, see remote components. Its manifest declares:
- View placement: Agent Workbench main slot or fixed slot.
- Rendering mode:
remote_component + react + iframe. - Query capabilities: pagination, search, sort, and parameters.
- Actions: JSON actions, file actions, row actions, and toolbar actions.
- Host event subscriptions: listen for Assistant tool completion and forward events to the iframe.
postMessage bridge to request data and execute actions. The platform API then resolves the assistant, organization, tenant, and permissions before forwarding to the view-host.
Step 5: Refresh Views from Tool Completion Events
An Agentic App should feel continuous: the user asks the Assistant to parse a contract, tools finish, and the review workbench moves to the right tab with fresh data. The BOM plugin useshostEvents.subscriptions in the manifest to listen for tool completion. For the Workbench and ChatKit event flow, see Workbench and ChatKit:
- Declarative views can use
refresh. - Iframe remote components should usually use
forward, then let the iframe decide whether to switch tabs, refresh part of the data, or update query parameters based ontoolNameand output. - Do not hard-code a plugin’s tool names or view keys in the data-xpert Workbench host. The plugin manifest should declare them.
- Forwarded events must not include tokens, API URLs, assistant IDs, tenant IDs, organization IDs, or other sensitive host context.
Step 6: Provide an Assistant Template
Business users should not manually wire middleware, model parameters, and prompts. An Agentic App should contribute an Assistant template; see Assistant configuration for the standard assistant setup flow. A BOM-style plugin exposes Assistant templates through template contribution code and loads DSL content for the assistant. The template declares:type: AgenttargetApps: ['data-xpert']requiredPluginscapabilities- default business domain and manager
- starter prompts
- DSL nodes for the agent, middleware, toolsets, state variables, and model options
- Its business role.
- Which tools can be used for which tasks.
- When files or images must be inspected first.
- Which fields require evidence and confidence.
- Which failure tool or fallback output to use when the task cannot be completed.
Step 7: Develop, Build, and Register from an Independent Plugin Repository
Production business plugins should be developed in an independent plugin repository, often with a workspace layout similar toxpert-plugins. The Xpert host should load, validate, and run plugins; production plugin code should not be developed directly inside the host application repository. For install and use flows, see plugin install/use.
At minimum, each plugin package should declare its package name, build entry, and SDK peer dependency:
- Independent release: publish the plugin as an npm package or internal enterprise artifact, then load it through the platform plugin installation flow.
- Built-in product plugin: only platform-owned system plugins should be added to the host’s default plugin list and deployment package manifests.
@xpert-ai/plugin-sdk as a peer dependency so the plugin does not bundle its own SDK copy.
Step 8: Test and Accept the App
Cover at least these scenarios:- Plugin lifecycle: loading, start, stop, and no duplicated SDK runtime through dependencies.
- Config schema: defaults, form fields, and invalid config validation.
- Tool schema: required fields, invalid inputs, call order, and failure reporting.
- Business services: save, replace, paginate, state transitions, and source evidence retention.
- Workbench manifest: fixed entry, actions, file actions, and host events.
- Remote component: iframe initialization, data loading, action execution, and tool-completion refresh.
- Assistant template: correct middleware, prompt, model options, and starter prompts after creation.
- End-to-end flow: user uploads a document, Assistant saves structured results through tools, Workbench refreshes, and a human submits the reviewed output.
- Every business line has a stable line number.
- Every important field has source evidence.
- The Agent does not invent missing values; uncertain cases become pending differences or review suggestions.
- Long documents can be saved in batches and finally marked as completed or failed.
Reusable Design Checklist
Use this checklist when building a new Agentic App:| Design area | Question |
|---|---|
| Business loop | What does the Agent automate, what does a human review, and what does the system persist? |
| Plugin manifest | Are targetApps, targetAppMeta, types, and capabilities declared? |
| Data model | Are evidence, confidence, review status, and failure reasons persisted? |
| Agent middleware tools | Are schemas, call order, per-item saves, and failure reporting defined? |
| Workbench view | Are list, detail, edit, approve, submit, and file preview flows available? |
| Event refresh | Does the view refresh into the right context after tool completion? |
| Assistant template | Can users create a fully wired business assistant in one step? |
| Tests | Do tests cover tools, services, views, templates, and the end-to-end flow? |