Skip to content

Agent API

Complete reference for the Agent class.

All properties are read-only. Use setter methods to modify values.

# Identity
agent.agentId # Optional[str]
agent.agentURI # Optional[str]
agent.name # str
agent.description # str
agent.image # Optional[str]
# Status
agent.active # bool
agent.x402support # bool
agent.updatedAt # int
# Wallet
agent.walletAddress # Optional[str]
agent.walletChainId # Optional[int]
# Endpoints
agent.mcpEndpoint # Optional[str]
agent.a2aEndpoint # Optional[str]
agent.ensEndpoint # Optional[str]
# Capabilities
agent.mcpTools # Optional[List[str]]
agent.mcpPrompts # Optional[List[str]]
agent.mcpResources # Optional[List[str]]
agent.a2aSkills # Optional[List[str]]
# Lists
agent.endpoints # List[Endpoint]
agent.trustModels # List[TrustModel]
agent.metadata # Dict[str, Any]
agent.owners # List[str]
agent.operators # List[str]

Set MCP endpoint.

agent = agent.setMCP(
endpoint: str,
version: str = "2025-06-18",
auto_fetch: bool = True
) -> Agent

TypeScript Note: Method is async and returns Promise<this> for chaining.

Set A2A endpoint.

agent = agent.setA2A(
agentcard: str,
version: str = "0.30",
auto_fetch: bool = True
) -> Agent

TypeScript Note: Method is async and returns Promise<this> for chaining.

Set ENS endpoint.

agent = agent.setENS(name: str, version: str = "1.0") -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Remove endpoint(s).

agent = agent.removeEndpoint(
type: Optional[EndpointType] = None,
value: Optional[str] = None
) -> Agent

TypeScript Note: This method is not available in the TypeScript SDK. Manually filter endpoints from the registration file instead.

Remove all endpoints.

agent = agent.removeEndpoints() -> Agent

TypeScript Note: This method is not available in the TypeScript SDK. Manually clear endpoints from the registration file instead.

Set trust models using keywords.

agent = agent.setTrust(
reputation: bool = False,
cryptoEconomic: bool = False,
teeAttestation: bool = False
) -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Set trust models directly.

agent = agent.trustModels(
models: List[Union[TrustModel, str]]
) -> Agent

TypeScript Note: This method is not available in the TypeScript SDK. Manually set trustModels on the registration file instead.

Update basic agent information.

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

TypeScript Note: Method is synchronous and returns this for chaining.

Set agent wallet.

agent = agent.setAgentWallet(
addr: Optional[str],
chainId: Optional[int] = None
) -> Agent

TypeScript Note: Method is synchronous, both parameters are required (not optional), and returns this for chaining.

Set active status.

agent = agent.setActive(active: bool) -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Set x402 support.

agent = agent.setX402Support(x402Support: bool) -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Set metadata.

agent = agent.setMetadata(kv: Dict[str, Any]) -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Get metadata.

metadata = agent.getMetadata() -> Dict[str, Any]

Delete a metadata key.

agent = agent.delMetadata(key: str) -> Agent

TypeScript Note: Method is synchronous and returns this for chaining.

Register with IPFS (recommended).

reg_file = agent.registerIPFS() -> RegistrationFile

TypeScript Note: Method is async and returns Promise<RegistrationFile>.

Register with direct URI.

reg_file = agent.register(agentUri: str) -> RegistrationFile

TypeScript Note: Method is named registerHTTP in TypeScript SDK and is async.

Update registration after edits.

reg_file = agent.updateRegistration(
agentURI: Optional[str] = None,
idem: Optional[str] = None
) -> RegistrationFile

TypeScript Note: This method is not available in the TypeScript SDK. Use registerIPFS() again to update an existing registration, or setAgentUri() to update the URI.

Set agent URI locally.

agent = agent.setAgentUri(uri: str) -> Agent

TypeScript Note: Method is async and updates the URI on-chain (not just locally).

Transfer ownership.

result = agent.transfer(
to: str,
approve_operator: bool = False,
idem: Optional[str] = None
) -> Dict

TypeScript Note: Method is async, only takes newOwner parameter (no approve_operator or idem), and returns typed object.

Parameters:

  • to / 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 is not registered, address is invalid, or caller is not the owner
  • TypeScript: Error: If agent is not registered, address is invalid, or caller is not the owner

Example:

# Transfer agent to new owner
new_owner = "0x742d35Cc6634C0532925a3b8D4C9db96C4b4d8b6"
result = agent.transfer(new_owner)
print(f"Transfer successful: {result['txHash']}")
print(f"New owner: {result['to']}")

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

Add operator.

result = agent.addOperator(
operator: str,
idem: Optional[str] = None
) -> Dict

TypeScript Note: This method is not available in the TypeScript SDK. Use the SDK’s web3Client to interact with the Identity Registry directly.

Remove operator.

result = agent.removeOperator(
operator: str,
idem: Optional[str] = None
) -> Dict

TypeScript Note: This method is not available in the TypeScript SDK. Use the SDK’s web3Client to interact with the Identity Registry directly.

Activate agent.

reg_file = agent.activate(idem: Optional[str] = None) -> RegistrationFile

TypeScript Note: This method is not available in the TypeScript SDK. Use setActive(true) and registerIPFS() instead.

Deactivate agent.

reg_file = agent.deactivate(idem: Optional[str] = None) -> RegistrationFile

TypeScript Note: This method is not available in the TypeScript SDK. Use setActive(false) and registerIPFS() instead.

Get registration file.

reg_file = agent.getRegistrationFile() -> RegistrationFile

Convert to JSON.

json_str = agent.toJson() -> str

TypeScript Note: This method is not available in the TypeScript SDK. Use JSON.stringify() on the registration file instead.

Save to file.

agent.saveToFile(filePath: str) -> None

TypeScript Note: This method is not available in the TypeScript SDK. Use Node.js fs module to write the registration file to disk.