Skip to content

armgit / eve

Public Imported from GitHub
0

The Open Framework for Building Agents

979 B
Raw Blame
import {
  defineWorkflowTool,
  type WorkflowToolContext,
  type WorkflowToolDefinition,
} from "eve/tools";
import { z } from "zod";

type Input = { target: "tool-hidden" | "disabled-hidden" };
type Output = {
  description: string;
  result: string | null;
};

async function execute({ target }: Input, ctx: WorkflowToolContext) {
  "use workflow";

  const description = ctx.agents[target]?.description;
  if (description === undefined) {
    throw new Error(`Missing workflow metadata for internal subagent ${target}.`);
  }
  const response = await ctx.agent(target).send("Return your fixed marker.");
  const { message } = await response.result();
  return { description, result: message ?? null };
}

const tool: WorkflowToolDefinition<Input, Output> = defineWorkflowTool({
  description: "Invoke an internal specialist selected by the caller.",
  inputSchema: z.object({
    target: z.enum(["tool-hidden", "disabled-hidden"]),
  }),
  execute,
});

export default tool;