Skip to main content

Agent deployment

activateAgent

Activates the user's smart wallet for one or more agents. This deploys the Safe contract and creates a session key if not already set up, then stores the selected chainId for later SDK calls.

  • If agentId is omitted: activates all agents that support the specified chain.
  • If agentId is provided: activates only the listed agents.
  • If any explicitly listed agent does not support the chain, the call throws before activating any of them.

Requires wallet connection: Yes

activateAgent(
chainId: number,
agentId?: AgentId[]
): Promise<void>

Parameters

  • chainId: number - Target chain ID (See Agent Compatibility for details).
  • agentId?: AgentId[] - Optional list of agents to activate (See AgentId for details). If omitted, all chain-compatible agents are activated. An empty array is invalid.

Returns

  • Promise<void>

getActiveChainId

Returns the active chain ID currently set by activateAgent.

getActiveChainId(): number | null

Returns

  • number | null - The active chain ID, or null if no chain has been activated yet.