Skip to content

Component Decorators

In AGBoss (Agent Graph Builder Open Source System) and its declarative specification grammar HarnessDSL, every part of a multi-agent harness is organized as a decorated TypeScript class with a single, clear computational role (Principle 1: Computational Role Segregation). Instead of mixing prompt templates, HTTP calls, branching logic, and safety filters inside monolithic functions, you declare dedicated classes and let @Workflow (HarnessDSL) and @Application wire and verify them at compile time via agboss check.

Decorator Public Entry & File Convention Role in the Application
@Application agboss (*.application.ts) Single assembly root binding workflows, environment, providers, budgets, PII, guardrails, health checks, and observers
@Workflow agboss (*.workflow.ts) Typed state graph declaring flow paths, defaults, compaction, and maxSteps
@WorkflowStart / @WorkflowFinish agboss (*.workflow-start.ts / *.workflow-finish.ts) Entry (input: Dto) and exit (output: Dto / FinishHandler) boundaries of a workflow
@Agent agboss (*.agent.ts + *.prompt.md) LLM reasoning node with model, prompt/promptUrls, tools, rag, judges, input, and output
@Action agboss (*.action.ts) Deterministic TypeScript step (ActionHandler, execute(input)) for code-only workflow nodes
@Router agboss (*.router.ts) Branching component (DecidedBy.Model or DecidedBy.Code) selecting one or more routes
@Arbiter / @OnAnswer agboss (*.arbiter.ts) Quorum consensus voter attached with .acceptedBy() before .joinQuorum()
@Tool / @BindTool agboss (*.tool.ts) Agent-callable capability (ToolHandler<In, Out>, run(input)) with DTO schema validation
@ToolInterceptor agboss (*.tool-interceptor.ts) Cross-cutting pre-call (BeforeToolCall $\to$ ToolCallDecision) and post-call (AfterToolCall) interceptor for @Tool and @McpTool
@Judge agboss (*.judge.ts) Quality gate (JudgeHandler<TReply>, DecidedBy.Model or DecidedBy.Code) inspecting reply DTOs and toolCalls
@Compaction agboss (*.compaction.ts) Conversation history compaction strategy (SummaryQueue, SingleSummary, Custom with CompactionHandler, or None)
@Injectable agboss (*.service.ts) Injectable service or ExecutionObserver with OnInit, OnStart, OnStop, OnDestroy hooks
@HealthCheck agboss (*.health-check.ts) Liveness and readiness probe component (HealthCheckHandler, checkLiveness(), checkReadiness())
@ModelProvider @agboss/core/models (*.model-provider.ts) Model vendor pool (-model-provider suffix) with HTTP or custom ModelProviderHandler transport, serves, promptCaching, rateLimitPolicy, and circuitBreakerPolicy
@Budget agboss (*.config.ts) Spend ceiling (BudgetHandler, maxSpend(): Usd) for Application, Tenant, or Execution scope
@PiiPolicy agboss (*.pii-policy.ts) Declarative rules: [pii(...)] or custom PiiPolicyHandler.findMatches(text) with deterministic HMAC replaceWithToken()
@InputGuardrail & @OutputGuardrail agboss (*.guardrail.ts) Input/output guardrails (DecidedBy.Model with threshold or DecidedBy.Code with GuardrailHandler) across Application, Workflow, and Agent scopes
@ChannelRole / @Channel / @ReplyInterpreter agboss (*.channel.ts) Out-of-process pause role (approves), free-text @ReplyInterpreter, and transport implementation (send(ask), onPauseClosed(event))
@Rag agboss / @agboss/core/rag (*.rag.ts) Knowledge base (RagConnector, SqliteFtsConnector)
@McpServer / @McpTool / @McpExpose agboss / @agboss/core/mcp (*.mcp.ts) Model Context Protocol client servers, typed tools, and server exposure
@A2AAgent & a2aHttpListener agboss / @agboss/core/a2a (*.a2a.ts) Remote Agent-to-Agent protocol client (A2AClient), @Injectable() A2ACallerResolver, and multi-tenant a2aHttpListener
@Text, @ListOf, @Nested, … @agboss/core/dto (*.dto.ts) Field decorators on plain DTO classes compiled to JSON Schema and checked by agboss check

Naming & suffix invariant ([name.kind-suffix])

Section titled “Naming & suffix invariant ([name.kind-suffix])”

Every component decorator enforces a dual naming rule ([name.kind-suffix]):

  1. Its kebab-case name option must end with the component kind’s suffix (for example, "scout-agent", "daily-budget", "tenant-order-tool-interceptor", "support-workflow-start").
  2. Its PascalCase TypeScript class identifier must end with the corresponding suffix (ScoutAgent, DailyBudget, TenantOrderToolInterceptor, SupportWorkflowStart).

This guarantees that both humans and AI coding agents can tell a class’s computational role at a glance in every import and flow chain.

In AGBoss, DTOs are plain TypeScript classes decorated with field decorators from @agboss/core/dto (@Text, @ListOf, @Integer, @Decimal, @Flag). Runtime values returned from tools and actions are plain object literals { ... } (never new MyDto()), and all currency and duration values use factory functions from @agboss/core/units (usd(), seconds(), minutes(), hours()):