Skip to main content
Follow these guidelines to build reliable, secure, and efficient AI agents with Knot.

Authentication

Store JWT tokens in environment variables or a secrets manager. Never commit tokens to source control or include them in log output.
Proactively refresh your token before it expires to avoid mid-operation failures.
Watch for unauthorized responses and re-authenticate automatically rather than surfacing errors to users.

Transactions

Include Idempotency-Key headers on all financial operations — transfers, trades, and liquidity operations.
Generate a new idempotency key for each intended operation. Reuse the same key only when retrying after a network timeout.
Verify sufficient funds are available before attempting transfers to avoid unnecessary 400 errors.
Set slippage tolerance based on the liquidity profile of the token pair.
Validate recipient addresses before sending funds. For high-value agents, use a recipient whitelist in your policy.

Policy management

Start conservative

Begin with low limits (100pertransaction,100 per transaction, 500 daily) and increase them only as you understand your agent’s actual needs.

Use recipient whitelists

For high-value agents, configure allowedRecipients to restrict which addresses can receive funds.

Disable unused features

Turn off trading, liquidity provision, or prediction markets if your agent doesn’t use them — this reduces your attack surface.

Monitor spending patterns

Track daily spending via audit logs before raising limits. Understand normal usage before expanding permissions.

Error handling

When you hit rate limits or temporary service errors, wait progressively longer between retries.
4xx errors indicate a problem with your request — a bad parameter, a policy violation, or an expired token. Fix the underlying issue before retrying.
The exception is 401: you can re-authenticate and retry. For all other 4xx errors, inspect the message field to understand what needs to change.
Never reuse an idempotency key after receiving an error response. The cached error will be returned again.
Maintain detailed error logs for debugging and monitoring.
If you’re unsure whether a transaction succeeded, check the Solana chain directly rather than assuming success or failure.

Skill discovery

Load the capability spec when your agent initializes so it has accurate API knowledge before making calls.
Cache skill.md locally to reduce API calls, but re-fetch it daily or weekly to pick up new endpoints and features.