Create answer

Answers a question from the whole graph and cites the assertions it rests on.

POST /v1/graph/answer

Addresshttps://api.hanzo.ai/v1/graph/answer
MethodPOST
OperationgraphAnswer
AuthAuthorization: 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).

FieldInTypeRequiredDescription
as_knownbodystring—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_ofbodystring—AsOf answers from the graph as it stood at an instant of the world, RFC 3339: what held then.
questionbodystringyesQuestion is what to answer, in words, 1000 bytes at most.

Response

StatusBodyMeaning
200graph.graphAnswerOutok
defaultproblem-detailsrefused

200 body — 15 fields.

FieldInTypeAlwaysDescription
answerbodystring—Answer is the answer, in prose.
as_knownbodystring—AsKnown is the knowledge instant it was taken at, RFC 3339, the same way.
as_ofbodystring—AsOf is the instant the graph was read at, RFC 3339: the one asked for, or the server's clock when none was.
askedbodyinteger (int64)—Asked is how many communities were read.
assertionsbodystring[]—Assertions are the IDs of every assertion the answer rests on, ascending.
callsbodyinteger (int64)—Calls is how many model calls the answer made, each billed to the calling organization.
clippedbodyboolean—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.
communitiesbodyinteger (int64)[]—Communities are every community the answer rests on, ascending.
findingsbodygraph.graphFinding[]—Findings are the findings the answer cites, most relevant first.
findings[].assertionsbodystring[]—Assertions are the IDs of the assertions it cites, each a row a read of this graph returns.
findings[].communitiesbodyinteger (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[].scorebodyinteger (int64)—Score is how much the model judged it helps, 1 to 100.
findings[].textbodystring—Text is what the model found, in its words.
groundedbodyboolean—Grounded is false when no community held a fact bearing on the question, or the findings did not answer it.
skippedbodyinteger (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

hanzo graph answer
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>"
           }
         }
       }
     }'

Graph API · All Hanzo APIs · Interactive reference

Was this page useful?