Skip to content

SDK API

Complete reference for the SDK class.

For detailed ID format documentation, see Models Reference.

sdk = SDK(
chainId: ChainId,
rpcUrl: str,
signer: Optional[Any] = None,
registryOverrides: Optional[Dict] = None,
indexingStore: Optional[Any] = None,
embeddings: Optional[Any] = None,
ipfs: Optional[str] = None,
ipfsNodeUrl: Optional[str] = None,
filecoinPrivateKey: Optional[str] = None,
pinataJwt: Optional[str] = None,
subgraphUrl: Optional[str] = None,
subgraphOverrides: Optional[Dict[ChainId, str]] = None
)

Create a new agent.

agent = sdk.createAgent(
name: str,
description: str,
image: Optional[str] = None
) -> Agent

Load an existing agent by ID.

agent = sdk.loadAgent(agentId: str) -> Agent

Search for agents with filters.

results = sdk.searchAgents(
params: Union[SearchParams, Dict, None] = None,
sort: List[str] = None,
page_size: int = 50,
cursor: Optional[str] = None,
**kwargs
) -> Dict[str, Any]

Get a single agent summary.

agent = sdk.getAgent(agentId: str) -> AgentSummary

Sign feedback authorization for a client.

auth = sdk.signFeedbackAuth(
agentId: str,
clientAddress: str,
indexLimit: Optional[int] = None,
expiryHours: int = 24
) -> bytes

Prepare a feedback file.

feedback = sdk.prepareFeedback(
agentId: str,
score: Optional[int] = None,
tags: List[str] = None,
text: Optional[str] = None,
capability: Optional[str] = None,
name: Optional[str] = None,
skill: Optional[str] = None,
task: Optional[str] = None,
context: Optional[Dict] = None,
proofOfPayment: Optional[Dict] = None,
extra: Optional[Dict] = None
) -> Dict

Give feedback on-chain.

feedback = sdk.giveFeedback(
agentId: str,
feedbackFile: Dict,
idem: Optional[str] = None,
feedbackAuth: Optional[bytes] = None
) -> Feedback

Get single feedback.

feedback = sdk.getFeedback(feedbackId: str) -> Feedback

Note: feedbackIndex in the feedback ID is 1-based (first feedback = 1, second = 2, etc.)

TypeScript Note: TypeScript SDK takes separate parameters instead of a single feedbackId string.

Search feedback with filters.

results = sdk.searchFeedback(
agentId: str,
tags: Optional[List[str]] = None,
capabilities: Optional[List[str]] = None,
skills: Optional[List[str]] = None,
minScore: Optional[int] = None,
maxScore: Optional[int] = None,
first: int = 100,
skip: int = 0
) -> List[Feedback]

Find agents by reputation.

results = sdk.searchAgentsByReputation(
tags: Optional[List[str]] = None,
capabilities: Optional[List[str]] = None,
skills: Optional[List[str]] = None,
minAverageScore: Optional[float] = None
) -> Dict

Revoke feedback.

result = sdk.revokeFeedback(
agentId: str,
feedbackIndex: int
) -> Feedback

TypeScript Note: Returns transaction hash string, not Feedback object.

Append response to feedback.

feedback = sdk.appendResponse(
agentId: str,
clientAddress: str,
feedbackIndex: int,
response: Dict
) -> Feedback

TypeScript Note: Returns transaction hash string, not Feedback object. Response parameter is an object with uri and hash properties.

Get reputation summary for an agent.

summary = sdk.getReputationSummary(
agentId: str
) -> Dict

Transfer agent ownership to a new address.

result = sdk.transferAgent(
agentId: str,
newOwnerAddress: str
) -> Dict[str, Any]

Parameters:

  • agentId (str / AgentId): The agent ID to transfer
  • newOwnerAddress / newOwner (str / Address): Ethereum address of the new owner

Returns:

  • Python: Dict[str, Any] containing:
    • txHash (str): Transaction hash
    • from (str): Previous owner address
    • to (str): New owner address
    • agentId (str): Agent ID that was transferred
  • TypeScript: Object with typed fields { txHash: string; from: Address; to: Address; agentId: AgentId }

Raises/Throws:

  • Python: ValueError: If agent not found or transfer not allowed
  • TypeScript: Error: If agent not found or transfer not allowed

Example:

# Transfer agent using SDK method
result = sdk.transferAgent(
agentId="11155111:123",
newOwnerAddress="0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6"
)
print(f"Transfer successful: {result['txHash']}")
print(f"New owner: {result['to']}")

Comparison with Agent.transfer():

  • sdk.transferAgent() is a convenience method that loads the agent first
  • agent.transfer() works directly on an existing agent instance
  • Both methods perform the same validation and transfer logic
  • Use sdk.transferAgent() when you only have the agent ID
  • Use agent.transfer() when you already have an agent instance

Important Notes:

  • Only the current owner can transfer the agent
  • Agent URI, metadata, and all other data remain unchanged
  • Transfer is irreversible - ensure the new owner is correct
  • Invalid addresses and self-transfers are automatically rejected
  • Address validation includes checksum format verification

Get the current owner of an agent.

owner = sdk.getAgentOwner(agentId: str) -> str

Parameters:

  • agentId (str / AgentId): The agent ID to check

Returns:

  • Python: str - The current owner’s Ethereum address
  • TypeScript: Address - The current owner’s Ethereum address

Raises/Throws:

  • Python: ValueError: If agent ID is invalid or agent doesn’t exist
  • TypeScript: Error: If agent ID is invalid or agent doesn’t exist

Example:

owner = sdk.getAgentOwner("11155111:123")
print(f"Current owner: {owner}")

Check if an address is the owner of an agent.

is_owner = sdk.isAgentOwner(
agentId: str,
address: Optional[str] = None
) -> bool

Parameters:

  • agentId (str / AgentId): The agent ID to check
  • address (str / Address, optional in Python, required in TypeScript): Address to check (Python defaults to SDK’s signer address)

Returns:

  • bool: True if the address is the owner, False otherwise

Raises/Throws:

  • Python: ValueError: If agent ID is invalid or agent doesn’t exist
  • TypeScript: Error: If agent ID is invalid or agent doesn’t exist

Example:

# Check if current signer is owner
is_owner = sdk.isAgentOwner("11155111:123")
# Check if specific address is owner
is_owner = sdk.isAgentOwner("11155111:123", "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6")

Check if an address can transfer an agent (i.e., is the owner).

can_transfer = sdk.canTransferAgent(
agentId: str,
address: Optional[str] = None
) -> bool

TypeScript Note: This method is not available in the TypeScript SDK. Use isAgentOwner() instead, which serves the same purpose.

Parameters:

  • agentId (str): The agent ID to check
  • address (str, optional): Address to check (defaults to SDK’s signer address)

Returns:

  • bool: True if the address can transfer the agent, False otherwise

Example:

# Check if current signer can transfer
can_transfer = sdk.canTransferAgent("11155111:123")
# Check if specific address can transfer
can_transfer = sdk.canTransferAgent("11155111:123", "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6")

Get current chain ID.

chain_id = sdk.chain_id() -> int

TypeScript Note: Method is async and uses camelCase naming.

Get registry addresses.

registries = sdk.registries() -> Dict[str, str]

Switch to a different chain.

sdk.set_chain(chain_id: int) -> None

TypeScript Note: This method is not available in the TypeScript SDK. Create a new SDK instance with the desired chainId instead.

Check if SDK is in read-only mode.

is_readonly = sdk.isReadOnly -> bool

TypeScript Note: Property access (not a method), uses camelCase naming.