AWP - Agentic Web Protocol
npm install agenticwebprotocol> !lng_icon This page aims to document Python protocols and usage (e.g. cloud, desktop).
>
> Looking for Javascript/Typescript instructions?
The Agentic Web Protocol, or AWP, allows AI agents to reliably understand and interact with the web.
It is composed of two protocols, for web pages and APIs, allowing them to be usable by AI agents.
A standard Universal Tool is also provided, for AI agents to be able to instantly leverage AWP compliant pages and APIs.
> π€ Discoverable Websites and APIs, for AI Agents interactions. Bluera Inc.
Learn more about how to support AWP, by clicking the most appropriate option for you:I make websites or APIs, what do I need to do?
##### Websites
- See the AWP Protocol Specifications below, and familiarize yourself with the standard ai parameters
- Add the appropriate ai parameters to your website.
> π Your website can be reliably used by any AI agent!
##### APIs
- See the AWP Protocol Specifications below, and familiarize yourself with the standard /ai-handshake endpoint
- Add the standard /ai-handshake endpoint to your API.
> π Your API can be reliably used by any AI agent!
I make/use AI Agents, what do I need to do?
- See the AWP Tool below, and familiarize yourself with its parse_html and parse_api methods.
- Add the AWP Tool to your AI Agent.
> π Your AI agent can now reliably use any AWP compliant websites or APIs!
Protocol Specifications
#### Introduction
> ##### The Challenge of Web Interactivity for AI Agents The premise of For an agent to so, the following information needs to be attached to meaninful and/or interactive HTML tags: 1. A Additional optional information such as #### Contract Let's start with a simple example. Your agent just found this website by crawling the web: `` It now needs to understand what it is for, to know if it can be used to answer your query, and if so, how to interact with it? For all reasons described above, this often becomes a difficult and error-prone task βleading to unintended behaviors and imparing the agent's ability to act reliably on our behalf. With AWP ` > The web app can now be reliably understood and used by any AI agents π ##### Standard Parameters | Parameter | Description | Requirement | > An AWP Tool is also distributed by this library to allow any AI agent to reliably use AWP #### Introduction > ##### The Challenge of API Interactivity for AI Agents The premise of AWP For an agent to know how to use any API, the following information needs to be discoverable: 1. A list of all each available endpoints #### Contract With AWP This allows AI agents to query /ai-handshake For simplicity, and since it is a well established standard on the web, the AWP Here is a simple example: ##### Standard Endpoint | Path | Description | Type | Method | Input | Output | Requirement | > An AWP Tool is also distributed by this library to allow any AI agent to reliably use AWP This project also shares a Universal Tool for your agents to be able reliably understand and interact with the AWP compliant Web pages and APIs. > For more information about Universal Tools ` #### Standard | Method | Parameters | Return Type | Description | #### As Universal Tool | Method | Parameters | Return Type | Description | #### Example Output ##### Parse HTML ###### Input ###### Output > YAML (default) or JSON per requested format. ##### Parse API ###### Input ###### Output OpenAPI compliant documentation, YAML (default) or JSON per requested format. Example available here. > Tip: Tools like Swagger can automatically generate a OpenAPI compliant documentation for your API which you may serve at #### Playground A ready-made playground is available to help familiarize yourself with the AWP protocols and tools. This software is open source, free for everyone, and lives on thanks to the community's support β If you'd like to support to - β Consider leaving a star on this repository to support our team & help with visibility Apache 2.0 License - Bluera Inc.
>
> Without information about what a web page is for, how it is structured, what features it provides, and how to interact with it, an AI agent has to figure out everything on its own.
>
> This is commonly done through scrappers and/or vision models aimed at guessing what the agent sees.
>
> Websites being diverse, complex, dynamic, Javascript-heavy and often moslty made of generic s, this exercise commonly leads to unreliable parsing and broken/unintended interactions.
>
> Intelligent agents need richer semantic hints to parse and interact with these pages reliably.AWP is simple: include standard information in the HTML page itself, for any agent to be able to reliably understand and interact with it.description, for it to know what it is.
2. A list of possible interactions, for it to know what to do.
3. A list of prerequisites, for it to know what to do prior to interacting.
4. A list of subsequent features, for it to know what those interactions lead to.states, or established accessibility parameters (eg. role, aria-*) may also be used to complement the agent's understanding of the page.html`
, this information is now declared in the HTML itself, through standard optional ai-* attributes.html`
|--------|-------------|----------|
| ai-description | A natural language description for agents to know what the element is | β’ Meaningful Element: requiredrequired
β’ Interactive Element: absent
β’ Other Element: |ai-interactions
| | A list of possible interactions, for agents to know what to do with the element
Format: | β’ Meaningful Element: absentrequired
β’ Interactive Element: absent
β’ Other Element: |ai-prerequisite-
| | A list of prerequisite interactions, for agents to know what to do prior to interacting with the element
Format: | β’ Meaningful Element: absentoptional
β’ Interactive Element: absent
β’ Other Element: |ai-ref
| | A unique identifier for agents to know where those prerequisite interactions should be made | β’ Meaningful Element: absentoptional
β’ Interactive Element: absent
β’ Other Element: |ai-next-
| | A list of subsequent features, for agents to know what those interactions lead to
Format: | β’ Meaningful Element: absentoptional
β’ Interactive Element: absent
β’ Other Element: |ai-state
| | A natural language description of the state the component is in | β’ Meaningful Element: optionaloptional
β’ Interactive Element: optional
β’ Other Element: | compliant websites.$3
>
> Without information about what an API is for, how it is structured, what features it provides, and how to interact with it, an AI agent has to figure out everything on its own.
>
> This is commonly passed manually as context, fetched via web crawlers attempting to find documentation online, or by spinning up additional middleware servers (eg. mcp) to allow them to be discoverable. is simple: include standard information in the API itself, for any agent to be able to reliably understand and interact with it, without requiring additional middleware servers to do so. on that API, to know what they aredescription
2. A for each endpoint, to know what they are formeta
3. information for each endpoint, to know how to access theminput
4. An documentation for each endpoint, to know what to provideoutput
5. An documentation for each endpoint, to know what to expect, the API documentation is made accessible on the API itself, with a standard /ai-handshake endpoint., get a complete description of the API, and know how to further interact with it. expects a OpenAPI compliant documentation to be returned by that endpoint.
https://editor.swagger.io
|--------|--------------------------------|----------|----------|----------|----------|----------|
| /ai-handshake | Standard endpoint returning a OpenAPI compliant documentation of the API which hosts the endpoint, excluding /ai-handshake, JSON or YAML based on headers | REST | GET | Headers:"Content-Type": "application/yaml"(recommended)"Content-Type": "application/json"
or | OpenAPI compliant documentation, of requested Content-Type (eg. YAML, JSON, text) | required | compliant API.AWP Tool
AWP Tool
, see β Universal Intelligence$3
bash
pip install awp(if using universal tool) Choose relevant UIN install for your device
pip install "universal-intelligence[community,mps]" # Apple
pip install "universal-intelligence[community,cuda]" # NVIDIA
``$3
python`
import awpGet HTML documentation
html_doc = awp.parse_html(html)Get API documentation
api_doc = awp.parse_api(url)parse_html
|--------|------------|-------------|-------------|
| | β’ html: str: HTML page to parseformat: str \| None = "YAML"
β’ : Output format | Any | Parses all AWP ai-* parameters on the page and returns a documentation in the requested format (YAML, JSON), usable by any AI agent to reliably understand and interact with that web page |parse_api
| | β’ url: str: URL of the API to parseauthorization: str \| None = None
β’ : Authentication header if requiredformat: str \| None = "YAML"
β’ : Output format | Any | Calls the standard /ai-handshake endpoint of that API and returns an OpenAPI compliant documentation of that API in the requested format (YAML, JSON), usable by any AI agent to reliably understand and interact with that API |`python`
from awp import UniversalTool as AWPGet HTML documentation
html_doc, logs = AWP().parse_html(html)Get API documentation
api_doc, logs = AWP().parse_api(url)__init__
|--------|------------|-------------|-------------|
| | β’ verbose: bool \| str = "DEFAULT": Enable/Disable logs, or set a specific log level | None | Initialize a Universal Tool |parse_html
| | β’ html: str: HTML page to parseformat: str \| None = "YAML"
β’ : Output format | Tuple[Any, Dict] | Parses all AWP ai-* parameters on the page and returns a documentation in the requested format (YAML, JSON), usable by any AI agent to reliably understand and interact with that web page |parse_api
| | β’ url: str: URL of the API to parseauthorization: str \| None = None
β’ : Authentication header if requiredformat: str \| None = "YAML"
β’ : Output format | Tuple[Any, Dict] | Calls the standard /ai-handshake endpoint of that API and returns an OpenAPI compliant documentation of that API in the requested format (YAML, JSON), usable by any AI agent to reliably understand and interact with that API |(class).contract
| | None | Contract | Tool description and interface specification |(class).requirements
| | None | List[Requirement] | Tool configuration requirements |`html`
ai-description="Form to book a flight"
ai-state="pending"
class="form-booking-flight">
Book a flight
ai-ref="
ai-description="Form input where to enter the destination"
ai-interactions="input: enables the form confirmation button, given certain constraints;"
role="destination-input"
aria-required="true"
alt="destination input"
type="text"
id="destination"
name="destination"
required
minlength="3"
maxlength="30"
size="10" />
ai-description="Confirmation button to proceed with booking a flight"
ai-interactions="click: proceed; hover: diplay additonal information about possible flights;"
ai-prerequisite-click="
ai-next-click="list of available flights; book a flight; login;"
aria-disabled="true"
disabled>
See available flights
ai-description="Cancel button to get back to the home page"
ai-interactions="click: dismiss form and return to home page;"
ai-next-click="access forms to book trains; access forms to book flights;">
Back
`yaml`
elements:
- selector: html
description: Travel site to book flights and trains
contains:
- selector: html body form.form-booking-flight
description: Form to book a flight
state: pending
content: Book a flight Where to?
contains:
- selector: html body form.form-booking-flight input#destination[name='destination'][type='text'][role='destination-input']
description: Form input where to enter the destination
available_interactions:
- type: input
description: enables the form confirmation button, given certain constraints
attributes:
name: destination
role: destination-input
alt: destination input
aria-required: 'true'
maxlength: 30
minlength: 3
required: true
type: text
- selector: html body form.form-booking-flight div button
description: Confirmation button to proceed with booking a flight
content: See available flights
available_interactions:
- type: click
description: proceed
prerequisites:
- selector: html body form.form-booking-flight input#destination[name='destination'][type='text'][role='destination-input']
interaction: input destination
next_features:
- list of available flights
- book a flight
- login
- type: hover
description: diplay additonal information about possible flights
attributes:
aria-disabled: 'true'
- selector: html body form.form-booking-flight div button:nth-of-type(2)
description: Cancel button to get back to the home page
content: Back
available_interactions:
- type: click
description: dismiss form and return to home page
next_features:
- access forms to book trains
- access forms to book flightsGET https//example.api.com/ai-handshake
>
> YAML recommended for improved token efficiency and stability./ai-handshake. They usually also provide no-code UIs to display and interact wich that documentation on the web (eg. Swagger UI).`sh`Install project dependencies
pip install -r requirements.txt Choose relevant UIN install for your device
pip install "universal-intelligence[community,mps]" # Apple
pip install "universal-intelligence[community,cuda]" # NVIDIARun
python -m playground.example AWP$3
tool can be used across all platforms (cloud, desktop, web, mobile).python (cloud, desktop)javascript/typescript
- !lng_icon How to use on the web, or in web-native apps, with (cloud, desktop, web, mobile)agentic-web-protocolSupport
here are a few ways to do so:AWP
- π½ Tell your friends and collegues
- π° Support this project on social medias (e.g. LinkedIn, Youtube, Medium, Reddit)
- β
Adopt the specificationAWP` specification
- πͺ Use the AWP Tool
- π‘ Help surfacing/resolving issues
- π Help shape the
- π§ Help maintain, test, enhance the AWP Tool
- βοΈ Email us security concerns
- β€οΈ Sponsor this project on Github
- π€ Partner with BlueraLicense