Create answer
Answers a question from the whole graph and cites the assertions it rests on.
POST /v1/graph/answer
| Address | https://api.hanzo.ai/v1/graph/answer |
| Method | POST |
| Operation | graphAnswer |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Answers a question from the whole graph and cites the assertions it rests on.
It asks a model what each community's in-force facts say about the question, then asks once more for one answer from those findings. Every cited ID is checked to be a row of this graph, a failed model call fails the answer, and the calls are billed to the calling organization.
Time: as_of and as_known place the graph that is read; either absent is now.
Request
3 fields, body application/json (required).
| Field | In | Type | Required | Description |
|---|---|---|---|---|
as_known | body | string | — | AsKnown is how much this plane had heard, RFC 3339: the answer as it would have been given then, which is what makes a past answer reproducible. |
as_of | body | string | — | AsOf answers from the graph as it stood at an instant of the world, RFC 3339: what held then. |
question | body | string | yes | Question is what to answer, in words, 1000 bytes at most. |
Response
| Status | Body | Meaning |
|---|---|---|
200 | graph.graphAnswerOut | ok |
default | problem-details | refused |
200 body — 15 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
answer | body | string | — | Answer is the answer, in prose. |
as_known | body | string | — | AsKnown is the knowledge instant it was taken at, RFC 3339, the same way. |
as_of | body | string | — | AsOf is the instant the graph was read at, RFC 3339: the one asked for, or the server's clock when none was. |
asked | body | integer (int64) | — | Asked is how many communities were read. |
assertions | body | string[] | — | Assertions are the IDs of every assertion the answer rests on, ascending. |
calls | body | integer (int64) | — | Calls is how many model calls the answer made, each billed to the calling organization. |
clipped | body | boolean | — | Clipped says the answer did not read all it gathered: a community held more facts than one call carries, or more members than one answer reads, and kept the ones the question named and then the most connected; a member held more than 64 assertions and kept its newest; or the findings held more than the answering call carries and kept the highest scored. |
communities | body | integer (int64)[] | — | Communities are every community the answer rests on, ascending. |
findings | body | graph.graphFinding[] | — | Findings are the findings the answer cites, most relevant first. |
findings[].assertions | body | string[] | — | Assertions are the IDs of the assertions it cites, each a row a read of this graph returns. |
findings[].communities | body | integer (int64)[] | — | Communities are the communities of the facts it cites, at level 0 of the partition at AsOf — the ids POST /v1/graph/communities answers with. |
findings[].score | body | integer (int64) | — | Score is how much the model judged it helps, 1 to 100. |
findings[].text | body | string | — | Text is what the model found, in its words. |
grounded | body | boolean | — | Grounded is false when no community held a fact bearing on the question, or the findings did not answer it. |
skipped | body | integer (int64) | — | Skipped is how many were not, because one answer makes at most eight map calls and reads at most 2048 entities. |
Failure carries the platform error shape — see Errors.
Examples
CLI
SDK
HTTP
MCP
hanzo graph answer.ts
.py
.go
.rs
.java
import { Configuration, GraphApi } from 'hanzoai';
const api = new GraphApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.graphAnswer({ question: "<question>" });from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import GraphApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = GraphApi(client).graph_answer(question="<question>")cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)
resp, _, err := client.GraphAPI.GraphAnswer(context.Background()).Execute()
if err != nil {
return err
}use hanzo_client::apis::{configuration::Configuration, graph_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = graph_api::graph_answer(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.GraphApi;
ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));
var result = new GraphApi(client).graphAnswer();curl -X POST https://api.hanzo.ai/v1/graph/answer \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"question": "<question>"
}'Tool graph, op graphAnswer — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "graph",
"arguments": {
"op": "graphAnswer",
"input": {
"question": "<question>"
}
}
}
}'Was this page useful?