SDK Reference

Providing Context & Multi-Turn Data

Prompts rarely exist in a vacuum. Axon allows developers to pass conversational history, code contexts, and custom metadata alongside the prompt. This context directly informs the Judge layer's Ambiguity axis and passes through to the target model.

Context Interface (AxonContext)

await axon.infer("Fix the null pointer in the user profile resolver", {
  context: {
    priorMessages: [
      { role: "user", content: "We are seeing 500 errors when profile.avatar is null" },
      { role: "assistant", content: "Can you provide the resolver code?" },
    ],
    codeContext: "export function resolveAvatar(user: User) { return user.profile.avatar.url; }",
    metadata: {
      userId: "usr_94103",
      environment: "production",
    },
  },
});

Fields

  • priorMessagesOptional | { role: string; content: string }[]

    Conversational history for multi-turn chat applications. Because Axon is completely stateless, prior turns must be supplied by your app on each call.

  • codeContextOptional | string

    Code snippets, schema definitions, or file diffs relevant to the prompt.

  • metadataOptional | Record<string, any>

    Arbitrary developer data (request IDs, user tiers, tracing spans). Passed along the internal execution pipeline for observability.

Context & The Ambiguity Axis

The presence of context heavily influences Stage 2 classification:

Isolated PromptAmbiguity: Unclear

“Fix the reconnect bug” lacks scope. The Judge marks this as Unclear, potentially forcing a higher model tier to reason through ambiguity.

With Code ContextAmbiguity: Clear

“Fix the reconnect bug” paired with codeContext: "WebSocket reconnection logic in client.ts" provides concrete bounds. The Judge marks this as Clear, enabling cost-saving routing to Balanced or Fast.

Statelessness Posture

No Implicit Session Storage

Axon is strictly stateless. It does not cache conversation histories across invocations or manage context-window token limits. If different turns in a conversation route to different model tiers, provider token-limit errors surface directly as standard provider failure statuses.