Skip to main content
reopt Handbook
reopt Handbook
Enterprise Eve Agent Development

Core Architecture

Ch1. Eve Mental ModelCh2. Source Code AtlasCh3. Project Layout and DiscoveryCh4. Compiler and Runtime Graph

Agent Quality Design

Ch5. agent.ts, Models, CompactionCh6. Context, Skills, Dynamic CapabilitiesCh7. Tools, Approval, ConnectionsCh8. Sandbox Secure Runtime

Operational Runtime

Ch9. Channels, Auth, StreamingCh10. Subagents, Workflows, Remote AgentsCh11. Schedules, State, HooksCh12. Evals and Quality Gates

Production Operations

Ch13. Observability and DeploymentCh14. Enterprise PatternsCh15. Migration and Governance

Appendix

Official Docs CrosswalkVerification ReportUpdates
Handbook›엔터프라이즈 Eve 에이전트›Ch5. agent.ts, Models, Compaction
한국어English

Ch5. agent.ts, Models, Compaction

Interpret defineAgent configuration as runtime policy for models, output schemas, compaction, and experimental flags.

Key takeaways

  • agent.ts is not just a model picker; it is runtime policy and output contract.
  • outputSchema, compaction, and modelOptions strongly affect long-session quality and cost.
  • Experimental flags and hosted-build packaging controls need owners and release gates.

agent/agent.ts configures runtime behavior. In small demos it often only selects a model. In enterprise systems it decides model routing, output contracts, long-session memory behavior, and unstable feature adoption.

Basic Form

agent/agent.ts
import { defineAgent } from "eve";

export default defineAgent({
  model: "anthropic/claude-sonnet-4.6",
});

The official agent.ts docs clarify two important rules:

RuleOperational meaning
Root agent.ts can be omitted when no runtime config is neededUseful for tiny agents, but production agents should pin model/config for review.
If agent.ts is present, model is requiredDo not hide policy behind an empty defineAgent({}).

The scaffold default is anthropic/claude-sonnet-4.6; stronger examples often use anthropic/claude-opus-4.8. Treat these as routing examples, not universal recommendations.

Model Routing Strategy

Model definitionExampleAdvantageCaution
Gateway model id string"anthropic/claude-opus-4.8"Vercel AI Gateway routing, central policy, OIDC flowReview Gateway model catalog and policy.
AI SDK LanguageModelanthropic("claude-opus-4.8")Direct provider controlInstall provider package and manage provider key/terms.

For enterprise teams, Gateway-routed models are usually the default because usage, fallback, cost, and policy can be centralized. Direct provider models are still valid when specific provider options or self-host constraints require them.

Model Selection Matrix

Agent typeSelection criteria
customer supportlow latency, stable instruction following, safety behavior
internal researchlong context, tool reasoning, citation discipline
code/file worktool-call stability, sandbox behavior, large context
back-office automationstructured output reliability and approval UX
eval judgeconsistency, cost, and separation from agent-under-test

The goal is not "the smartest model." The goal is the model with the lowest failure cost for the capability surface.

modelOptions

modelOptions forwards provider-specific tuning such as temperature, reasoning effort, or provider metadata.

Operating rules:

  • separate reasoning-heavy agents from transactional agents
  • gate model option changes like prompt changes
  • record model id and options in eval results
  • document provider-specific portability risks

outputSchema

outputSchema is not a global enforcement mechanism for every chat reply. Official docs describe it as the structured return type for task-mode runs such as subagents, schedules, or remote jobs. Clients may also pass per-turn schemas.

Good uses:

ScenarioWhy
subagent result aggregationparent needs machine-readable results
scheduled reportdownstream job reads JSON
remote agent delegationdeployment-to-deployment contract
eval targetexact schema assertions
agent/subagents/risk-reviewer/agent.ts
import { defineAgent } from "eve";
import { z } from "zod";

export default defineAgent({
  description: "Review a proposed operation and return risk level and required approvals.",
  model: "anthropic/claude-opus-4.8",
  outputSchema: z.object({
    risk: z.enum(["low", "medium", "high"]),
    requiredApprovals: z.array(z.string()),
    rationale: z.string(),
  }),
});

Compaction

The default harness summarizes older turns as the context window fills. The default threshold is 90%.

agent/agent.ts
export default defineAgent({
  model: "anthropic/claude-opus-4.8",
  compaction: {
    thresholdPercent: 0.75,
  },
});

Compaction saves context and cost, but it is also a risk surface. A bad summary can corrupt the factual base of a long session.

WorkloadRecommended policy
short FAQ/supportdefault threshold
long researchcompact earlier; persist key artifacts in files/state
coding/file workread-before-write evidence can disappear from summary
regulated decisioningexternalize important evidence
multi-subagent workstructure child results before parent aggregation

Experimental Flags

Official docs mark experimental.codeMode as unstable. ExperimentalWorkflow is covered separately under Dynamic Workflows. Both require stricter release gates.

FeatureMeaningProduction standard
codeModemodel-authored JavaScript can call tools through a sandboxed wrapperlimited internal agents only
ExperimentalWorkflowmodel-authored JavaScript orchestrates subagentssubagent-only coordination, no direct side effects

Hosted Build Packaging

build.externalDependencies keeps selected packages external in hosted output. It is packaging control, not security approval.

Review:

  • package install availability in target host
  • third-party SDK network and data behavior
  • security review for externalized dependency
  • parity between Vercel and self-host environments

Review Checklist

ItemQuestion
modelIs the routing path approved?
modelOptionsAre behavior and cost intended?
outputSchemaIs task-mode structure needed here?
compactionCan the workload tolerate summary drift?
experimentalAre unstable features scoped and evaluated?
buildAre external dependencies reviewed and deployable?

Related docs

AI Gateway Control Plane

Vercel Enterprise AI Platform · Centralize model routing, provider fallback, usage policy, and cost governance.

References

Vercel Enterprise AI Platform · Source categories for adapting the Vercel enterprise AI platform handbook.

Vercel Enterprise AI Platform

A platform handbook for designing enterprise AI products with AI SDK, AI Gateway, Workflow, Sandbox, and Queues.

Models and Reasoning

Advanced Codex Usage · Choose GPT-6 Astra, GPT-5.6 Sol, Terra, Luna, and reasoning levels by task risk, cost, and latency.

Ch6. Cost and Latency Optimization

LLMOps and AgentOps in Production · Manage unit cost and response time without sacrificing quality

Ch4. Compiler and Runtime Graph

How Eve transforms source manifests into compiled manifests and runtime agent graphs.

Ch6. Context, Skills, Dynamic Capabilities

Design context, skills, dynamic tools, dynamic instructions, and dynamic skills for high-quality Eve agents.

On this page

Basic FormModel Routing StrategyModel Selection MatrixmodelOptionsoutputSchemaCompactionExperimental FlagsHosted Build PackagingReview Checklist