> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.forboc.ai/api-reference/endpoints/forboc-ai-sdk-api/np-cs/get-npc-verdict/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.forboc.ai/_mcp/server. # Get verdict (Step 7) POST https://api.forboc.ai/npcs/{npcId}/verdict Content-Type: application/json SDK sends SLM-generated output. API validates it against rules, signs it, and returns memory storage instructions + state delta for the SDK to execute locally. Reference: https://docs.forboc.ai/api-reference/endpoints/forboc-ai-sdk-api/np-cs/get-npc-verdict ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. ## Servers - `https://api.forboc.ai` (ForbocAI API Production, default) - `http://localhost:8080` (Local Development) ## Request ### Path parameters - `npcId` (string, required) ### Body (application/json) This endpoint expects a VerdictRequest. - `generatedOutput` (string, required) — Raw output from the local SLM - `observation` (string, required) — Original observation (echoed) - `npcState` (map from string to any, required) - `rulesetId` (string, optional, nullable) ## Response ### 200 Validation verdict with storage/state instructions - `valid` (boolean, optional) — Whether the generated output passed validation - `signature` (string, optional, nullable) — Cryptographic signature (HMAC) if valid - `memoryStore` (list of MemoryStoreInstruction, optional) — Instructions for what the SDK should store in its local vector DB - `stateDelta` (map from string to any, optional) — State changes for the SDK to apply locally - `action` (GenericAction, optional, nullable) — Validated action to return to the game - `dialogue` (string, optional) — Validated dialogue text returned to the caller ## Types ### MemoryStoreInstruction - `text` (string, optional) - `type` (enum, optional) - Allowed values: `observation`, `experience`, `knowledge`, `emotion` - `importance` (double, optional) ### GenericAction - `type` (string, optional) - `reason` (string, optional, nullable) - `target` (string, optional, nullable) ## Examples **Request** ```json { "generatedOutput": "The NPC decides to investigate the strange noise coming from the east corridor.", "observation": "Player reports hearing a mysterious sound near the east corridor at 22:15." } ``` **Response** ```json { "valid": true, "signature": "a3f5c9d8e7b1f2a4c6d8e9f0b1a2c3d4e5f67890abcdef1234567890abcdef12", "memoryStore": [ { "text": "NPC noted the strange noise at east corridor and plans to investigate.", "type": "observation", "importance": 0.85 } ], "stateDelta": {}, "action": { "type": "investigate", "reason": "Unidentified noise detected, potential threat assessment required.", "target": "east corridor" }, "dialogue": "I heard something unusual near the east corridor. I'll check it out." } ``` **SDK Code** ```python import requests url = "https://api.forboc.ai/npcs/npcId/verdict" payload = { "generatedOutput": "The NPC decides to investigate the strange noise coming from the east corridor.", "observation": "Player reports hearing a mysterious sound near the east corridor at 22:15." } headers = { "Authorization": "Bearer ", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://api.forboc.ai/npcs/npcId/verdict'; const options = { method: 'POST', headers: {Authorization: 'Bearer ', 'Content-Type': 'application/json'}, body: '{"generatedOutput":"The NPC decides to investigate the strange noise coming from the east corridor.","observation":"Player reports hearing a mysterious sound near the east corridor at 22:15."}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://api.forboc.ai/npcs/npcId/verdict" payload := strings.NewReader("{\n \"generatedOutput\": \"The NPC decides to investigate the strange noise coming from the east corridor.\",\n \"observation\": \"Player reports hearing a mysterious sound near the east corridor at 22:15.\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "Bearer ") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://api.forboc.ai/npcs/npcId/verdict") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = 'Bearer ' request["Content-Type"] = 'application/json' request.body = "{\n \"generatedOutput\": \"The NPC decides to investigate the strange noise coming from the east corridor.\",\n \"observation\": \"Player reports hearing a mysterious sound near the east corridor at 22:15.\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://api.forboc.ai/npcs/npcId/verdict") .header("Authorization", "Bearer ") .header("Content-Type", "application/json") .body("{\n \"generatedOutput\": \"The NPC decides to investigate the strange noise coming from the east corridor.\",\n \"observation\": \"Player reports hearing a mysterious sound near the east corridor at 22:15.\"\n}") .asString(); ``` ```php request('POST', 'https://api.forboc.ai/npcs/npcId/verdict', [ 'body' => '{ "generatedOutput": "The NPC decides to investigate the strange noise coming from the east corridor.", "observation": "Player reports hearing a mysterious sound near the east corridor at 22:15." }', 'headers' => [ 'Authorization' => 'Bearer ', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://api.forboc.ai/npcs/npcId/verdict"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", "Bearer "); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"generatedOutput\": \"The NPC decides to investigate the strange noise coming from the east corridor.\",\n \"observation\": \"Player reports hearing a mysterious sound near the east corridor at 22:15.\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "Bearer ", "Content-Type": "application/json" ] let parameters = [ "generatedOutput": "The NPC decides to investigate the strange noise coming from the east corridor.", "observation": "Player reports hearing a mysterious sound near the east corridor at 22:15." ] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://api.forboc.ai/npcs/npcId/verdict")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```