Custom Domain Walkthrough
End-to-end guide to building and deploying a custom AI domain pack.
This guide walks through creating a custom domain pack from scratch — defining the domain, adding intents, uploading knowledge sources, and making your first API call.
We'll build a legal_contracts domain as the example.
Step 1: Create the domain
domainKey becomes the path segment in API calls: POST /v1/legal_contracts/{intent}.
Step 2: Define intents
Each intent maps a business action to a prompt template. Variables in {{double_braces}} become input fields.
Clause extraction
Contract summary
Risk analysis
Step 3: Upload knowledge sources (optional)
If you have a library of standard clauses, precedent contracts, or clause definitions, upload them as knowledge sources to enable RAG.
First, enable RAG for your account:
Then upload sources via the Knowledge dashboard section. Tag them with the legal_contracts domain so they're scoped correctly.
Step 4: Call your custom domain
Your custom intents are called exactly like built-in intents:
Response:
Step 5: Use sessions for multi-step review
Chain intents in a session for a complete review workflow:
Tips
- Keep system prompts focused — the domain system prompt applies to all intents. Intent-specific instructions go in the
promptTemplate. - Variable names matter — use descriptive names (
contract_text, nottext) as they become self-documenting input fields. - Test with short contracts first — iterate on prompt quality before processing large documents.
- Use sessions — the engine builds context across calls, making later intents in a review session smarter.
For full API reference see Custom Domains API.