### Use Examples in Prompts Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/agent-node Include examples of desired input-output pairs to guide the agent, especially for complex tasks. This helps the agent learn the expected format and logic. ```text Categorize these issues: Example 1: "Can't log in, getting 500 error" → Urgent Example 2: "How do I export data?" → Low Now categorize: {{trigger.output.issue}} ``` -------------------------------- ### System Instruction Example Source: https://docs.langdock.com/en/developer/completion-api/google Provides a system instruction to guide the model's behavior, can be a string or a Content object. ```json { "systemInstruction": { "role": "system", "parts": [ { "text": "You are a weather agent. Use the weather tool when asked about weather." } ] } } ``` -------------------------------- ### SKILL.md Format Example Source: https://docs.langdock.com/api-endpoints/skills/import-skill An example of a SKILL.md file, demonstrating the required YAML frontmatter and instructional content. ```mdx --- name: Support Reply Style slug: support-reply-style description: Applies the support team's tone and escalation rules. --- Write concise replies, include the next best action, and escalate billing issues to the account owner. ``` -------------------------------- ### Example Success Response Source: https://docs.langdock.com/en/developer/integrations-api/create-integration An example of a successful response after creating an integration. ```json { "integration": { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "My Custom Integration", "description": "Connects to my internal company API for data retrieval", "createdAt": "2025-02-18T10:30:00.000Z" } } ``` -------------------------------- ### Example Tool Definition: Get Weather Source: https://docs.langdock.com/en/developer/completion-api/anthropic An example of defining a 'get_weather' tool with its input schema, including location and optional unit parameters. ```json { "name": "get_weather", "description": "Get the current weather in a given location", "input_schema": { "properties": { "location": { "description": "The city and state, e.g. San Francisco, CA", "type": "string" }, "unit": { "description": "Unit for the output - one of (celsius, fahrenheit)", "type": "string" } }, "required": [ "location" ], "type": "object" } } ``` -------------------------------- ### Example Success Response Source: https://docs.langdock.com/api-endpoints/skills/list-skills An example of a JSON response when successfully retrieving a list of skills. Shows a single skill object with all its properties. ```json { "skills": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Support Reply Style", "slug": "support-reply-style", "description": "Applies the support team's tone and escalation rules.", "instructions": "Write concise replies, include the next best action, and escalate billing issues to the account owner.", "integrationIds": [], "createdAt": "2026-07-06T10:30:00.000Z", "updatedAt": "2026-07-06T10:30:00.000Z" } ], "nextCursor": "550e8400-e29b-41d4-a716-446655440000" } ``` -------------------------------- ### Example Dedicated Deployment Base URL Source: https://docs.langdock.com/en/developer/overview/api-introduction An example illustrating the structure of a base URL for a dedicated Langdock deployment, including the '/api/public' suffix. ```text https://langdock.yourcompany.com/api/public ``` -------------------------------- ### Input Variables Example Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/agent-node Pass data from previous nodes to the agent for context. This example shows how to include customer, order ID, and issue details for support ticket analysis. ```text Customer: {{trigger.output.customer_name}} Order ID: {{trigger.output.order_id}} Issue: {{trigger.output.description}} Please analyze this support ticket and categorize it. ``` -------------------------------- ### Example Success Response Source: https://docs.langdock.com/en/developer/knowledge-folder-api/search-knowledge-folder Illustrates an example of a successful response from the Search Knowledge Folder API, showing populated fields for search results. ```json { "status": "success", "result": [ { "id": "chunk_abc123", "text": "Q4 revenue projections indicate a 15% increase compared to Q3, driven primarily by strong enterprise sales in the EMEA region...", "similarity": 0.89, "subsource": "att_xyz789", "subname": "quarterly-report-2024.pdf", "url": "https://example.com/reports/q4-2024", "index": 0 }, { "id": "chunk_def456", "text": "The projected revenue for the fourth quarter takes into account seasonal trends and the impact of new product launches...", "similarity": 0.82, "subsource": "att_abc456", "subname": "financial-forecast.xlsx", "url": null, "index": 1 } ] } ``` -------------------------------- ### Input Array Examples for Loop Node Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/loop-node Examples of how to specify the input array for the Loop node. These typically reference outputs from previous nodes in the workflow. ```handlebars {{ trigger.output.customers }} ``` ```handlebars {{ api_response.output.items }} ``` ```handlebars {{ google_sheets.output.rows }} ``` -------------------------------- ### Variable Examples in Langdock Source: https://docs.langdock.com/en/using-langdock/workflows/fundamentals/field-modes Provides concrete examples of how to reference variables from different sources like triggers, agents, API responses, and loop items within Langdock workflows. ```handlebars {{trigger.output.email}} // Form field {{agent.output.summary}} // Agent output {{http_request.output.data.userId}} // API response {{my_loop.output.currentItem.name}} // Current loop item ``` -------------------------------- ### Invite Users Response Examples (OpenAPI) Source: https://docs.langdock.com/en/developer/user-management-api/invite Examples of successful and partially successful responses when inviting users, including cases with all invitations succeeding and cases with invalid email addresses. ```yaml status: success message: Invitations processed successfulInvites: - alice@example.com - bob@example.com invalidEmails: [] ``` ```yaml status: success message: Invitations processed successfulInvites: - alice@example.com invalidEmails: - not-a-valid-email ``` -------------------------------- ### Example Question for Company Knowledge Source: https://docs.langdock.com/en/using-langdock/chat/tools/company-knowledge Ask a natural language question to retrieve information from connected sources. This example queries Slack for information about API changes. ```text What did Sarah say about the API changes in Slack? ``` -------------------------------- ### Example Output Node Structure Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/output-node This example shows how to structure the output of a workflow using Handlebars templating. It extracts priority, category, and a draft reply from the agent's output. ```handlebars **Priority:** {{agent.output.structured.priority}} **Category:** {{agent.output.structured.category}} **Suggested response:** {{agent.output.structured.draft_reply}} ``` -------------------------------- ### Install and Run a Langdock Cookbook Recipe Source: https://docs.langdock.com/en/developer/overview/cookbook Clone the repository or copy a single recipe folder. Navigate into the recipe directory, install dependencies using pnpm, copy the environment file if applicable, and then run the development server. ```bash cd mcp/authentication/okta-dcr # any recipe folder pnpm install cp .env.example .env # where applicable pnpm dev # runs locally on http://localhost:3333 ``` -------------------------------- ### Multiple Files Output Example Source: https://docs.langdock.com/en/using-langdock/guides/integrations/file-support-for-actions Shows how to return multiple files from an action. The 'text' shortcut can be used for UTF-8 encoded text files. ```javascript return { files: [ { fileName: "data.csv", mimeType: "text/csv", text: "Name,Email\nJohn,john@example.com", // Text shortcut for UTF-8 }, { fileName: "chart.png", mimeType: "image/png", base64: "iVBORw0KGgoAAAANSUhEUgAA...", }, ], }; ``` -------------------------------- ### Few-shot Prompting Example Source: https://docs.langdock.com/en/using-langdock/guides/prompt-engineering/advanced-techniques/prompting-techniques Use few-shot prompting for complex or nuanced tasks where output format consistency is important. Provide 3-4 examples to guide the model's response. ```text I was happy with the customer support today - satisfied The product is horrible! - very unsatisfied This is one of the best products I have ever used - very satisfied This is such a great product! - ``` -------------------------------- ### Chat with a Temporary Assistant Configuration Source: https://docs.langdock.com/en/developer/assistants-api/assistant This example demonstrates how to create and chat with a temporary assistant configuration on the fly. It allows defining assistant properties like name, instructions, and capabilities within the API call. ```javascript const axios = require("axios"); async function chatWithNewAssistant() { const response = await axios.post( "https://api.langdock.com/assistant/v1/chat/completions", { assistant: { name: "Document Analyzer", instructions: "You are a helpful assistant who analyzes documents and answers questions about them", temperature: 0.7, model: "gpt-5", capabilities: { webSearch: true, }, attachmentIds: ["550e8400-e29b-41d4-a716-446655440000"], // Obtain attachmentIds from upload attachment endpoint }, messages: [ { role: "user", content: "What are the key points in the document?", }, ], }, { headers: { Authorization: "Bearer YOUR_API_KEY", }, } ); console.log(response.data.result); } ``` -------------------------------- ### Tool Configuration Example Source: https://docs.langdock.com/en/developer/completion-api/google Configures function calling behavior, including mode and allowed function names. ```json { "toolConfig": { "functionCallingConfig": { "mode": "ANY", "allowedFunctionNames": ["get_weather"] } } } ``` -------------------------------- ### Agent Instructions Referencing Form Fields Source: https://docs.langdock.com/en/using-langdock/agents/form-fields Example of how to reference form fields within the agent's instructions to guide its behavior. Ensure field names match those defined in the agent's form. ```text You are a customer support specialist. Use the following information provided by the user: - Customer Name: Use this to personalize your responses - Issue Category: Focus your troubleshooting on this specific area - Problem Description: Analyze this to understand the core issue - Priority Level: Adjust your response urgency accordingly Always address the customer by name and provide solutions relevant to their selected category. ``` -------------------------------- ### Create a Basic Assistant Source: https://docs.langdock.com/en/developer/assistants-api/assistant-create Use this snippet to create a new assistant with basic configurations like name, description, and instructions. Ensure you replace 'YOUR_API_KEY' with your actual API key. ```javascript const axios = require("axios"); async function createBasicAssistant() { const response = await axios.post( "https://api.langdock.com/assistant/v1/create", { name: "Document Analyzer", description: "Analyzes and summarizes documents", emoji: "📄", instruction: "You are a helpful Assistant that analyzes documents and provides clear summaries of key information.", creativity: 0.5, conversationStarters: [ "Summarize this document", "What are the key points?", "Extract action items" ], webSearch: false }, { headers: { Authorization: "Bearer YOUR_API_KEY", "Content-Type": "application/json" } } ); console.log("Assistant created:", response.data.assistant.id); } ``` -------------------------------- ### Getting Enum-Based Output for Sentiment Analysis Source: https://docs.langdock.com/en/developer/assistants-api/assistant This example shows how to constrain the assistant's output to a predefined set of values using an enum. This is useful for categorizing text, such as determining sentiment (positive, neutral, negative). ```javascript const axios = require("axios"); async function getSentimentAnalysis() { const response = await axios.post( "https://api.langdock.com/assistant/v1/chat/completions", { assistant: { name: "Sentiment Analyzer", instructions: "You analyze the sentiment of text", }, messages: [ { role: "user", content: "How would you rate this review: 'This product exceeded my expectations!'", }, ], output: { type: "enum", enum: ["positive", "neutral", "negative"], }, }, { headers: { Authorization: "Bearer YOUR_API_KEY", }, } ); // Access the enum result directly from output console.log(response.data.output); // Output: "positive" } ``` -------------------------------- ### Streaming Text with Vercel AI SDK (Node.js) Source: https://docs.langdock.com/en/developer/completion-api/openai This example demonstrates how to stream text responses from the Langdock API using the Vercel AI SDK in a Node.js environment. It requires the AI SDK and OpenAI provider to be installed. ```typescript import { streamText } from "ai"; import { createOpenAI } from "@ai-sdk/openai"; const langdockProvider = createOpenAI({ baseURL: "https://api.langdock.com/openai/eu/v1", apiKey: "", }); const result = await streamText({ model: langdockProvider("gpt-5-mini"), prompt: "Write a short poem about cats", }); for await (const textPart of result.textStream) { process.stdout.write(textPart); } ``` -------------------------------- ### API Request Options Example Source: https://docs.langdock.com/en/using-langdock/guides/integrations/agent This example demonstrates how to configure options for making an API request using `ld.request`. It includes setting the HTTP method, URL with dynamic parameters, and authorization headers. ```javascript const options = { method: 'GET', url: `https://www.googleapis.com/drive/v3/files/${data.input.itemId}/export?mimeType=text/plain`, headers: { 'Authorization': 'Bearer ' + data.auth.access_token, 'Accept': 'application/json' } }; ``` -------------------------------- ### Success Response Example Source: https://docs.langdock.com/en/developer/integrations-api/delete-action This TypeScript example shows the expected success response format when an action is successfully deleted. ```typescript { message: "Action deleted"; id: string; // UUID of the deleted action } ``` -------------------------------- ### Generation Configuration Example Source: https://docs.langdock.com/en/developer/completion-api/google Configures text generation parameters such as temperature, topP, topK, and output tokens. ```json { "generationConfig": { "temperature": 0.7, "topP": 0.9, "topK": 40, "maxOutputTokens": 1000, "stopSequences": ["END", "STOP"] } } ``` -------------------------------- ### Install python-dotenv Package Source: https://docs.langdock.com/en/admin/ai-adoption-and-rollout/best-practices/api-key-best-practices Install the python-dotenv library to load environment variables from a .env file into your Python application. ```bash pip install python-dotenv ``` -------------------------------- ### Update Parameter Names for Create, Get, Update Endpoints Source: https://docs.langdock.com/en/developer/assistants-api/assistant-to-agent-migration Replace 'assistantId' with 'agentId' for create, get, and update operations. ```javascript // Before { assistantId: "asst_123" } // After { agentId: "agent_123" } ``` -------------------------------- ### Agent Instructions Example Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/agent-node Provide clear, multi-part instructions for the agent to analyze feedback, including sentiment, category, urgency, and key issues. Uses templating for dynamic input. ```text Analyze the customer feedback and determine: 1. Sentiment (positive, neutral, negative) 2. Main topic category (product, service, pricing, support) 3. Urgency level (low, medium, high) 4. Key issues mentioned Feedback: {{trigger.output.feedback_text}} ``` -------------------------------- ### Manual Search Query Example 2 Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/file-search-node Use this snippet to construct a search query that includes specific product information from a trigger output. ```text Find information about {{trigger.output.product_name}} pricing and features ``` -------------------------------- ### Langdock Model Selection Guide Source: https://docs.langdock.com/en/using-langdock/models-and-limits/models Use this guide to determine the best model for your task. Auto mode is recommended if unsure. ```text Not sure where to start? └─ Use Auto → Langdock picks the right model for you Know what you need? ├─ Simple, quick task → Use a fast/mini/flash model └─ Complex task ├─ Deep reasoning required → Use a flagship model with Thinking enabled └─ Otherwise → Use the standard flagship model ``` -------------------------------- ### Invite Users Request Body Examples (OpenAPI) Source: https://docs.langdock.com/en/developer/user-management-api/invite Examples demonstrating how to structure the request body for inviting users, including single user invitations and multiple users with specified roles. ```yaml users: - email: jane.doe@example.com ``` ```yaml users: - email: alice@example.com role: admin - email: bob@example.com role: member - email: carol@example.com ``` -------------------------------- ### Message Object Example Source: https://docs.langdock.com/en/developer/completion-api/anthropic An example of a `Message` object returned by the API, including content, ID, model used, role, and stop reason. ```json { "content": [ { "text": ">-\nHere is a haiku about cats:\n\nFeline grace and charm,\nPurring softly by the fire,\nCats reign supreme.", "type": "text" } ], "id": "msg_013Zva2CMHLNnXjNJJKqJ2EF", "model": "claude-3-haiku-20240307", "role": "assistant", "stop_reason": "end_turn", "stop_sequence": null, "type": "message", "usage": { "input_tokens": 14, "output_tokens": 35 } } ``` -------------------------------- ### Example Question for Company Knowledge - File Search Source: https://docs.langdock.com/en/using-langdock/chat/tools/company-knowledge Use natural language to find specific documents within connected sources. This example searches for a Q4 sales report in a marketing folder. ```text Find the Q4 sales report from the marketing folder ``` -------------------------------- ### Example Response for Listing Integrations Source: https://docs.langdock.com/en/developer/integrations-api/list-integrations This JSON object demonstrates a typical successful response when listing integrations, showcasing sample data for both Langdock-built and custom integrations. ```json { "integrations": [ { "id": "550e8400-e29b-41d4-a716-446655440000", "name": "Slack", "description": "Send messages and interact with Slack", "authType": "OAUTH", "buildByLangdock": true, "actions": [ { "id": "660e8400-e29b-41d4-a716-446655440001", "name": "Send Message", "description": "Send a message to a Slack channel", "requiresConfirmation": true }, { "id": "660e8400-e29b-41d4-a716-446655440002", "name": "Create Channel", "description": "Create a new Slack channel", "requiresConfirmation": true } ] }, { "id": "770e8400-e29b-41d4-a716-446655440000", "name": "My Custom Integration", "description": "Internal API connector", "authType": "API_KEY", "buildByLangdock": false, "actions": [ { "id": "880e8400-e29b-41d4-a716-446655440001", "name": "Get User Data", "description": "Retrieves user information", "requiresConfirmation": false } ] } ] } ``` -------------------------------- ### Single File Output Example Source: https://docs.langdock.com/en/using-langdock/guides/integrations/file-support-for-actions Demonstrates how to return a single file output from an action. Ensure the file content is Base64 encoded for binary files. ```javascript return { files: { fileName: "report.pdf", mimeType: "application/pdf", base64: "JVBERi0xLjQK...", // Base64 encoded content }, }; ``` -------------------------------- ### Example message_delta event Source: https://docs.langdock.com/en/developer/completion-api/google An example of a 'message_delta' event received during a streaming response from the API. This event contains subsequent chunks of generated content. ```json event: message_delta data: { "candidates": [ { "index": 0, "content": { "role": "model", "parts": [{ "text": "The ocean whispers..." }] } } ] } ``` -------------------------------- ### FIM Completion Response Example Source: https://docs.langdock.com/en/developer/completion-api/mistral Example of a successful response from the FIM completion endpoint. Includes usage statistics and the generated code completion. ```json { "data": "asd", "id": "245c52bc936f53ba90327800c73d1c3e", "object": "chat.completion", "model": "codestral", "usage": { "prompt_tokens": 16, "completion_tokens": 102, "total_tokens": 118 }, "created": 1732902806, "choices": [ { "index": 0, "message": { "content": "\n // Use a regular expression to match any non-alphanumeric character and replace it with an empty string\n return str.replace(/[^a-zA-Z0-9]/g, '');\n }\n\n\n // Test the function\n\n const inputString = \"Hello, World! 123\";\n\n const outputString =\n removeSpecialCharactersWithRegex(inputString);\n\n console.log(outputString); // Output: \"HelloWorld123\" ", "prefix": false, "role": "assistant" }, "finish_reason": "stop" } ] } ``` -------------------------------- ### Using a Temporary Agent Configuration Source: https://docs.langdock.com/en/developer/agents-api/agent This example shows how to use a temporary agent configuration directly in the request. This is useful for ad-hoc agent creation without needing to pre-register an agent. ```APIDOC ## POST /agent/v1/chat/completions ### Description Initiates a chat completion using a temporary agent configuration defined within the request. ### Method POST ### Endpoint /agent/v1/chat/completions ### Request Body - **agent** (object) - Optional - Configuration for a temporary agent. - **name** (string) - Required - The name of the agent. - **instructions** (string) - Required - The instructions for the agent. - **temperature** (number) - Optional - The sampling temperature for the agent's response. - **model** (string) - Required - The model to use for the agent. - **capabilities** (object) - Optional - Capabilities enabled for the agent. - **webSearch** (boolean) - Optional - Whether web search is enabled. - **messages** (array) - Required - An array of message objects representing the conversation history. - **id** (string) - Required - Unique identifier for the message. - **role** (string) - Required - The role of the message sender (e.g., 'user', 'assistant'). - **parts** (array) - Required - An array of message parts. - **type** (string) - Required - The type of message part (e.g., 'text'). - **text** (string) - Required - The content of the text part. ### Request Example ```json { "agent": { "name": "Document Analyzer", "instructions": "You are a helpful agent who analyzes documents and answers questions about them", "temperature": 0.7, "model": "gpt-5", "capabilities": { "webSearch": true } }, "messages": [ { "id": "msg_1", "role": "user", "parts": [ { "type": "text", "text": "What are the key points in the document?" } ] } ] } ``` ### Response #### Success Response (200) - **messages** (array) - An array of message objects representing the agent's response. - **content** (string) - The text content of the agent's response. ``` -------------------------------- ### Send Notification Node Message Example Source: https://docs.langdock.com/en/using-langdock/workflows/guides/node-types Example message content for the Send Notification Node, demonstrating the use of variables and markdown for dynamic notifications. ```handlebars New high-priority support ticket received: Customer: {{trigger.output.customer_name}} Issue: {{agent.output.structured.category}} Summary: {{agent.output.structured.summary}} View ticket: {{action.output.ticket_url}} ``` -------------------------------- ### Hallucination Detection Guardrail Example Source: https://docs.langdock.com/en/using-langdock/workflows/nodes/guardrails-node Example configuration for the Hallucination Detection guardrail. This guardrail detects when AI-generated content contains false or unverifiable information. ```text Input: {{agent.output.structured.generated_summary}} Reference: {{http_request.output.original_data}} Threshold: 0.7 Checks: Does summary accurately reflect source data? ```