Skip to main content
Version: 2.0

Create Instruction API Definition

The Create Instruction API enables you to create reusable sets of behavioral guidelines that shape how AI agents reason, respond, and interact with users and tools. Instructions are fundamental to ensuring that agents operate within enterprise policies, follow best practices, and maintain a consistent tone and personality across all interactions.

Organizations use this API to define standardized operational protocols, enforce compliance with regulatory requirements, and customize agent behavior to align with specific business use cases, such as customer support, financial analysis, or internal workflow automation.

Create Instruction Request and Response

To create an instruction, send a POST request to /v2/instructions. You specify the following parameters in the request body:

  • name (string, required): A human-readable name for the instruction.
  • description (string, optional): A detailed description of the instruction's purpose and intended use.
  • template (string, required): The instruction content in Apache Velocity Template Language, which allows for dynamic variable substitution.
  • enabled (boolean, optional): Whether the instruction should be enabled upon creation (defaults to true).
  • metadata (object, optional): Arbitrary metadata for tracking, versioning, or categorization.

The response includes the full definition of the newly created instruction, including system-generated fields such as id, version, created_at, and updated_at.

Example Request

EXAMPLE REQUEST
1

Example Response

EXAMPLE RESPONSE
1

Error Responses

The API returns standard HTTP error codes with detailed error information:

HTTP CodeError CodeDescription
400invalid_requestMissing required fields or malformed request structure
401unauthorizedInvalid or missing API key
403forbiddenInsufficient permissions for creating instructions
409conflictAn instruction with the same name already exists
429rate_limit_exceededInstruction creation rate limit exceeded