# Agent Instructions

## Upsert Draft Instruction

> Upsert the draft version of the instruction

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Agent Instructions"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/agents/{agent_id}/instructions/draft":{"put":{"summary":"Upsert Draft Instruction","deprecated":false,"description":"Upsert the draft version of the instruction","operationId":"upsert_draft_instruction_admin_api_v2_agents__agent_id__instructions_draft_put","tags":["Agent Instructions"],"parameters":[{"name":"agent_id","in":"path","description":"The UUID of the agent","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInstructionCreateRequest","description":"The request body"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInstructionEntity"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"AgentInstructionCreateRequest":{"properties":{"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By"},"created_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Role"},"updated_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By Role"},"created_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Created Time"},"updated_time":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Updated Time"},"llm_config":{"description":"Configuration for the LLM model_name","type":"object","properties":{}},"structured_prompt":{"type":"object","title":"Structured Prompt","description":"Structured prompt in JSON format","properties":{}},"text_prompt":{"type":"string","title":"Text Prompt","description":"Textual prompt for the agent"},"tools_config":{"items":{"$ref":"#/components/schemas/AgentToolConfig-Input"},"type":"array","title":"Tools Config","description":"Configuration for tools used by the agent"},"agent_mode":{"type":"string","title":"Agent Mode","description":"Mode of operation for the agent"},"dataset_retrieval_config":{"$ref":"#/components/schemas/DatasetsRetrievalConfig","description":"Configuration for the dataset used"},"product_retrieval_config":{"anyOf":[{"type":"object","properties":{}},{"type":"null"}],"description":"Configuration for the product retrieval used","type":"object","properties":{}},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features","description":"Additional features in JSON format"},"variables":{"anyOf":[{"items":{"type":"object","properties":{}},"type":"array"},{"type":"null"}],"title":"Variables","description":"Variables in JSON format"}},"type":"object","required":["llm_config","structured_prompt","text_prompt","tools_config","agent_mode","dataset_retrieval_config"],"title":"AgentInstructionCreateRequest"},"AgentToolConfig-Input":{"properties":{"tool":{"$ref":"#/components/schemas/AgentToolEntity","description":"Tool entity"},"prompt":{"type":"string","title":"Prompt","description":"Prompt for the tool"},"approval_mode":{"type":"string","title":"Approval Mode","description":"Mode of approval"},"approval_condition":{"type":"object","title":"Approval Condition","description":"Condition for approval","properties":{}},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the tool"}},"type":"object","required":["tool","prompt","approval_mode","approval_condition","enable"],"title":"AgentToolConfig"},"AgentToolEntity":{"properties":{"tool_type":{"type":"object","properties":{}},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"},"tool_parameters":{"type":"object","title":"Tool Parameters","properties":{}}},"type":"object","required":["tool_type"],"title":"AgentToolEntity","description":"Agent Tool Entity."},"DatasetsRetrievalConfig":{"properties":{"datasets":{"items":{"$ref":"#/components/schemas/DatasetConfig"},"type":"array","title":"Datasets","description":"List of datasets"},"top_k":{"type":"integer","title":"Top K","description":"Top K datasets"},"retrieval_mode":{"type":"string","title":"Retrieval Mode","description":"Retrieval mode, vector or keyword or hybrid"},"tool_enabled":{"type":"boolean","title":"Tool Enabled","description":"Enable or disable the tool","default":false}},"type":"object","required":["datasets","top_k","retrieval_mode"],"title":"DatasetsRetrievalConfig"},"DatasetConfig":{"properties":{"id":{"type":"string","title":"Id","description":"Dataset ID"},"name":{"type":"string","title":"Name","description":"Dataset Name"},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the dataset"}},"type":"object","required":["id","name","enable"],"title":"DatasetConfig"},"AgentInstructionEntity":{"properties":{"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"Identifier of the creator"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"Identifier of the last updater"},"created_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Role"},"updated_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By Role"},"created_time":{"type":"string","format":"date-time","title":"Created Time","description":"Timestamp of creation"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time","description":"Timestamp of last update"},"llm_config":{"description":"Configuration for the LLM model_name","type":"object","properties":{}},"structured_prompt":{"type":"object","title":"Structured Prompt","description":"Structured prompt in JSON format","properties":{}},"text_prompt":{"type":"string","title":"Text Prompt","description":"Textual prompt for the agent"},"tools_config":{"items":{"$ref":"#/components/schemas/AgentToolConfig-Output"},"type":"array","title":"Tools Config","description":"Configuration for tools used by the agent"},"agent_mode":{"type":"string","title":"Agent Mode","description":"Mode of operation for the agent"},"dataset_retrieval_config":{"$ref":"#/components/schemas/DatasetsRetrievalConfig","description":"Configuration for the dataset used"},"product_retrieval_config":{"anyOf":[{"type":"object","properties":{}},{"type":"null"}],"description":"Configuration for the product retrieval used"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features","description":"Additional features in JSON format"},"variables":{"anyOf":[{"items":{"type":"object","properties":{}},"type":"array"},{"type":"null"}],"title":"Variables","description":"Variables in JSON format"},"id":{"type":"string","title":"Id","description":"Unique identifier for the Agent Instruction"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant identifier"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit identifier"},"agent_id":{"type":"string","title":"Agent Id","description":"Associated agent identifier"},"version":{"type":"string","title":"Version","description":"Version timestamp"},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Indicates if the item is deleted"}},"type":"object","required":["created_time","updated_time","llm_config","structured_prompt","text_prompt","tools_config","agent_mode","dataset_retrieval_config","id","tenant_id","tenant_unit_id","agent_id","version","is_deleted"],"title":"AgentInstructionEntity"},"AgentToolConfig-Output":{"properties":{"tool":{"$ref":"#/components/schemas/AgentToolEntity","description":"Tool entity"},"prompt":{"type":"string","title":"Prompt","description":"Prompt for the tool"},"approval_mode":{"type":"string","title":"Approval Mode","description":"Mode of approval"},"approval_condition":{"type":"object","title":"Approval Condition","description":"Condition for approval","properties":{}},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the tool"}},"type":"object","required":["tool","prompt","approval_mode","approval_condition","enable"],"title":"AgentToolConfig"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## Get Draft Instruction

> Get the draft version of the instruction

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Agent Instructions"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/agents/{agent_id}/instructions/draft":{"get":{"summary":"Get Draft Instruction","deprecated":false,"description":"Get the draft version of the instruction","operationId":"get_draft_instruction_admin_api_v2_agents__agent_id__instructions_draft_get","tags":["Agent Instructions"],"parameters":[{"name":"agent_id","in":"path","description":"The UUID of the agent","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInstructionEntity"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"AgentInstructionEntity":{"properties":{"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"Identifier of the creator"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"Identifier of the last updater"},"created_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Role"},"updated_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By Role"},"created_time":{"type":"string","format":"date-time","title":"Created Time","description":"Timestamp of creation"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time","description":"Timestamp of last update"},"llm_config":{"description":"Configuration for the LLM model_name","type":"object","properties":{}},"structured_prompt":{"type":"object","title":"Structured Prompt","description":"Structured prompt in JSON format","properties":{}},"text_prompt":{"type":"string","title":"Text Prompt","description":"Textual prompt for the agent"},"tools_config":{"items":{"$ref":"#/components/schemas/AgentToolConfig-Output"},"type":"array","title":"Tools Config","description":"Configuration for tools used by the agent"},"agent_mode":{"type":"string","title":"Agent Mode","description":"Mode of operation for the agent"},"dataset_retrieval_config":{"$ref":"#/components/schemas/DatasetsRetrievalConfig","description":"Configuration for the dataset used"},"product_retrieval_config":{"anyOf":[{"type":"object","properties":{}},{"type":"null"}],"description":"Configuration for the product retrieval used"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features","description":"Additional features in JSON format"},"variables":{"anyOf":[{"items":{"type":"object","properties":{}},"type":"array"},{"type":"null"}],"title":"Variables","description":"Variables in JSON format"},"id":{"type":"string","title":"Id","description":"Unique identifier for the Agent Instruction"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant identifier"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit identifier"},"agent_id":{"type":"string","title":"Agent Id","description":"Associated agent identifier"},"version":{"type":"string","title":"Version","description":"Version timestamp"},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Indicates if the item is deleted"}},"type":"object","required":["created_time","updated_time","llm_config","structured_prompt","text_prompt","tools_config","agent_mode","dataset_retrieval_config","id","tenant_id","tenant_unit_id","agent_id","version","is_deleted"],"title":"AgentInstructionEntity"},"AgentToolConfig-Output":{"properties":{"tool":{"$ref":"#/components/schemas/AgentToolEntity","description":"Tool entity"},"prompt":{"type":"string","title":"Prompt","description":"Prompt for the tool"},"approval_mode":{"type":"string","title":"Approval Mode","description":"Mode of approval"},"approval_condition":{"type":"object","title":"Approval Condition","description":"Condition for approval","properties":{}},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the tool"}},"type":"object","required":["tool","prompt","approval_mode","approval_condition","enable"],"title":"AgentToolConfig"},"AgentToolEntity":{"properties":{"tool_type":{"type":"object","properties":{}},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"},"tool_parameters":{"type":"object","title":"Tool Parameters","properties":{}}},"type":"object","required":["tool_type"],"title":"AgentToolEntity","description":"Agent Tool Entity."},"DatasetsRetrievalConfig":{"properties":{"datasets":{"items":{"$ref":"#/components/schemas/DatasetConfig"},"type":"array","title":"Datasets","description":"List of datasets"},"top_k":{"type":"integer","title":"Top K","description":"Top K datasets"},"retrieval_mode":{"type":"string","title":"Retrieval Mode","description":"Retrieval mode, vector or keyword or hybrid"},"tool_enabled":{"type":"boolean","title":"Tool Enabled","description":"Enable or disable the tool","default":false}},"type":"object","required":["datasets","top_k","retrieval_mode"],"title":"DatasetsRetrievalConfig"},"DatasetConfig":{"properties":{"id":{"type":"string","title":"Id","description":"Dataset ID"},"name":{"type":"string","title":"Name","description":"Dataset Name"},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the dataset"}},"type":"object","required":["id","name","enable"],"title":"DatasetConfig"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## Publish Draft Instruction

> Get the draft version of the instruction

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Agent Instructions"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/agents/{agent_id}/instructions/publish":{"post":{"summary":"Publish Draft Instruction","deprecated":false,"description":"Get the draft version of the instruction","operationId":"publish_draft_instruction_admin_api_v2_agents__agent_id__instructions_publish_post","tags":["Agent Instructions"],"parameters":[{"name":"agent_id","in":"path","description":"The UUID of the agent","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInstructionEntity"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"AgentInstructionEntity":{"properties":{"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"Identifier of the creator"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"Identifier of the last updater"},"created_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Role"},"updated_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By Role"},"created_time":{"type":"string","format":"date-time","title":"Created Time","description":"Timestamp of creation"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time","description":"Timestamp of last update"},"llm_config":{"description":"Configuration for the LLM model_name","type":"object","properties":{}},"structured_prompt":{"type":"object","title":"Structured Prompt","description":"Structured prompt in JSON format","properties":{}},"text_prompt":{"type":"string","title":"Text Prompt","description":"Textual prompt for the agent"},"tools_config":{"items":{"$ref":"#/components/schemas/AgentToolConfig-Output"},"type":"array","title":"Tools Config","description":"Configuration for tools used by the agent"},"agent_mode":{"type":"string","title":"Agent Mode","description":"Mode of operation for the agent"},"dataset_retrieval_config":{"$ref":"#/components/schemas/DatasetsRetrievalConfig","description":"Configuration for the dataset used"},"product_retrieval_config":{"anyOf":[{"type":"object","properties":{}},{"type":"null"}],"description":"Configuration for the product retrieval used"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features","description":"Additional features in JSON format"},"variables":{"anyOf":[{"items":{"type":"object","properties":{}},"type":"array"},{"type":"null"}],"title":"Variables","description":"Variables in JSON format"},"id":{"type":"string","title":"Id","description":"Unique identifier for the Agent Instruction"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant identifier"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit identifier"},"agent_id":{"type":"string","title":"Agent Id","description":"Associated agent identifier"},"version":{"type":"string","title":"Version","description":"Version timestamp"},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Indicates if the item is deleted"}},"type":"object","required":["created_time","updated_time","llm_config","structured_prompt","text_prompt","tools_config","agent_mode","dataset_retrieval_config","id","tenant_id","tenant_unit_id","agent_id","version","is_deleted"],"title":"AgentInstructionEntity"},"AgentToolConfig-Output":{"properties":{"tool":{"$ref":"#/components/schemas/AgentToolEntity","description":"Tool entity"},"prompt":{"type":"string","title":"Prompt","description":"Prompt for the tool"},"approval_mode":{"type":"string","title":"Approval Mode","description":"Mode of approval"},"approval_condition":{"type":"object","title":"Approval Condition","description":"Condition for approval","properties":{}},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the tool"}},"type":"object","required":["tool","prompt","approval_mode","approval_condition","enable"],"title":"AgentToolConfig"},"AgentToolEntity":{"properties":{"tool_type":{"type":"object","properties":{}},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"},"tool_parameters":{"type":"object","title":"Tool Parameters","properties":{}}},"type":"object","required":["tool_type"],"title":"AgentToolEntity","description":"Agent Tool Entity."},"DatasetsRetrievalConfig":{"properties":{"datasets":{"items":{"$ref":"#/components/schemas/DatasetConfig"},"type":"array","title":"Datasets","description":"List of datasets"},"top_k":{"type":"integer","title":"Top K","description":"Top K datasets"},"retrieval_mode":{"type":"string","title":"Retrieval Mode","description":"Retrieval mode, vector or keyword or hybrid"},"tool_enabled":{"type":"boolean","title":"Tool Enabled","description":"Enable or disable the tool","default":false}},"type":"object","required":["datasets","top_k","retrieval_mode"],"title":"DatasetsRetrievalConfig"},"DatasetConfig":{"properties":{"id":{"type":"string","title":"Id","description":"Dataset ID"},"name":{"type":"string","title":"Name","description":"Dataset Name"},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the dataset"}},"type":"object","required":["id","name","enable"],"title":"DatasetConfig"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## GET /admin/api/v2/agents/{agent\_id}/instructions

> List Agent Instructions

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Agent Instructions"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/agents/{agent_id}/instructions":{"get":{"summary":"List Agent Instructions","deprecated":false,"description":"","operationId":"list_agent_instructions_admin_api_v2_agents__agent_id__instructions_get","tags":["Agent Instructions"],"parameters":[{"name":"agent_id","in":"path","description":"The UUID of the agent","required":true,"schema":{"type":"string","title":"Agent Id"}},{"name":"page","in":"query","description":"The page number","required":false,"schema":{"type":"integer","description":"The page number","default":1,"title":"Page"}},{"name":"page_size","in":"query","description":"The number of items per page","required":false,"schema":{"type":"integer","description":"The number of items per page","default":10,"title":"Page Size"}},{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentInstructionListResponse"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"AgentInstructionListResponse":{"properties":{"page_num":{"type":"integer","title":"Page Num","description":"Current page number"},"page_size":{"type":"integer","title":"Page Size","description":"Number of items per page"},"total_count":{"type":"integer","title":"Total Count","description":"Total number of items"},"total_pages":{"type":"integer","title":"Total Pages","description":"Total number of pages"},"has_next_page":{"type":"boolean","title":"Has Next Page","description":"Whether there is a next page"},"data":{"items":{"$ref":"#/components/schemas/AgentInstructionEntity"},"type":"array","title":"Data","description":"List of items"}},"type":"object","required":["page_num","page_size","total_count","total_pages","has_next_page","data"],"title":"AgentInstructionListResponse"},"AgentInstructionEntity":{"properties":{"created_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By","description":"Identifier of the creator"},"updated_by":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By","description":"Identifier of the last updater"},"created_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Created By Role"},"updated_by_role":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Updated By Role"},"created_time":{"type":"string","format":"date-time","title":"Created Time","description":"Timestamp of creation"},"updated_time":{"type":"string","format":"date-time","title":"Updated Time","description":"Timestamp of last update"},"llm_config":{"description":"Configuration for the LLM model_name","type":"object","properties":{}},"structured_prompt":{"type":"object","title":"Structured Prompt","description":"Structured prompt in JSON format","properties":{}},"text_prompt":{"type":"string","title":"Text Prompt","description":"Textual prompt for the agent"},"tools_config":{"items":{"$ref":"#/components/schemas/AgentToolConfig-Output"},"type":"array","title":"Tools Config","description":"Configuration for tools used by the agent"},"agent_mode":{"type":"string","title":"Agent Mode","description":"Mode of operation for the agent"},"dataset_retrieval_config":{"$ref":"#/components/schemas/DatasetsRetrievalConfig","description":"Configuration for the dataset used"},"product_retrieval_config":{"anyOf":[{"type":"object","properties":{}},{"type":"null"}],"description":"Configuration for the product retrieval used"},"features":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Features","description":"Additional features in JSON format"},"variables":{"anyOf":[{"items":{"type":"object","properties":{}},"type":"array"},{"type":"null"}],"title":"Variables","description":"Variables in JSON format"},"id":{"type":"string","title":"Id","description":"Unique identifier for the Agent Instruction"},"tenant_id":{"type":"string","title":"Tenant Id","description":"Tenant identifier"},"tenant_unit_id":{"type":"string","title":"Tenant Unit Id","description":"Tenant unit identifier"},"agent_id":{"type":"string","title":"Agent Id","description":"Associated agent identifier"},"version":{"type":"string","title":"Version","description":"Version timestamp"},"is_deleted":{"type":"boolean","title":"Is Deleted","description":"Indicates if the item is deleted"}},"type":"object","required":["created_time","updated_time","llm_config","structured_prompt","text_prompt","tools_config","agent_mode","dataset_retrieval_config","id","tenant_id","tenant_unit_id","agent_id","version","is_deleted"],"title":"AgentInstructionEntity"},"AgentToolConfig-Output":{"properties":{"tool":{"$ref":"#/components/schemas/AgentToolEntity","description":"Tool entity"},"prompt":{"type":"string","title":"Prompt","description":"Prompt for the tool"},"approval_mode":{"type":"string","title":"Approval Mode","description":"Mode of approval"},"approval_condition":{"type":"object","title":"Approval Condition","description":"Condition for approval","properties":{}},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the tool"}},"type":"object","required":["tool","prompt","approval_mode","approval_condition","enable"],"title":"AgentToolConfig"},"AgentToolEntity":{"properties":{"tool_type":{"type":"object","properties":{}},"vendor_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Vendor Id"},"resource_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Resource Id"},"tool_name":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Tool Name"},"tool_parameters":{"type":"object","title":"Tool Parameters","properties":{}}},"type":"object","required":["tool_type"],"title":"AgentToolEntity","description":"Agent Tool Entity."},"DatasetsRetrievalConfig":{"properties":{"datasets":{"items":{"$ref":"#/components/schemas/DatasetConfig"},"type":"array","title":"Datasets","description":"List of datasets"},"top_k":{"type":"integer","title":"Top K","description":"Top K datasets"},"retrieval_mode":{"type":"string","title":"Retrieval Mode","description":"Retrieval mode, vector or keyword or hybrid"},"tool_enabled":{"type":"boolean","title":"Tool Enabled","description":"Enable or disable the tool","default":false}},"type":"object","required":["datasets","top_k","retrieval_mode"],"title":"DatasetsRetrievalConfig"},"DatasetConfig":{"properties":{"id":{"type":"string","title":"Id","description":"Dataset ID"},"name":{"type":"string","title":"Name","description":"Dataset Name"},"enable":{"type":"boolean","title":"Enable","description":"Enable or disable the dataset"}},"type":"object","required":["id","name","enable"],"title":"DatasetConfig"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```

## Run Specific Instruction

> Run a specific instruction by ID

```json
{"openapi":"3.0.1","info":{"title":"workfx","version":"1.0.0"},"tags":[{"name":"Agent Instruction Runs"}],"servers":[{"url":"https://api.workfx.ai","description":"Prod Env"}],"security":[],"paths":{"/admin/api/v2/agents/{agent_id}/instructions/draft/runs":{"post":{"summary":"Run Specific Instruction","deprecated":false,"description":"Run a specific instruction by ID","operationId":"run_specific_instruction_admin_api_v2_agents__agent_id__instructions_draft_runs_post","tags":["Agent Instruction Runs"],"parameters":[{"name":"agent_id","in":"path","description":"","required":true,"schema":{"type":"string","format":"uuid","title":"Agent Id"}},{"name":"tenant_id","in":"query","description":"Tenant Id","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Id","title":"Tenant Id"}},{"name":"tenant_unit_id","in":"query","description":"Tenant Unit ID","required":false,"schema":{"anyOf":[{"type":"string"},{"type":"null"}],"description":"Tenant Unit ID","title":"Tenant Unit Id"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AgentChatInvokeRequest"}}}},"responses":{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"type":"string"}}},"headers":{}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HTTPValidationError"}}},"headers":{}}}}}},"components":{"schemas":{"AgentChatInvokeRequest":{"properties":{"query":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Query","default":""},"inputs":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Inputs","description":"Input variables"},"streaming":{"type":"boolean","title":"Streaming","default":false},"files":{"anyOf":[{"items":{"type":"string"},"type":"array"},{"type":"null"}],"title":"Files","default":[]},"response_type":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Response Type","default":"wfx"},"wfx_context":{"anyOf":[{"type":"object"},{"type":"null"}],"title":"Wfx Context","default":{}},"conversation_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Conversation Id"}},"type":"object","title":"AgentChatInvokeRequest"},"HTTPValidationError":{"properties":{"detail":{"items":{"type":"object","properties":{}},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.workfx.ai/workfx-1.1.x-english/developer-docs/api-reference/agent/agent-instructions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
