// Step 1: Get access credentials for the agent
const accessCredentials = await payments.query.getAgentHTTPOptions(planId, agentId)
// Step 2: Query the agent with the credentials
const result = await payments.query(agentId, accessCredentials, { prompt: "Write a smart contract." })
// OR use with standard fetch
const options = await payments.query.getAgentHTTPOptions(planId, agentId)
const response = await fetch(agentEndpoint, {
method: 'POST',
headers: options.headers,
body: JSON.stringify({ prompt: "Write a smart contract." })
})