Auto-generated Helpers
When you write custom endpoint code, shell scripts, scheduled tasks, AI tools, or migrations, you constantly refer to node types, field names, edge types, endpoints, AI tools, agents, prompt templates, and indexes defined in your workspace.
Instead of hardcoding those names and UIDs as strings, the CodeManager generates strongly-typed helper classes from your current schema and configuration and prepends them to your code before it is compiled. The helpers are regenerated whenever the underlying definitions change, so they always match what's in the graph.
Use the helpers, never raw strings or UIDs
Reference N.SupportCase.Status instead of "Status", and AI_Tools.SearchKnowledgeBase instead of a hand-copied UID. A typo in a string fails silently at runtime; a typo against a helper fails to compile. Renaming or deleting a definition surfaces immediately as a build error rather than a wrong result in production.
Available helpers
| Helper | Covers | Member type |
|---|---|---|
N |
Node types and their field names | string constants |
E |
Edge types | string constants |
Endpoints |
Custom endpoint paths (nested by path) | EndpointUID |
AI_Tools |
AI tools | UID128 |
Agents |
Agents | AgentUID (+ id lookups) |
PromptTemplates |
Prompt templates | PromptTemplateUID |
Indexes |
Indexes, grouped by node type | IndexUID |
N — node types and fields
N exposes your schema as nested static classes, one per node type, each with a Type constant and one constant per field.
N.MyType.Type— the node type name (e.g."MyType").N.MyType.MyField— a field name (e.g."MyField").
var openCases = Q()
.StartAt(N.SupportCase.Type)
.WhereString(N.SupportCase.Type, N.SupportCase.Status, "Open")
.ToList();
foreach (var node in openCases)
{
var summary = node.GetString(N.SupportCase.Summary);
}
E — edge types
E exposes your edge types as string constants. Use them when traversing or reading edges.
// Manufacturer -> Device, via a specific edge type
Q().StartAt(N.Manufacturer.Type, "Apple")
.Out(N.Device.Type, E.Manufactures);
Endpoints — endpoint paths
Endpoints mirrors your endpoint path tree: an endpoint at sales/calculate-bonus becomes Endpoints.Sales.CalculateBonus. Each leaf is an EndpointUID (a wrapper over the path). When a path is both a parent and an endpoint, the endpoint itself is exposed as a nested Path member. Pass these to RunEndpointAsync to call another endpoint in-process.
public record BonusResult(decimal Amount);
var bonus = await RunEndpointAsync<BonusResult>(Endpoints.Sales.CalculateBonus, body);
AI_Tools — AI tools
AI_Tools exposes each AI tool as a UID128, keyed by the tool's display name. Pass them to RunToolAsync.
var result = await RunToolAsync<string>(
AI_Tools.SearchKnowledgeBase,
functionName: "search",
argumentsJson: $"{{\"query\":\"laptop overheating\",\"top_k\":5}}");
Agents — agents
Agents exposes each agent as an AgentUID, keyed by the agent's name. It also generates two helpers to convert between the AgentUID and the kebab-case id that LLMs use:
string id = Agents.GetAgentId(Agents.SupportTriage); // "support-triage"
AgentUID uid = Agents.GetAgentUID("support-triage"); // round-trips back
PromptTemplates — prompt templates
PromptTemplates exposes each prompt template as a PromptTemplateUID, keyed by name — pass it wherever a prompt template is expected instead of copying its UID.
var template = PromptTemplates.SummarizeCase;
Indexes — index UIDs
Indexes groups your indexes by node type, with one IndexUID member per index named {IndexType}_{FieldName} (file-content indexes are named FileContentTextIndex). Use them to target a specific index for similarity search instead of looking it up at runtime.
// Nearest products to a given product, restricted to a named vector index
return Q().StartAt(N.Product.Type, "SKU-1234")
.Similar(indexUID: Indexes.Product.SentenceEmbeddings_Name, count: 10)
.EmitWithScores();
IntelliSense in the code editor lists the exact member names available for your schema. For the full similarity API, see Similarity Search with IQuery.
Why use them
- Compile-time safety — typos and references to renamed or deleted definitions are caught when the code compiles, not at runtime.
- Refactoring support — renaming a field or endpoint either updates the helper or breaks the code, prompting a fix.
- Autocomplete — IntelliSense lists every node type, field, endpoint, tool, agent, and index in your workspace.
- Correct UIDs —
EndpointUID,AgentUID,PromptTemplateUID, andIndexUIDare filled in from the live graph, so you never paste a stale or malformed UID.
Where these helpers are available
CodeManager injects the same helper set into every server-side code scope. See the scope reference for the objects and methods available alongside the helpers in each context:
- Endpoint Execution Scopes — custom endpoints (writable and read-only).
- Shell & Migration Scopes — the Admin Shell, the Query tab, and migrations.
- AI Tools Scope — code-backed AI tools.
Scheduled tasks, data connectors, and custom-code indexes receive the same helpers.
Opting out
Injection is automatic. If you need the raw, un-augmented code — for example when pasting a snippet that already defines a conflicting N or Endpoints symbol — add the marker //#SKIP-INJECT anywhere in your code and CodeManager will compile it verbatim, without prepending the helpers.
"Related"
For the full set of objects and methods available in your code, see Endpoint Execution Scopes. To share helper methods and types across endpoints, see Importing Endpoint Code.