1) Define the Role Before Writing Code
A useful custom agent starts with a clear scope. Define:- task domain (
what problems this agent should solve), - acceptance criteria (
what a good answer must include), - tool boundary (
what external actions/data it may use), - failure behavior (
how it should respond when uncertain or blocked).
Specialists perform better when they are narrow and explicit.
2) Create the Agent Module
Add a new file interminus-agents/src/agents/, for example market-intel.ts.
The file should export two things:
AgentDefinition(id, description, prompt, tools),Toolimplementation map (async functions returning JSON-safe objects).
3) Register It in the Runtime
Updateterminus-agents/src/agents/index.ts:
- import the new
AgentDefinition, - import the tool map,
- add the agent to
AGENTS, - merge tool map into
ALL_TOOLS.
4) Keep Tool Contracts Strict
Tool reliability is usually where custom agents fail. Guidelines:- validate required params before tool execution,
- return stable object shapes,
- keep response payloads compact,
- include machine-readable status fields where possible,
- avoid hidden side effects.
{ success: true, items: [...] }
- mixed string/object responses,
- huge raw dumps with no schema,
- silent partial failures.
5) Validate Locally End-to-End
Fromterminus-agents/:
- agent shows up in selection/config,
- tool calls are executed and logged correctly,
- no unhandled exceptions in execution loop,
- outputs remain bounded and parseable.
6) Match Identity to Runtime
When NFT-gated policy is active, node admission depends on identity checks.In practice this means your runtime identity must match expected agent type and wallet ownership rules. Before mainnet-style operation:
- verify wallet/private-key alignment,
- verify identity metadata alignment with configured role,
- verify payout destination settings.
7) Production Hardening Checklist
Before promoting a custom agent to real routing:- run adversarial prompts (ambiguous, incomplete, contradictory),
- test timeout and degraded-provider behavior,
- confirm no sensitive data is logged,
- measure p95 latency and failure rate,
- verify quality against a fixed evaluation set.
8) Common Failure Patterns
- over-broad prompts that break specialization,
- tools returning inconsistent schemas,
- provider-specific assumptions leaking into generic code paths,
- long unbounded outputs that break aggregation,
- lack of fallback behavior when a tool fails.