> For the complete documentation index, see [llms.txt](https://docs.talus.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talus.network/guides/tool-development/tool-communication.md).

# Tool Communication

{% hint style="info" %}
**Audience:** Nexus adopters and integrators.

**Goal:** Configure and verify the HTTP and signed-message boundary between a leader and an off-chain Tool without weakening the Tool contract.
{% endhint %}

The `nexus-toolkit` runtime turns a `NexusTool` implementation into an HTTP server with `GET /health`, `GET /meta`, and `POST /invoke` endpoints. The documented operator profile requires authenticated HTTPS on both the public Leader-to-gateway hop and the gateway-to-Toolkit hop. Set both `NEXUS_TOOL_TLS_CERT_PATH` and `NEXUS_TOOL_TLS_KEY_PATH` for Toolkit TLS. The runtime also supports plain HTTP when both TLS paths are absent, including behind an external HTTPS gateway, but a plaintext gateway-to-Toolkit hop does not meet this profile. Point the runtime at `NEXUS_TOOLKIT_CONFIG_PATH` and provide an allowlist of permitted Leaders produced by `nexus tool auth export-allowed-leaders`.

Signed HTTP v3 keeps the Leader signature over the schema-ordered canonical input hash and the Tool response signature over the response domain, Leader signature, deterministic invocation nonce, and canonical response commitment. The API remains `signed_http::v3`, and the wire-version header remains `X-Nexus-Sig-V: 3`. Protocol revision v3.1 adds a separate Leader context signature in `nexus-context-sig` and its Unix-millisecond timestamp in `nexus-context-timestamp`; the context signature binds the receiving Tool FQN, invocation nonce, and timestamp without changing the existing input or result signature transcripts. In required mode, the Toolkit checks the context signature against the local Leader allowlist and applies the configured symmetric freshness window, which defaults to 30,000 ms and includes both endpoints, before replay-cache access. Gateways must forward every signed request and response header without renaming or dropping it, including both context headers. The context signature does not cover the HTTP method, path, query, raw body bytes, arbitrary headers, or status; authenticated HTTPS protects these transport fields.

`GET /meta` advertises an external HTTPS URL and ignores `X-Forwarded-Proto`; that metadata does not prove that the active listener is TLS-protected. When per-Tool client-certificate binding is enabled, TLS must terminate in the Toolkit or pass through to it so the Toolkit can inspect the TLS peer key. Forwarded certificate headers do not establish that peer key. Nexus consumes three public endpoints:

* `GET /meta` advertises the FQN, schemas, timeout, and URL;
* `POST /invoke` carries the signed input and returns one output variant;
* `GET /health` is the readiness check that validation and orchestration use before registration.

The runtime contract is intentionally small: initialize the tool implementation, bootstrap the server, keep the signing key and allowlist local, and let the CLI validate and register the endpoint. The toolkit reference documents the Rust API surface, while this guide explains the runtime behavior that operators need to run and secure a tool.

#### Prerequisites

* A running off-chain Tool that implements the published HTTP contract; see [Build an Off-Chain Tool](https://docs.talus.network/guides/tool-development/build-offchain-tool.md).
* The Tool FQN and endpoint URL.
* A configured CLI identity and the authority required to register Tool communication keys.

#### Illustrative request and result flow

1. Start the Tool and confirm `GET /health` returns success.
2. Confirm `GET /meta` returns the FQN, timeout, and input/output schemas that will be registered.
3. Register or rotate the Tool signing key, then export the allowed-leader data for the Tool runtime.
4. Submit one `POST /invoke` request through the normal leader path. The result must select one declared output variant and match its schema.

The durable on-chain evidence is the Tool registration and its active key binding. The HTTP request and response bodies, nonces, hashes, and signatures form the transcript used when the vertex selects `RegisteredKey`; the transient request itself is not a durable object.

#### Verification

Use `nexus tool validate offchain --url <URL>` to check the health and metadata surface before registration. After registration, inspect the Tool by FQN and run one bounded workflow execution. Record the Tool FQN, key id, Task or Execution ID, and result variant so a failed response can be compared with the registered schema and active key configuration.

#### Common failures and recovery

* **Health or metadata fails:** fix the endpoint before registration; do not register a URL whose observed schema differs from the intended Tool contract.
* **Signature verification rejects a response:** check the active Leader and Tool keys, transcript nonces, body hashes, and proxy behavior. A correctly signed payload is authenticated, not independently proven semantically true.
* **Output schema mismatch:** return a declared output variant or update the Tool contract through the appropriate registration/upgrade path; do not retry the same incompatible result.

#### Next

Continue with [Verify an Off-Chain Tool Result](https://docs.talus.network/guides/tool-development/verify-offchain-tool-result.md) to choose and inspect the per-vertex verifier mode.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.talus.network/guides/tool-development/tool-communication.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
