Skip to content

How Agents Work

At its core, Agentkit translates natural language intent into on-chain UserOperations. But the LLM itself cannot sign transactions or connect to RPC nodes.

Agentkit provides the bridge through a pattern called Tool Calling (or Function Calling).

Let’s say a user types: “Send 5 USDC to vitalik.eth”

Here is step-by-step how Agentkit handles it:

You pass the user’s message to your LLM (e.g., GPT-4), along with the Agentkit tools.

The LLM reads the tools and sees smart_transfer. The prompt tells the LLM:

“If you want to transfer tokens, return a JSON object with to, amount, and tokenAddress. Use this tool.”

The LLM realizes it needs to use smart_transfer. It stops answering directly and instead returns a structured request:

{
"name": "smart_transfer",
"arguments": {
"to": "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045", // Resolved vitalik.eth
"amount": "5",
"tokenAddress": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" // USDC address
}
}

Your code receives this JSON from the LLM and hands it to Agentkit.

  • Agentkit sees it’s a SmartTransferAction.
  • It fetches the USDC contract’s decimals using a public RPC.
  • It encodes the transfer(address,uint256) data payload.
  • It constructs a UserOperation for the Agent’s smart account.
  • It asks the Agent’s signer (e.g., KMS or a local key) to sign the hash.
  • It submits the UserOperation to the 0xGasless Bundler.

Once the transaction is submitted, Agentkit returns the result (e.g., “Transaction submitted: 0xhash”) back to the LLM.

The LLM receives this result, realizes the job is done, and finally writes a human-readable response to the user:

“I have successfully sent 5 USDC to vitalik.eth. Here is the transaction hash: 0xhash.”

When you call Agentkit.configureWithPlatform() (or configureWithWallet()), you are providing the context that the tools need to execute Step 3.

The actions themselves (smart_transfer, get_balance, pay_api) don’t know which wallet acts until they run through an Agentkit instance. In platform mode it holds the authenticated @0xgasless/agent client bound to your API key and agent — signing happens in 0xGasless KMS under the project’s spending policy. In self-custody mode it holds the local key’s smart-account session.

If you are running a server with many users, configure one Agentkit per agent so the tools always execute from the correct wallet.