Catalog PyPI
PACKAGE EXPLORERView in registry

agentml

PyPI

A rendering convention for AI agents — append /agents to any FastAPI route and get a fully structured agent workspace with state, capabilities, RBAC, and navigation.

agenticagentsaifastapillmmcpopenairest
Versions collected1
Direct dependencies6From release 0.1.0
Last observed20 Oct, 22:44 UTC

README

Version 0.1.0 documentation

AgentML

AgentML is a universal rendering convention for AI agents. The same way browsers render HTML into a visual experience for humans, AgentML renders a complete agent-page/workspace for AI — context, state, permissions, actions, guidance, navigation — everything an agent needs to understand where it is and what it can do, in one response.


Quickstart

1. Install

pip install agentml

2. Setup in 3 Lines

from fastapi import FastAPI
from agentML import AgentML

app = FastAPI()
agent = AgentML(app)
agent.add_middleware() # Enables mutation response semantics

1. Mutation Enriched Response (POST /patients)

When an agent performs an action (e.g. POST /patients) and sends the header Accept: application/vnd.agentml+json, AgentML intercepts the response to tell the agent exactly what changed (delta), where the resource now lives (agent_resource), and what it can do next (actions) and where it can go (navigation):

POST /patients
Accept: application/vnd.agentml+json
Content-Type: application/json

{
  "name": "Aanya Sharma",
  "age": 34
}

Response:

{
  "result": {
    "id": 42,
    "name": "Aanya Sharma",
    "age": 34
  },
  "delta": {
    "name": "Aanya Sharma",
    "age": 34
  },
  "agent_resource": "/patients/42/agents",
  "actions": [
    {
      "name": "UpdatePatientDetails",
      "agent_endpoint": "/patients/42/agents"
    },
    {
      "name": "ViewPatientDetails",
      "agent_endpoint": "/patients/42/agents"
    },
    {
      "name": "ArchivePatient",
      "agent_endpoint": "/patients/42/agents"
    }
  ],
  "navigation": [
    {
      "label": "Appointments",
      "agent_endpoint": "/patients/42/appointments/agents"
    },
    {
      "label": "Billing",
      "agent_endpoint": "/billing/agents"
    },
    {
      "label": "Home",
      "agent_endpoint": "/agents"
    }
  ]
}

2. Resource Workspace (GET /patients/42/agents)

When an agent navigates to the resulting agent_resource, they receive a complete state-aware workspace:

GET /patients/42/agents

Response:

{
  "agentML": "0.1",
  "workspace": {
    "title": "Patients Instance Agent Workspace",
    "resource": "/patients/42",
    "agent_resource": "/patients/42/agents",
    "breadcrumb": ["Home", "Patients", "Patient 42"]
  },
  "identity": {
    "role": "doctor",
    "user_id": "doc_88"
  },
  "state": {
    "id": 42,
    "name": "Aanya Sharma",
    "age": 34,
    "archived": false
  },
  "capabilities": [
    {
      "name": "UpdatePatientDetails",
      "description": "Modify name or age of an existing patient",
      "fields": [
        {
          "name": "name",
          "type": "string",
          "required": true,
          "current": "Aanya Sharma"
        },
        {
          "name": "age",
          "type": "integer",
          "required": true,
          "current": 34,
          "constraints": {
            "ge": 0,
            "le": 120
          }
        }
      ]
    }
  ],
  "unavailable": [],
  "navigation": [
    {
      "label": "Appointments",
      "agent_endpoint": "/patients/42/appointments/agents"
    },
    {
      "label": "Billing",
      "agent_endpoint": "/billing/agents"
    },
    {
      "label": "Home",
      "agent_endpoint": "/agents"
    }
  ],
  "alerts": [],
  "guidance": []
}

Understanding the Workspace Blocks

  • workspace: Native location context containing the human URL, the agent URL, and path breadcrumbs.
  • identity: The dynamic security credentials and role context for the current request.
  • state: The serialized current resource state fetched in-process.
  • capabilities: Permitted business-language actions (never HTTP verbs) with dynamic schema validation rules and pre-filled current values.
  • unavailable: Actions that are temporarily disabled due to the current resource state, complete with explanations.
  • navigation: Context-aware sibling and sub-resource links matching the instance's active ID.
  • alerts: Banner notifications or warning details generated dynamically based on state.

Philosophy: HTML for Humans, AgentML for AI

The web was built for human eyes. AI agents are currently forced to parse layout-heavy HTML, guess dynamic form flows, and reverse-engineer endpoints.

AgentML introduces a simple, universal web rendering convention: append /agents to any HTTP resource. A browser requests a resource and gets human-friendly HTML. An AI agent requests the same resource + /agents (or issues mutations requesting the vnd.agentml+json payload) and gets a structured, action-ready Agent Workspace.


Core Features

  • Relational Navigation: Context-aware nested resources (e.g. /patients/42/agents links to /patients/42/appointments/agents substituting the identifier automatically).
  • Mutation Semantics (v0.4): Mutation writes return execution feedback, updated state deltas, and structured action and navigation lists to eliminate agent state blindness.
  • Invisible-by-Design RBAC: Permissions are evaluated at render-time; capabilities the agent is unauthorized to perform are completely absent.
  • Zero HTTP Verbs: All actions are presented in clean business terminology (e.g. RegisterPatient instead of POST /patients).
  • Fail-Closed Safety: Dynamic safety check hooks (unavailable_fn) default to blocked state on exceptions.
  • Pydantic Validation: Auto-extracts field types, constraints (ge, le, patterns, enums) and pre-fills current state values.

Downloads & popularity

2downloads
1-day window · source-reported counts18 Oct 2026
73.50
2026-07-21: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-21–2026-07-212026-07-22: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-22–2026-07-222026-07-23: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-23–2026-07-232026-07-24: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-24–2026-07-242026-07-27: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-27–2026-07-272026-07-28: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-07-28–2026-07-282026-08-01: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-01–2026-08-012026-08-02: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-02–2026-08-022026-08-03: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-03–2026-08-032026-08-05: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-05–2026-08-052026-08-07: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-07–2026-08-072026-08-09: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-09–2026-08-092026-08-14: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-14–2026-08-142026-08-15: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-15–2026-08-152026-08-17: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-17–2026-08-172026-08-23: 4 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-23–2026-08-232026-08-24: 4 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-24–2026-08-242026-08-25: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-25–2026-08-252026-08-28: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-28–2026-08-282026-08-31: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-08-31–2026-08-312026-09-01: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-01–2026-09-012026-09-03: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-03–2026-09-032026-09-04: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-04–2026-09-042026-09-06: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-06–2026-09-062026-09-07: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-07–2026-09-072026-09-10: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-10–2026-09-102026-09-14: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-14–2026-09-142026-09-16: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-16–2026-09-162026-09-20: 4 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-20–2026-09-202026-09-22: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-22–2026-09-222026-09-23: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-23–2026-09-232026-09-26: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-26–2026-09-262026-09-27: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-27–2026-09-272026-09-30: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-09-30–2026-09-302026-10-02: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-02–2026-10-022026-10-06: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-06–2026-10-062026-10-08: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-08–2026-10-082026-10-09: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-09–2026-10-092026-10-12: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-12–2026-10-122026-10-13: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-13–2026-10-132026-10-14: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-14–2026-10-142026-10-15: 3 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-15–2026-10-152026-10-16: 1 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-16–2026-10-162026-10-17: 7 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-17–2026-10-172026-10-18: 2 · observed 2026-10-20T22:47:47.3699901Z · period 2026-10-18–2026-10-18
21 Jul18 Oct

pypistats · 45 observations shown. Missing days are unknown. Source category: overall: without mirrors.

View observed values
Date / source periodValueObserved at
2026-10-18 – 2026-10-1822026-10-20T22:47:47.3699901Z
2026-10-17 – 2026-10-1772026-10-20T22:47:47.3699901Z
2026-10-16 – 2026-10-1612026-10-20T22:47:47.3699901Z
2026-10-15 – 2026-10-1532026-10-20T22:47:47.3699901Z
2026-10-14 – 2026-10-1432026-10-20T22:47:47.3699901Z
2026-10-13 – 2026-10-1312026-10-20T22:47:47.3699901Z
2026-10-12 – 2026-10-1212026-10-20T22:47:47.3699901Z
2026-10-09 – 2026-10-0932026-10-20T22:47:47.3699901Z
2026-10-08 – 2026-10-0812026-10-20T22:47:47.3699901Z
2026-10-06 – 2026-10-0612026-10-20T22:47:47.3699901Z
2026-10-02 – 2026-10-0222026-10-20T22:47:47.3699901Z
2026-09-30 – 2026-09-3012026-10-20T22:47:47.3699901Z
2026-09-27 – 2026-09-2712026-10-20T22:47:47.3699901Z
2026-09-26 – 2026-09-2612026-10-20T22:47:47.3699901Z
2026-09-23 – 2026-09-2312026-10-20T22:47:47.3699901Z
2026-09-22 – 2026-09-2212026-10-20T22:47:47.3699901Z
2026-09-20 – 2026-09-2042026-10-20T22:47:47.3699901Z
2026-09-16 – 2026-09-1612026-10-20T22:47:47.3699901Z
2026-09-14 – 2026-09-1422026-10-20T22:47:47.3699901Z
2026-09-10 – 2026-09-1022026-10-20T22:47:47.3699901Z
2026-09-07 – 2026-09-0732026-10-20T22:47:47.3699901Z
2026-09-06 – 2026-09-0622026-10-20T22:47:47.3699901Z
2026-09-04 – 2026-09-0412026-10-20T22:47:47.3699901Z
2026-09-03 – 2026-09-0312026-10-20T22:47:47.3699901Z
2026-09-01 – 2026-09-0112026-10-20T22:47:47.3699901Z
2026-08-31 – 2026-08-3132026-10-20T22:47:47.3699901Z
2026-08-28 – 2026-08-2812026-10-20T22:47:47.3699901Z
2026-08-25 – 2026-08-2512026-10-20T22:47:47.3699901Z
2026-08-24 – 2026-08-2442026-10-20T22:47:47.3699901Z
2026-08-23 – 2026-08-2342026-10-20T22:47:47.3699901Z
2026-08-17 – 2026-08-1722026-10-20T22:47:47.3699901Z
2026-08-15 – 2026-08-1522026-10-20T22:47:47.3699901Z
2026-08-14 – 2026-08-1422026-10-20T22:47:47.3699901Z
2026-08-09 – 2026-08-0912026-10-20T22:47:47.3699901Z
2026-08-07 – 2026-08-0712026-10-20T22:47:47.3699901Z
2026-08-05 – 2026-08-0512026-10-20T22:47:47.3699901Z
2026-08-03 – 2026-08-0312026-10-20T22:47:47.3699901Z
2026-08-02 – 2026-08-0212026-10-20T22:47:47.3699901Z
2026-08-01 – 2026-08-0112026-10-20T22:47:47.3699901Z
2026-07-28 – 2026-07-2822026-10-20T22:47:47.3699901Z
2026-07-27 – 2026-07-2732026-10-20T22:47:47.3699901Z
2026-07-24 – 2026-07-2422026-10-20T22:47:47.3699901Z
2026-07-23 – 2026-07-2322026-10-20T22:47:47.3699901Z
2026-07-22 – 2026-07-2212026-10-20T22:47:47.3699901Z
2026-07-21 – 2026-07-2122026-10-20T22:47:47.3699901Z

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.1.016 Jun 20266

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
priyanshu7739410/agentml

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 20 Oct, 22:44 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:25f8e5ac881d4ef903b0c11907035ccf2ab19bdb11f5b87806b1d8f115981507