Skip to content

@cascade-fyi/sati-agent0-sdk

Thin adapter that wraps @cascade-fyi/sati-sdk with agent0-sdk types (AgentId, Feedback, AgentSummary, etc.). Use this if your codebase already depends on agent0-sdk or you need ERC-8004 type compatibility. For Solana-native development, start with sati-sdk directly.

SatiAgent0

Constructor

typescript
import { SatiAgent0 } from "@cascade-fyi/sati-agent0-sdk";

const sdk = new SatiAgent0(config: SatiAgent0Config);

SatiAgent0Config

FieldTypeRequiredDescription
network"mainnet" | "devnet" | "localnet"YesSATI network
signerKeyPairSignerNoServer-side write access
transactionSenderSatiTransactionSenderNoBrowser wallet write access
rpcUrlstringNoCustom RPC URL (overrides network default)
pinataJwtstringNoPinata JWT for IPFS uploads
onWarning(warning: SatiWarning) => voidNoNon-fatal warning callback

Properties

PropertyTypeDescription
network"mainnet" | "devnet" | "localnet"Configured network
chainstringCAIP-2 chain reference
isReadOnlybooleantrue if no signer/sender configured
satiSatiUnderlying low-level SATI client
feedbackSchemastring | undefinedFeedback schema address
feedbackPublicSchemastring | undefinedFeedbackPublic schema address
validationSchemastring | undefinedValidation schema address
lookupTablestring | undefinedAddress Lookup Table address

Agent Methods

createAgent

Create a new agent in memory. Call agent.registerIPFS() or agent.registerHTTP() to register on-chain.

typescript
sdk.createAgent(name: string, description: string, image?: URI): SatiAgent

loadAgent

Load an existing agent by its CAIP-2 agent ID.

typescript
await sdk.loadAgent(agentId: AgentId): Promise<SatiAgent>

searchAgents

Search agents with filters.

typescript
await sdk.searchAgents(
  filters?: SearchFilters,
  options?: SatiSearchOptions,
): Promise<AgentSummary[]>

SatiSearchOptions extends agent0-sdk's SearchOptions:

FieldTypeDefaultDescription
includeFeedbackStatsbooleanfalseFetch feedbackCount + averageValue per agent (slower)
limitnumber100Max results
offsetbigint-Offset (1-based member number) for pagination
sortstring[]-Sort keys, e.g. ["averageValue:desc"]

SearchFilters - agent0-sdk compatible. Key fields:

FieldTypeDescription
namestringSubstring match on agent name
agentIdsAgentId[]Filter to specific agents
hasMCP / hasA2AbooleanRequire endpoint type
mcpTools / a2aSkillsstring[]Match at least one listed tool/skill
activebooleanFilter by active status
x402supportbooleanFilter by x402 support
feedbackFeedbackFiltersReputation-based filtering
oasfSkills / oasfDomainsstring[]OASF taxonomy match

transferAgent

Transfer agent ownership.

typescript
await sdk.transferAgent(
  agentId: AgentId,
  newOwner: Address,
): Promise<SolanaTransactionHandle<{ txHash: string; from: string; to: string; agentId: AgentId }>>

Feedback Methods

giveFeedback

Give feedback to an agent. Uses FeedbackPublicV1 schema.

typescript
await sdk.giveFeedback(
  agentId: AgentId,
  value: number | string,       // 0-100
  tag1?: string,
  tag2?: string,
  endpoint?: string,
  feedbackFile?: FeedbackFileInput,
): Promise<SolanaTransactionHandle<Feedback>>

SATI-specific fields can be passed via feedbackFile:

  • feedbackFile.outcome - Outcome.Negative | Outcome.Neutral | Outcome.Positive (default: Neutral)
  • feedbackFile.taskRef - Uint8Array (32 bytes, default: random)

prepareFeedbackFile

Build an optional off-chain feedback file payload.

typescript
sdk.prepareFeedbackFile(
  input: FeedbackFileInput,
  extra?: Record<string, unknown>,
): FeedbackFileInput

prepareFeedback

Prepare feedback for browser wallet signing (step 1 of 2).

typescript
await sdk.prepareFeedback(
  agentId: AgentId,
  value: number,
  tag1?: string,
  tag2?: string,
  opts?: {
    endpoint?: string;
    text?: string;
    counterparty?: string;
    outcome?: Outcome;
    taskRef?: Uint8Array;
  },
): Promise<PreparedFeedback>

submitPreparedFeedback

Submit wallet-signed feedback (step 2 of 2). Requires a KeyPairSigner on the SDK.

typescript
await sdk.submitPreparedFeedback(
  prepared: PreparedFeedback,
  counterpartySignature: Uint8Array,
): Promise<SolanaTransactionHandle<Feedback>>

searchFeedback

Search feedback with filters.

typescript
await sdk.searchFeedback(
  filters: FeedbackSearchFilters,
  options?: SatiFeedbackSearchOptions,
): Promise<Feedback[]>

SatiFeedbackSearchOptions:

FieldTypeDefaultDescription
includeTxHashbooleanfalsePopulate txHash per result (1 RPC call each)
minValue / maxValuenumber-Filter by value range

FeedbackSearchFilters - key fields:

FieldTypeDescription
agentIdAgentIdFilter to specific agent
agentsAgentId[]Filter to multiple agents
reviewersAddress[]Filter by reviewer wallet(s)
tagsstring[]Filter by tag1/tag2

getReputationSummary

Aggregate feedback stats for an agent.

typescript
await sdk.getReputationSummary(
  agentId: AgentId,
  tag1?: string,
  tag2?: string,
): Promise<{ count: number; averageValue: number }>

revokeFeedback

Revoke feedback. Two overloads:

typescript
// Preferred: pass Feedback object (stable addressing)
await sdk.revokeFeedback(feedback: Feedback): Promise<SolanaTransactionHandle<Feedback>>

// Legacy: by index (fragile)
await sdk.revokeFeedback(agentId: AgentId, feedbackIndex: number): Promise<SolanaTransactionHandle<Feedback>>

revokeFeedbackByAddress

Revoke by compressed account address.

typescript
await sdk.revokeFeedbackByAddress(
  compressedAddress: string,
): Promise<SolanaTransactionHandle<{ signature: string }>>

Validation Methods

searchValidations

Query validation attestations for an agent.

typescript
await sdk.searchValidations(agentId: AgentId): Promise<ValidationResult[]>

ValidationResult:

FieldTypeDescription
outcomenumber0=Negative, 2=Positive
agentMintstringAgent mint address
counterpartystringValidator address
createdAtnumberUnix timestamp (approximate)
compressedAddressstringFor tx lookup

SatiAgent

Returned by sdk.createAgent() or sdk.loadAgent().

Properties

PropertyTypeDescription
agentIdAgentId | undefinedSet after registration
agentURIURI | undefinedOn-chain metadata URI
namestringAgent name
descriptionstringAgent description
imageURI | undefinedAvatar URL
mcpEndpointstring | undefinedMCP server URL
a2aEndpointstring | undefinedA2A agent card URL
walletAddressAddress | undefinedPayment wallet
mcpToolsstring[]Auto-fetched MCP tools
mcpPromptsstring[]Auto-fetched MCP prompts
mcpResourcesstring[]Auto-fetched MCP resources
a2aSkillsstring[]Auto-fetched A2A skills
oasfSkillsstring[]OASF skill slugs
oasfDomainsstring[]OASF domain slugs

Configuration Methods

All return this for chaining (except async methods).

typescript
await agent.setMCP(endpoint: string, version?: string, autoFetch?: boolean): Promise<this>
await agent.setA2A(agentcard: string, version?: string, autoFetch?: boolean): Promise<this>
agent.setENS(name: string, version?: string): this
agent.setWallet(addr: Address): this
agent.addSkill(slug: string): this
agent.removeSkill(slug: string): this
agent.addDomain(slug: string): this
agent.removeDomain(slug: string): this
agent.setActive(active: boolean): this
agent.setX402Support(x402Support: boolean): this
agent.setTrust(reputation?: boolean, cryptoEconomic?: boolean, teeAttestation?: boolean): this
agent.setMetadata(kv: Record<string, unknown>): this
agent.updateInfo(name?: string, description?: string, image?: URI): this
agent.removeEndpoint(opts?: { type?: EndpointType; value?: string }): this
agent.removeEndpoints(): this

Registration Methods

typescript
// Register new agent via IPFS (requires pinataJwt in SDK config)
await agent.registerIPFS(): Promise<SolanaTransactionHandle<RegistrationFile>>

// Register new agent via HTTP URI
await agent.registerHTTP(agentUri: URI): Promise<SolanaTransactionHandle<RegistrationFile>>

// Update existing agent's IPFS metadata
await agent.updateIPFS(): Promise<SolanaTransactionHandle<RegistrationFile>>

// Update existing agent's URI to HTTP endpoint
await agent.updateHTTP(agentUri: URI): Promise<SolanaTransactionHandle<RegistrationFile>>

// Transfer agent to new owner
await agent.transfer(newOwner: Address): Promise<SolanaTransactionHandle<...>>

SolanaTransactionHandle<T>

Returned by all write operations. Compatible with agent0-sdk's TransactionHandle<T> pattern.

MemberTypeDescription
hashstringTransaction signature (base58)
waitMined()Promise<{ receipt: SolanaReceipt; result: T }>Resolves immediately (Solana confirms before returning)
waitConfirmed()Promise<{ receipt: SolanaReceipt; result: T }>Alias for waitMined()
typescript
const handle = await sdk.giveFeedback(agentId, 85);
console.log(handle.hash);                         // signature
const { result: feedback } = await handle.waitMined();

Error Classes

All extend SatiError which has a code: string property.

ClassCodeThrown When
SatiErrorvariesBase class for all errors
AgentNotFoundErrorAGENT_NOT_FOUNDAgent mint doesn't exist on-chain
ReadOnlyErrorREAD_ONLYWrite op without signer/sender
SignerRequiredErrorSIGNER_REQUIREDOp needs KeyPairSigner (not just TransactionSender)
SchemaNotDeployedErrorSCHEMA_NOT_DEPLOYEDSAS schema missing on configured network
InvalidAgentIdErrorINVALID_AGENT_IDMalformed CAIP-2 agent ID
UnsupportedOperationErrorUNSUPPORTED_OPERATIONOp not available on SATI (e.g. appendResponse)

Re-exports

The package re-exports commonly used types so consumers don't need to install agent0-sdk or @cascade-fyi/sati-sdk directly:

typescript
// agent0-sdk types
import type { AgentSummary, Feedback, RegistrationFile, AgentId } from "@cascade-fyi/sati-agent0-sdk";
import { EndpointType, TrustModel, EndpointCrawler } from "@cascade-fyi/sati-agent0-sdk";

// SATI types and constants
import { SolanaTransactionHandle, SatiError, AgentNotFoundError } from "@cascade-fyi/sati-agent0-sdk";
import { Outcome, ContentType, SATI_PROGRAM_ADDRESS } from "@cascade-fyi/sati-agent0-sdk";
import { parseFeedbackContent, getImageUrl, handleTransactionError } from "@cascade-fyi/sati-agent0-sdk";

Adapter Utilities

typescript
import {
  SOLANA_CAIP2_CHAINS,        // { mainnet, devnet, localnet }
  formatSatiAgentId,           // (mint, chain) => AgentId
  parseSatiAgentId,            // (agentId) => mint address
  toAgentSummary,              // SATI identity => AgentSummary
  toAgent0RegistrationFile,    // SATI reg => agent0 RegistrationFile
  fromAgent0RegistrationFile,  // agent0 RegistrationFile => SATI params
  toAgent0Endpoints,           // SATI services => agent0 Endpoint[]
  fromAgent0Endpoints,         // agent0 Endpoint[] => SATI services
  toFeedback,                  // SATI attestation => agent0 Feedback
} from "@cascade-fyi/sati-agent0-sdk";

Released under the Apache 2.0 License.