ドキュメント
DOCS / INTEGRATIONS

One NPC memory flow, six integration paths

Every example uses the same scenario: create an NPC entity, log a witnessed event, then retrieve context before the next dialogue turn.

Use raw HTTP if you are proving the loop. Move into JavaScript, Python, Unity, Unreal, or Godot once the recall step belongs inside the runtime.

Scenario

Mira the innkeeper sees the player leave the old gate at dusk. On the next turn, the game asks Seizn what Mira knows right now.

Raw HTTP

Direct API calls for the shortest possible integration path.

curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/entities \
  -H "Authorization: Bearer $SEIZN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"type":"character","name":"Mira","external_id":"npc_mira"}'

curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/extract \
  -H "Authorization: Bearer $SEIZN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"Mira saw the player leave the old gate at dusk."}'

curl -X POST https://seizn.com/api/v1/graph/$GRAPH_ID/context \
  -H "Authorization: Bearer $SEIZN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"query":"What does Mira know about the player?","max_entities":8}'

JavaScript

Thin server wrapper before you enter the dialogue turn.

const headers = {
  Authorization: `Bearer ${process.env.SEIZN_API_KEY}`,
  "Content-Type": "application/json",
};

await fetch(`https://seizn.com/api/v1/graph/${graphId}/entities`, {
  method: "POST", headers,
  body: JSON.stringify({ type: "character", name: "Mira", external_id: "npc_mira" }),
});
await fetch(`https://seizn.com/api/v1/graph/${graphId}/extract`, {
  method: "POST", headers,
  body: JSON.stringify({ text: "Mira saw the player leave the old gate at dusk." }),
});
const context = await fetch(`https://seizn.com/api/v1/graph/${graphId}/context`, {
  method: "POST", headers,
  body: JSON.stringify({ query: "What does Mira know about the player?", max_entities: 8 }),
}).then((r) => r.json());

Python

Server-authoritative loop for tools, simulation backends, or quest services.

import requests

headers = {
    "Authorization": f"Bearer {SEIZN_API_KEY}",
    "Content-Type": "application/json",
}
requests.post(f"{BASE}/api/v1/graph/{graph_id}/entities", headers=headers, json={
    "type": "character", "name": "Mira", "external_id": "npc_mira"
})
requests.post(f"{BASE}/api/v1/graph/{graph_id}/extract", headers=headers, json={
    "text": "Mira saw the player leave the old gate at dusk."
})
context = requests.post(f"{BASE}/api/v1/graph/{graph_id}/context", headers=headers, json={
    "query": "What does Mira know about the player?", "max_entities": 8
}).json()

Unity C#

Thin client wrapper called before the next NPC bark or dialogue node.

var client = new SeiznClient(baseUrl, apiKey, graphId);
await client.UpsertEntity(new SeiznEntity {
    Type = "character",
    Name = "Mira",
    ExternalId = "npc_mira"
});
await client.ExtractAsync("Mira saw the player leave the old gate at dusk.");
var context = await client.BuildContextAsync(
    "What does Mira know about the player?",
    maxEntities: 8,
    maxDepth: 2
);
dialogueRunner.SetMemoryContext(context.SubgraphDescription);

Godot GDScript

Call Seizn from your dialogue turn or behavior tree script.

var client := SeiznClient.new(base_url, api_key, graph_id)
await client.upsert_entity({
    "type": "character",
    "name": "Mira",
    "external_id": "npc_mira"
})
await client.extract("Mira saw the player leave the old gate at dusk.")
var context = await client.build_context(
    "What does Mira know about the player?",
    8,
    2
)
dialogue_state.memory_context = context.subgraph_description

Unreal C++

Same three calls wrapped behind a gameplay-facing client.

FSeiznClient Client(BaseUrl, ApiKey, GraphId);
co_await Client.UpsertEntity({
    TEXT("character"),
    TEXT("Mira"),
    TEXT("npc_mira")
});
co_await Client.Extract(TEXT("Mira saw the player leave the old gate at dusk."));
const FSeiznContext Context = co_await Client.BuildContext(
    TEXT("What does Mira know about the player?"),
    8,
    2
);
DialogueSubsystem->SetMemoryContext(Context.SubgraphDescription);

Need the reference shape too?

Use the API reference for exact request schemas, then price the rollout once the loop feels right.