Skip to main content

apps/gateway/src/services/agentfield-client.ts

Metadata

Indexed Symbols

  • buildExecuteUrl (line 20, function) - Implements build execute url for service-layer operations.
  • normalizeStatus (line 37, function) - Implements normalize status for service-layer operations.
  • parseExecutionResponse (line 44, function) - Implements parse execution response for service-layer operations.
  • enqueueAgentExecution (line 57, function) - Implements enqueue agent execution for service-layer operations.

Markdown Headings (if applicable)

No markdown headings detected.

Source Preview

import type { ExecuteAgentRequest } from "@anchor/contracts";
import { env } from "../config/env.js";
import { resolveSecretValue } from "./runtime-config.js";

export type ExecutionHandle = {
executionId: string;
status: "queued" | "running";
acceptedAt: string;
};

type AgentFieldExecutionResponse = {
executionId?: string;
id?: string;
runId?: string;
status?: string;
acceptedAt?: string;
createdAt?: string;
};

function buildExecuteUrl(agent: string, reasoner: string): string {
if (!env.agentFieldUrl) {
throw new Error("AGENTFIELD_URL is required for execution dispatch");
}

const relativePath = env.agentFieldExecutePathTemplate