We've shipped a new AI-powered endpoint in ap2-service that generates structured Intent Mandates from natural language, simplifying the user authorization flow.
> impact
We've introduced a new endpoint, `/mandates/generate-from-text`, to the `ap2-service` to streamline the creation of authorization requests. This service accepts a user's intent described in plain English—for example, 'let me ask the AI about Arbitrum for 15 minutes, with a max cost of $1'. Internally, it leverages a configured Ollama LLM to parse this text and translate it into a structured, signable AP2 Intent Mandate in the required JSON format.
Previously, authorizing AI usage via AP2 required users or client applications to manually construct a complex JSON object defining the `Intent Mandate`. This created significant friction, was error-prone, and acted as a major barrier to adoption for developers building user-facing applications. The core value of AP2 is abstracting away blockchain complexity, and the manual mandate creation process was directly at odds with that goal, forcing users to understand the underlying protocol structure.
This update dramatically improves the user experience for authorizing AI-driven tasks. By allowing users to express their needs naturally, we have replaced a developer-centric task with an intuitive, user-friendly interaction. This makes the AP2 authorization flow more accessible and faster, enabling applications to seamlessly integrate metered AI agents into their workflows without exposing users to the complexities of structured data formats.
> Try this now
try this
# 1. Use natural language to generate a signable Intent Mandate for AI usage.
# This request asks the new endpoint to convert a simple sentence into a structured JSON mandate.
curl -X POST http://localhost:8080/mandates/generate-from-text \
-H "Content-Type: application/json" \
-d '{
"text": "I want to ask questions about Arbitrum for 15 minutes, spending no more than $1"
}'
# 2. The service returns a structured JSON Intent Mandate, ready for the user to sign.
# Note how the LLM correctly parsed the timeframe (900 seconds), max cost (1.00), and scope.
# Expected Response:
# {
# "maxCost": "1.00",
# "timeframeSeconds": 900,
# "scope": "Ask questions about Arbitrum",
# "currency": "USD",
# "version": "1.0"
# }