├── packages ├── client │ ├── js │ │ ├── .npmignore │ │ ├── src │ │ │ ├── apis │ │ │ │ └── index.ts │ │ │ ├── index.ts │ │ │ └── models │ │ │ │ ├── index.ts │ │ │ │ ├── GetAgentTask404Response.ts │ │ │ │ ├── TaskRequestBody.ts │ │ │ │ ├── StepRequestBody.ts │ │ │ │ ├── TaskListResponse.ts │ │ │ │ ├── TaskStepsListResponse.ts │ │ │ │ ├── Pagination.ts │ │ │ │ ├── TaskArtifactsListResponse.ts │ │ │ │ ├── Artifact.ts │ │ │ │ └── Task.ts │ │ ├── openapitools.json │ │ ├── tsconfig.json │ │ ├── package.json │ │ ├── package-lock.json │ │ ├── .openapi-generator-ignore │ │ ├── examples │ │ │ └── minimal.ts │ │ └── README.md │ └── python │ │ ├── agent_protocol_client │ │ ├── test │ │ │ ├── __init__.py │ │ │ ├── test_step_request_body.py │ │ │ ├── test_task_request_body.py │ │ │ ├── test_pagination.py │ │ │ ├── test_get_agent_task404_response.py │ │ │ ├── test_artifact.py │ │ │ ├── test_task.py │ │ │ ├── test_task_list_response.py │ │ │ ├── test_task_steps_list_response.py │ │ │ ├── test_agent_api.py │ │ │ ├── test_task_artifacts_list_response.py │ │ │ └── test_step.py │ │ ├── api │ │ │ └── __init__.py │ │ ├── api_response.py │ │ ├── models │ │ │ ├── __init__.py │ │ │ ├── get_agent_task404_response.py │ │ │ ├── pagination.py │ │ │ ├── task_request_body.py │ │ │ ├── step_request_body.py │ │ │ ├── task_all_of.py │ │ │ ├── artifact.py │ │ │ ├── step_result.py │ │ │ ├── task_list_response.py │ │ │ ├── task_steps_list_response.py │ │ │ ├── task_artifacts_list_response.py │ │ │ └── task.py │ │ └── __init__.py │ │ ├── .gitignore │ │ ├── Makefile │ │ ├── openapitools.json │ │ ├── pyproject.toml │ │ ├── .openapi-generator-ignore │ │ ├── scripts │ │ └── generate.sh │ │ └── examples │ │ └── minimal.py └── sdk │ ├── python │ ├── openapitools.json │ ├── agent_protocol │ │ ├── utils │ │ │ ├── __init__.py │ │ │ └── compliance │ │ │ │ ├── __init__.py │ │ │ │ └── conftest.py │ │ ├── middlewares.py │ │ ├── __init__.py │ │ ├── server.py │ │ └── cli.py │ ├── .gitignore │ ├── Makefile │ ├── codegen │ │ └── main.jinja2 │ ├── examples │ │ ├── minimal.py │ │ └── smol_developer.py │ ├── pyproject.toml │ └── README.md │ └── js │ ├── src │ ├── yml.d.ts │ ├── index.ts │ ├── api.ts │ └── models.ts │ ├── tsup.config.js │ ├── examples │ ├── minimal.ts │ ├── google-cloud-functions.ts │ ├── firebase-functions.ts │ └── aws-lambda.ts │ ├── README.md │ └── package.json ├── .eslintignore ├── .lintstagedrc ├── .prettierignore ├── .husky └── pre-commit ├── assets └── cover.png ├── apps └── agentprotocol.ai │ ├── .eslintrc.js │ ├── bun.lockb │ ├── jsconfig.json │ ├── src │ ├── app │ │ ├── favicon.ico │ │ ├── favicon-16x16.png │ │ ├── favicon-32x32.png │ │ ├── apple-touch-icon.png │ │ ├── endpoints │ │ │ └── page.template.mdx │ │ ├── clients │ │ │ ├── page.mdx │ │ │ ├── others │ │ │ │ └── page.mdx │ │ │ └── python │ │ │ │ └── page.mdx │ │ ├── sdks │ │ │ ├── page.mdx │ │ │ ├── custom │ │ │ │ └── page.mdx │ │ │ └── js │ │ │ │ └── page.mdx │ │ ├── not-found.jsx │ │ ├── providers.jsx │ │ ├── rfc │ │ │ └── page.mdx │ │ ├── layout.jsx │ │ ├── incentives │ │ │ └── page.mdx │ │ ├── projects-tools │ │ │ └── page.mdx │ │ ├── compliance │ │ │ └── page.mdx │ │ └── page.mdx │ ├── mdx │ │ ├── recma.mjs │ │ ├── remark.mjs │ │ └── rehype.mjs │ ├── components │ │ ├── Logo.jsx │ │ ├── Prose.jsx │ │ ├── icons │ │ │ ├── DocumentIcon.jsx │ │ │ ├── ListIcon.jsx │ │ │ └── PythonIcon.jsx │ │ ├── GridPattern.jsx │ │ ├── Layout.jsx │ │ ├── Tag.jsx │ │ ├── HeroPattern.jsx │ │ ├── Libraries.jsx │ │ ├── SDKs.jsx │ │ ├── Button.jsx │ │ ├── Header.jsx │ │ ├── Heading.jsx │ │ └── mdx.jsx │ ├── lib │ │ └── remToPx.js │ ├── images │ │ └── logos │ │ │ ├── js.svg │ │ │ └── python.svg │ └── styles │ │ └── tailwind.css │ ├── postcss.config.js │ ├── prettier.config.js │ ├── mdx-components.jsx │ ├── .gitignore │ ├── README.md │ ├── next.config.mjs │ ├── tailwind.config.js │ ├── package.json │ └── public │ └── test.sh ├── .prettierrc ├── .postman ├── api └── api_63f5e342-f43f-45fa-9a50-87934ccddcab ├── .vscode ├── extensions.json └── settings.json ├── .github ├── workflows │ ├── js-sdk-publish.yaml │ ├── js-sdk-build.yaml │ ├── ci.yaml │ ├── docs.yaml │ ├── python-sdk-publish.yaml │ ├── python-client-publish.yaml │ └── js-sdk-shared.yaml ├── ISSUE_TEMPLATE │ └── feature_request.md └── PULL_REQUEST_TEMPLATE.md ├── tsconfig.json ├── CONTRIBUTING.md ├── .eslintrc.js ├── LICENSE ├── package.json ├── rfcs ├── 2023-08-28-agent-created-RFC-.md ├── 2023-08-28-Pagination-RFC.md ├── 2023-08-28-list-entities-RFC.md ├── template.md └── 2023-09-15-endpoint-schema.md └── testing_suite ├── local_test.sh └── test.sh /packages/client/js/.npmignore: -------------------------------------------------------------------------------- 1 | README.md -------------------------------------------------------------------------------- /packages/sdk/python/openapitools.json: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | /apps/agentprotocol.ai/ 2 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/utils/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /packages/client/python/agent_protocol_client/test/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.lintstagedrc: -------------------------------------------------------------------------------- 1 | { 2 | "*.{js,jsx,ts,tsx}": ["eslint --fix"] 3 | } 4 | -------------------------------------------------------------------------------- /.prettierignore: -------------------------------------------------------------------------------- 1 | packages/client/python/* 2 | apps/agentprotocol.ai/* 3 | -------------------------------------------------------------------------------- /.husky/pre-commit: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | . "$(dirname "$0")/_/husky.sh" 3 | 4 | npm run ci 5 | -------------------------------------------------------------------------------- /assets/cover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/assets/cover.png -------------------------------------------------------------------------------- /packages/client/python/.gitignore: -------------------------------------------------------------------------------- 1 | .openapi-generator/ 2 | agent_protocol_client_README.md 3 | -------------------------------------------------------------------------------- /packages/client/python/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: generate 2 | generate: 3 | ./scripts/generate.sh -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/utils/compliance/__init__.py: -------------------------------------------------------------------------------- 1 | from .main import check_compliance 2 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: ['next/core-web-vitals'], 3 | } 4 | -------------------------------------------------------------------------------- /packages/client/js/src/apis/index.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | export * from './AgentApi'; 4 | -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "trailingComma": "es5", 3 | "tabWidth": 2, 4 | "semi": false, 5 | "singleQuote": true 6 | } 7 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/bun.lockb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/apps/agentprotocol.ai/bun.lockb -------------------------------------------------------------------------------- /packages/sdk/js/src/yml.d.ts: -------------------------------------------------------------------------------- 1 | declare module '*.yml' { 2 | const content: string 3 | export default content 4 | } 5 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "@/*": ["./src/*"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/apps/agentprotocol.ai/src/app/favicon.ico -------------------------------------------------------------------------------- /apps/agentprotocol.ai/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/apps/agentprotocol.ai/src/app/favicon-16x16.png -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/apps/agentprotocol.ai/src/app/favicon-32x32.png -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/mdx/recma.mjs: -------------------------------------------------------------------------------- 1 | import { mdxAnnotations } from 'mdx-annotations' 2 | 3 | export const recmaPlugins = [mdxAnnotations.recma] 4 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/agi-inc/agent-protocol/HEAD/apps/agentprotocol.ai/src/app/apple-touch-icon.png -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/Logo.jsx: -------------------------------------------------------------------------------- 1 | export function Logo(props) { 2 | return Agent Protocol 3 | } 4 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/prettier.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | singleQuote: true, 3 | semi: false, 4 | plugins: [require('prettier-plugin-tailwindcss')], 5 | } 6 | -------------------------------------------------------------------------------- /packages/client/js/src/index.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | export * from './runtime'; 4 | export * from './apis/index'; 5 | export * from './models/index'; 6 | -------------------------------------------------------------------------------- /packages/client/python/agent_protocol_client/api/__init__.py: -------------------------------------------------------------------------------- 1 | # flake8: noqa 2 | 3 | # import apis into api package 4 | from agent_protocol_client.api.agent_api import AgentApi 5 | -------------------------------------------------------------------------------- /.postman/api: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY 2 | apis[] = {"apiId":"63f5e342-f43f-45fa-9a50-87934ccddcab"} 3 | configVersion = 1.0.0 4 | type = api 5 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/mdx/remark.mjs: -------------------------------------------------------------------------------- 1 | import { mdxAnnotations } from 'mdx-annotations' 2 | import remarkGfm from 'remark-gfm' 3 | 4 | export const remarkPlugins = [mdxAnnotations.remark, remarkGfm] 5 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/mdx-components.jsx: -------------------------------------------------------------------------------- 1 | import * as mdxComponents from '@/components/mdx' 2 | 3 | export function useMDXComponents(components) { 4 | return { 5 | ...components, 6 | ...mdxComponents, 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /.vscode/extensions.json: -------------------------------------------------------------------------------- 1 | { 2 | "recommendations": [ 3 | "ms-python.black-formatter", 4 | "dbaeumer.vscode-eslint", 5 | "ms-python.vscode-pylance", 6 | "ms-python.python", 7 | "bradlc.vscode-tailwindcss" 8 | ] 9 | } 10 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/lib/remToPx.js: -------------------------------------------------------------------------------- 1 | export function remToPx(remValue) { 2 | let rootFontSize = 3 | typeof window === 'undefined' 4 | ? 16 5 | : parseFloat(window.getComputedStyle(document.documentElement).fontSize) 6 | 7 | return parseFloat(remValue) * rootFontSize 8 | } 9 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/Prose.jsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx' 2 | 3 | export function Prose({ as: Component = 'div', className, ...props }) { 4 | return ( 5 | 9 | ) 10 | } 11 | -------------------------------------------------------------------------------- /packages/sdk/js/tsup.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'tsup' 2 | 3 | export default defineConfig({ 4 | entry: ['src/index.ts'], 5 | target: 'node16', 6 | platform: 'node', 7 | format: 'cjs', 8 | minify: true, 9 | sourcemap: true, 10 | dts: true, 11 | loader: { 12 | '.yml': 'text', 13 | }, 14 | }) 15 | -------------------------------------------------------------------------------- /.github/workflows/js-sdk-publish.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Publish JS SDK Package 2 | 3 | on: 4 | push: 5 | tags: [js-sdk-v*] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | publish: 12 | uses: ./.github/workflows/js-sdk-shared.yaml 13 | secrets: inherit 14 | with: 15 | should-publish: true 16 | -------------------------------------------------------------------------------- /packages/client/python/openapitools.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", 3 | "spaces": 4, 4 | "generator-cli": { 5 | "version": "7.2.0" 6 | }, 7 | "projectName": "agent-protocol-client", 8 | "packageUrl": "https://pypi.org/project/agent-protocol-client", 9 | "packageVersion": "1.1.0" 10 | } 11 | -------------------------------------------------------------------------------- /.github/workflows/js-sdk-build.yaml: -------------------------------------------------------------------------------- 1 | name: Build JS SDK 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | - synchronize 8 | - reopened 9 | paths: 10 | - 'packages/sdk/js/**' 11 | 12 | jobs: 13 | build: 14 | uses: ./.github/workflows/js-sdk-shared.yaml 15 | secrets: inherit 16 | with: 17 | should-publish: false 18 | -------------------------------------------------------------------------------- /packages/sdk/python/.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | env 3 | __pycache__ 4 | .vscode 5 | .idea 6 | /.idea/ 7 | venv/ 8 | 9 | # Ignore everything in the generated directory 10 | /generated/* 11 | 12 | # Don't ignore .gitkeep files in the generated directory 13 | !/generated/.gitkeep 14 | .venv 15 | dist 16 | 17 | # Ignore workspaces generated by agent examples 18 | /workspace/* -------------------------------------------------------------------------------- /packages/sdk/python/Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: generate 2 | generate: 3 | poetry run fastapi-codegen \ 4 | --generate-routers \ 5 | --input ../../../schemas/openapi.yml \ 6 | --output agent_protocol \ 7 | --template-dir codegen 8 | mv agent_protocol/main.py agent_protocol/server.py 9 | rm -rf agent_protocol/routers 10 | rm agent_protocol/dependencies.py 11 | black . 12 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/endpoints/page.template.mdx: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Agent Protocol Description', 3 | description: 4 | 'Description of the Agent Protocol, its functionality and how to use it.', 5 | } 6 | 7 | # Endpoints 8 | 9 | The agent exposes the following endpoints (see the [OpenAPI file](https://github.com/AI-Engineer-Foundation/agent-protocol/blob/main/schemas/openapi.yml)): 10 | -------------------------------------------------------------------------------- /packages/client/js/openapitools.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "./node_modules/@openapitools/openapi-generator-cli/config.schema.json", 3 | "spaces": 2, 4 | "generator-cli": { 5 | "version": "7.2.0", 6 | "useDocker": true 7 | }, 8 | "projectName": "agent-protocol-client", 9 | "packageVersion": "1.0.0", 10 | "additionalProperties": { 11 | "npmName": "agent-protocol-client", 12 | "typescriptThreePlus": true 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /packages/client/js/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "declaration": true, 4 | "target": "es5", 5 | "module": "commonjs", 6 | "moduleResolution": "node", 7 | "outDir": "dist", 8 | "lib": [ 9 | "es6", 10 | "dom" 11 | ], 12 | "typeRoots": [ 13 | "node_modules/@types" 14 | ] 15 | }, 16 | "exclude": [ 17 | "dist", 18 | "node_modules", 19 | "examples" 20 | ] 21 | } 22 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "module": "commonjs", 4 | "declaration": true, 5 | "removeComments": true, 6 | "allowSyntheticDefaultImports": true, 7 | "target": "es2017", 8 | "sourceMap": false, 9 | "outDir": "./dist", 10 | "baseUrl": "./", 11 | "strictNullChecks": true, 12 | "esModuleInterop": true 13 | }, 14 | "exclude": ["node_modules", "test", "lib", "**/*spec.ts", "dist"] 15 | } 16 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/middlewares.py: -------------------------------------------------------------------------------- 1 | from fastapi import Request 2 | from fastapi.responses import JSONResponse 3 | from agent_protocol.db import NotFoundException 4 | 5 | async def not_found_exception_handler( 6 | request: Request, exc: NotFoundException 7 | ) -> JSONResponse: 8 | return JSONResponse( 9 | content={"message": f"{exc.item_name} with {exc.item_id} not found."}, 10 | status_code=404, 11 | ) -------------------------------------------------------------------------------- /packages/client/js/src/models/index.ts: -------------------------------------------------------------------------------- 1 | /* tslint:disable */ 2 | /* eslint-disable */ 3 | export * from './Artifact'; 4 | export * from './GetAgentTask404Response'; 5 | export * from './Pagination'; 6 | export * from './Step'; 7 | export * from './StepRequestBody'; 8 | export * from './Task'; 9 | export * from './TaskArtifactsListResponse'; 10 | export * from './TaskListResponse'; 11 | export * from './TaskRequestBody'; 12 | export * from './TaskStepsListResponse'; 13 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/__init__.py: -------------------------------------------------------------------------------- 1 | from .agent import Agent, StepHandler, TaskHandler, base_router as router 2 | from .models import Artifact, Status, StepRequestBody, TaskRequestBody 3 | from .db import Step, Task, TaskDB 4 | 5 | 6 | __all__ = [ 7 | "Agent", 8 | "Artifact", 9 | "Status", 10 | "Step", 11 | "StepHandler", 12 | "StepRequestBody", 13 | "Task", 14 | "TaskDB", 15 | "TaskHandler", 16 | "TaskRequestBody", 17 | "router", 18 | ] 19 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/ignore-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | node_modules 5 | /.pnp 6 | .pnp.js 7 | yarn.lock 8 | package-lock.json 9 | npm-shrinkwrap.json 10 | 11 | # testing 12 | /coverage 13 | 14 | # production 15 | /build 16 | 17 | # misc 18 | .DS_Store 19 | .env.local 20 | .env.development.local 21 | .env.test.local 22 | .env.production.local 23 | 24 | # Next.js 25 | /.next 26 | /out 27 | 28 | # Bun 29 | bun.lockb -------------------------------------------------------------------------------- /apps/agentprotocol.ai/README.md: -------------------------------------------------------------------------------- 1 | # Agent Protocol docs 2 | 3 | Agent Protocol docs are available at [agentprotocol.ai](https://agentprotocol.ai). 4 | 5 | ## Local development 6 | 7 | To run the docs locally, you need to run 8 | 9 | ```sh 10 | npm install 11 | npm run dev 12 | ``` 13 | 14 | ## Tech stack 15 | 16 | The docs are powered by [MDX](https://mdxjs.com/), [Tailwind](https://tailwindcss.com/) and [Next.js](https://nextjs.org/). 17 | 18 | ## Contributing 19 | 20 | We welcome contributions to the Agent Protocol docs! 21 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/icons/DocumentIcon.jsx: -------------------------------------------------------------------------------- 1 | export function DocumentIcon(props) { 2 | return ( 3 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /packages/client/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-protocol-client", 3 | "version": "v1", 4 | "description": "OpenAPI client for agent-protocol-client", 5 | "author": "OpenAPI-Generator", 6 | "repository": { 7 | "type": "git", 8 | "url": "https://github.com/GIT_USER_ID/GIT_REPO_ID.git" 9 | }, 10 | "main": "./dist/index.js", 11 | "typings": "./dist/index.d.ts", 12 | "scripts": { 13 | "build": "tsc", 14 | "prepare": "npm run build" 15 | }, 16 | "devDependencies": { 17 | "typescript": "^4.0" 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/utils/compliance/conftest.py: -------------------------------------------------------------------------------- 1 | def pytest_addoption(parser): 2 | parser.addoption("--url", action="store", default="default name") 3 | 4 | 5 | def pytest_generate_tests(metafunc): 6 | # This is called for every test. Only get/set command line arguments 7 | # if the argument is specified in the list of test "fixturenames". 8 | option_value = metafunc.config.option.url 9 | if "url" in metafunc.fixturenames and option_value is not None: 10 | metafunc.parametrize("url", [option_value]) 11 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/clients/page.mdx: -------------------------------------------------------------------------------- 1 | import { Clients } from '@/components/Clients' 2 | 3 | export const metadata = { 4 | title: 'Agent Protocol Client', 5 | description: 6 | 'The Agent Protocol Clients are libraries that simplifies interaction Agent Protocol.', 7 | } 8 | 9 | export const sections = [] 10 | 11 | # Agent Protocol Client libraries 12 | 13 | Client libraries are used to interact with the Agents. You can use them to communicate with agents from your application (e.g. web app). {{ className:"lead" }} 14 | 15 | 16 | -------------------------------------------------------------------------------- /packages/sdk/python/codegen/main.jinja2: -------------------------------------------------------------------------------- 1 | from __future__ import annotations 2 | 3 | from fastapi import FastAPI 4 | 5 | from agent_protocol.db import NotFoundException 6 | from agent_protocol.middlewares import not_found_exception_handler 7 | 8 | app = FastAPI( 9 | {% if info %} 10 | {% for key,value in info.items() %} 11 | {% set info_value= value.__repr__() %} 12 | {{ key }} = {{info_value}}, 13 | {% endfor %} 14 | {% endif %} 15 | ) 16 | 17 | app.add_exception_handler(NotFoundException, not_found_exception_handler) -------------------------------------------------------------------------------- /packages/sdk/python/examples/minimal.py: -------------------------------------------------------------------------------- 1 | from agent_protocol import Agent, Task, Step 2 | 3 | 4 | async def task_handler(task: Task) -> None: 5 | print(f"task: {task.input}") 6 | await Agent.db.create_step(task.task_id, task.input) 7 | 8 | 9 | async def step_handler(step: Step) -> Step: 10 | print(f"step: {step.input}") 11 | await Agent.db.create_step(step.task_id, f"Next step from step {step.name}") 12 | step.output = step.input 13 | return step 14 | 15 | 16 | Agent.setup_agent(task_handler, step_handler).start() 17 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/icons/ListIcon.jsx: -------------------------------------------------------------------------------- 1 | export function ListIcon(props) { 2 | return ( 3 | 16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /packages/sdk/js/examples/minimal.ts: -------------------------------------------------------------------------------- 1 | import Agent, { 2 | type StepResult, 3 | type StepHandler, 4 | type TaskInput, 5 | type StepInput, 6 | } from 'agent-protocol' 7 | 8 | async function taskHandler(taskInput: TaskInput | null): Promise { 9 | console.log(`task: ${taskInput}`) 10 | 11 | async function stepHandler(stepInput: StepInput | null): Promise { 12 | console.log(`step: ${stepInput}`) 13 | return { 14 | output: stepInput, 15 | } 16 | } 17 | 18 | return stepHandler 19 | } 20 | 21 | Agent.handleTask(taskHandler, {}).start() 22 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/sdks/page.mdx: -------------------------------------------------------------------------------- 1 | import { Libraries } from '@/components/Libraries' 2 | 3 | export const metadata = { 4 | title: 'Agent Protocol SDKs', 5 | description: 6 | 'The Agent Protocol SDKs are libraries that simplifies implementing Agent Protocol.', 7 | } 8 | 9 | export const sections = [] 10 | 11 | # Agent Protocol SDKs 12 | 13 | SDKs are libraries that should streamline the implementation of Agent Protocol in your agent. They are not required in order to implement the Agent Protocol. However, they can help you with implementing Agent Protocol to your agent. 14 | 15 | 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yaml: -------------------------------------------------------------------------------- 1 | name: CI 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | build: 7 | runs-on: ubuntu-20.04 8 | steps: 9 | - name: Checkout repository 10 | uses: actions/checkout@v3 11 | 12 | - name: Setup Node 13 | uses: actions/setup-node@v3 14 | with: 15 | node-version: '16.x' 16 | registry-url: 'https://registry.npmjs.org' 17 | cache: npm 18 | cache-dependency-path: package-lock.json 19 | 20 | - name: Install dependencies 21 | run: npm ci 22 | 23 | - name: Run CI script 24 | run: npm run ci 25 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/next.config.mjs: -------------------------------------------------------------------------------- 1 | import nextMDX from '@next/mdx' 2 | 3 | import { recmaPlugins } from './src/mdx/recma.mjs' 4 | import { rehypePlugins } from './src/mdx/rehype.mjs' 5 | import { remarkPlugins } from './src/mdx/remark.mjs' 6 | import withSearch from './src/mdx/search.mjs' 7 | 8 | const withMDX = nextMDX({ 9 | options: { 10 | remarkPlugins, 11 | rehypePlugins, 12 | recmaPlugins, 13 | }, 14 | }) 15 | 16 | /** @type {import('next').NextConfig} */ 17 | const nextConfig = { 18 | pageExtensions: ['js', 'jsx', 'ts', 'tsx', 'mdx'], 19 | } 20 | 21 | export default withSearch(withMDX(nextConfig)) 22 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/server.py: -------------------------------------------------------------------------------- 1 | # generated by fastapi-codegen: 2 | # filename: openapi.yml 3 | # timestamp: 2023-09-15T22:33:36+00:00 4 | 5 | from __future__ import annotations 6 | 7 | from fastapi import FastAPI 8 | 9 | from agent_protocol.db import NotFoundException 10 | from agent_protocol.middlewares import not_found_exception_handler 11 | 12 | app = FastAPI( 13 | title="Agent Communication Protocol", 14 | description="Specification of the API protocol for communication with an agent.", 15 | version="v1", 16 | ) 17 | 18 | app.add_exception_handler(NotFoundException, not_found_exception_handler) -------------------------------------------------------------------------------- /.postman/api_63f5e342-f43f-45fa-9a50-87934ccddcab: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY 2 | configVersion = 1.0.0 3 | type = apiEntityData 4 | 5 | [config] 6 | id = 63f5e342-f43f-45fa-9a50-87934ccddcab 7 | 8 | [config.relations] 9 | 10 | [config.relations.collections] 11 | rootDirectory = postman/collections 12 | 13 | [config.relations.collections.metaData] 14 | 15 | [config.relations.apiDefinition] 16 | rootDirectory = schemas 17 | files[] = {"path":"openapi.json","metaData":{}} 18 | files[] = {"path":"openapi.yml","metaData":{}} 19 | 20 | [config.relations.apiDefinition.metaData] 21 | type = openapi:3 22 | rootFiles[] = openapi.yml 23 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to `agent-protocol` 2 | 3 | Thank you for your interest in contributing to `agent-protocol`. Your contributions are valuable to us. 4 | 5 | Before you get started, please make sure to read and follow our [Contribution Guide](https://agentprotocol.ai/contributing/guide). This guide provides detailed information on how to contribute to our project, including coding standards, best practices, and more. 6 | 7 | If you have any questions or need assistance during the contribution process, feel free to [make an issue on our GitHub](https://github.com/AI-Engineer-Foundation/agent-protocol/issues). 8 | 9 | We appreciate your support and look forward to your contributions! 10 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | --- 8 | 9 | **Is your feature request related to a problem? Please describe.** 10 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 11 | 12 | **Describe the solution you'd like** 13 | A clear and concise description of what you want to happen. 14 | 15 | **Describe alternatives you've considered** 16 | A clear and concise description of any alternative solutions or features you've considered. 17 | 18 | **Additional context** 19 | Add any other context or screenshots about the feature request here. 20 | -------------------------------------------------------------------------------- /packages/sdk/js/examples/google-cloud-functions.ts: -------------------------------------------------------------------------------- 1 | import functions from '@google-cloud/functions-framework' 2 | import Agent, { 3 | type StepResult, 4 | type StepHandler, 5 | type TaskInput, 6 | type StepInput, 7 | } from 'agent-protocol' 8 | 9 | async function taskHandler(taskInput: TaskInput | null): Promise { 10 | console.log(`task: ${taskInput}`) 11 | 12 | async function stepHandler(stepInput: StepInput | null): Promise { 13 | console.log(`step: ${stepInput}`) 14 | return { 15 | output: stepInput, 16 | } 17 | } 18 | 19 | return stepHandler 20 | } 21 | 22 | const app = Agent.handleTask(taskHandler, {}).build() 23 | functions.http('agentprotocol', app) 24 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/images/logos/js.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /packages/sdk/js/examples/firebase-functions.ts: -------------------------------------------------------------------------------- 1 | import { onRequest } from 'firebase-functions/v2/https' 2 | import Agent, { 3 | type StepResult, 4 | type StepHandler, 5 | type TaskInput, 6 | type StepInput, 7 | } from 'agent-protocol' 8 | 9 | async function taskHandler(taskInput: TaskInput | null): Promise { 10 | console.log(`task: ${taskInput}`) 11 | 12 | async function stepHandler(stepInput: StepInput | null): Promise { 13 | console.log(`step: ${stepInput}`) 14 | return { 15 | output: stepInput, 16 | } 17 | } 18 | 19 | return stepHandler 20 | } 21 | 22 | const app = Agent.handleTask(taskHandler, {}).build() 23 | 24 | export const agentprotocol = onRequest(app) 25 | -------------------------------------------------------------------------------- /packages/sdk/python/agent_protocol/cli.py: -------------------------------------------------------------------------------- 1 | import click 2 | 3 | from agent_protocol.utils.compliance import check_compliance 4 | 5 | 6 | @click.group() 7 | def cli(): 8 | pass 9 | 10 | 11 | @cli.command( 12 | "test", 13 | context_settings=dict( 14 | ignore_unknown_options=True, 15 | ), 16 | ) 17 | @click.option("--url", "-u", type=str, required=True, help="URL of the Agent API") 18 | @click.argument("args", nargs=-1, type=click.UNPROCESSED) 19 | def _check_compliance(url: str, args: list): 20 | """ 21 | This script checks if the Agent API is Agent Protocol compliant. 22 | 23 | In the background it runs pytest, you can pass additional arguments to pytest. 24 | """ 25 | check_compliance(url, args) 26 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/styles/tailwind.css: -------------------------------------------------------------------------------- 1 | @layer base { 2 | :root { 3 | --shiki-color-text: theme('colors.white'); 4 | --shiki-token-constant: theme('colors.violet.300'); 5 | --shiki-token-string: theme('colors.violet.300'); 6 | --shiki-token-comment: theme('colors.zinc.500'); 7 | --shiki-token-keyword: theme('colors.sky.300'); 8 | --shiki-token-parameter: theme('colors.violet.300'); 9 | --shiki-token-function: theme('colors.violet.300'); 10 | --shiki-token-string-expression: theme('colors.violet.300'); 11 | --shiki-token-punctuation: theme('colors.zinc.200'); 12 | } 13 | 14 | [inert] ::-webkit-scrollbar { 15 | display: none; 16 | } 17 | } 18 | 19 | @tailwind base; 20 | @tailwind components; 21 | @tailwind utilities; 22 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | env: { 3 | browser: true, 4 | es2021: true, 5 | }, 6 | ignorePatterns: ['dist', '.eslintrc.js'], 7 | extends: ['standard-with-typescript', 'prettier'], 8 | overrides: [ 9 | { 10 | env: { 11 | node: true, 12 | }, 13 | files: ['.eslintrc.{js,cjs}'], 14 | parserOptions: { 15 | sourceType: 'script', 16 | }, 17 | }, 18 | ], 19 | parserOptions: { 20 | ecmaVersion: 'latest', 21 | sourceType: 'module', 22 | project: 'tsconfig.json', 23 | }, 24 | rules: { 25 | quotes: ['error', 'single', { avoidEscape: true }], 26 | semi: ['error', 'never'], 27 | '@typescript-eslint/restrict-template-expressions': 'off', 28 | '@typescript-eslint/no-extraneous-class': 'off', 29 | }, 30 | } 31 | -------------------------------------------------------------------------------- /packages/sdk/js/examples/aws-lambda.ts: -------------------------------------------------------------------------------- 1 | import awsServerlessExpress from 'aws-serverless-express' 2 | import Agent, { 3 | type StepResult, 4 | type StepHandler, 5 | type TaskInput, 6 | type StepInput, 7 | } from 'agent-protocol' 8 | 9 | async function taskHandler(taskInput: TaskInput | null): Promise { 10 | console.log(`task: ${taskInput}`) 11 | 12 | async function stepHandler(stepInput: StepInput | null): Promise { 13 | console.log(`step: ${stepInput}`) 14 | return { 15 | output: stepInput, 16 | } 17 | } 18 | 19 | return stepHandler 20 | } 21 | 22 | const app = Agent.handleTask(taskHandler, {}).build() 23 | const server = awsServerlessExpress.createServer(app) 24 | 25 | exports.handler = (event, context) => { 26 | awsServerlessExpress.proxy(server, event, context) 27 | } 28 | -------------------------------------------------------------------------------- /packages/client/js/package-lock.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-protocol-client", 3 | "version": "v1", 4 | "lockfileVersion": 3, 5 | "requires": true, 6 | "packages": { 7 | "": { 8 | "name": "agent-protocol-client", 9 | "version": "v1", 10 | "devDependencies": { 11 | "typescript": "^4.0" 12 | } 13 | }, 14 | "node_modules/typescript": { 15 | "version": "4.9.5", 16 | "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz", 17 | "integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==", 18 | "dev": true, 19 | "bin": { 20 | "tsc": "bin/tsc", 21 | "tsserver": "bin/tsserver" 22 | }, 23 | "engines": { 24 | "node": ">=4.2.0" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/not-found.jsx: -------------------------------------------------------------------------------- 1 | import { Button } from '@/components/Button' 2 | import { HeroPattern } from '@/components/HeroPattern' 3 | 4 | export default function NotFound() { 5 | return ( 6 | <> 7 | 8 |
9 |

10 | 404 11 |

12 |

13 | Page not found 14 |

15 |

16 | Sorry, we couldn't find the page you're looking for. 17 |

18 | 21 |
22 | 23 | ) 24 | } 25 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/images/logos/python.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | -------------------------------------------------------------------------------- /packages/client/python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "agent-protocol-client" 3 | version = "1.1.0" 4 | description = "Agent Communication Protocol Client" 5 | authors = ["AI Engineers Foundation "] 6 | license = "MIT" 7 | readme = "README.md" 8 | homepage = "https://agentprotocol.ai/" 9 | repository = "https://github.com/AI-Engineers-Foundation/agent-protocol/tree/main/packages/client/python" 10 | packages = [{ include = "agent_protocol_client" }] 11 | 12 | [tool.poetry.dependencies] 13 | python = "^3.7" 14 | 15 | urllib3 = "^1.25.3" 16 | aiohttp = "^3.8.4" 17 | pydantic = ">=1.10.5, <3.0.0" 18 | python-dateutil = "^2.8.2" 19 | 20 | [tool.poetry.group.dev.dependencies] 21 | black = "^23.7.0" 22 | 23 | [build-system] 24 | requires = ["poetry-core"] 25 | build-backend = "poetry.core.masonry.api" 26 | 27 | [tool.poetry.urls] 28 | "Bug Tracker" = "https://github.com/AI-Engineers-Foundation/agent-protocol/issues" 29 | -------------------------------------------------------------------------------- /.github/workflows/docs.yaml: -------------------------------------------------------------------------------- 1 | name: Build JS SDK 2 | 3 | on: 4 | pull_request: 5 | types: 6 | - opened 7 | - synchronize 8 | - reopened 9 | paths: 10 | - 'apps/agentprotocol.ai/**' 11 | 12 | jobs: 13 | build: 14 | runs-on: ubuntu-20.04 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v3 18 | 19 | - name: Setup Node 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: '16.x' 23 | registry-url: 'https://registry.npmjs.org' 24 | cache: npm 25 | cache-dependency-path: package-lock.json 26 | 27 | - name: Install dependencies 28 | working-directory: ./apps/agentprotocol.ai/ 29 | run: npm ci 30 | 31 | # - name: Lint 32 | # working-directory: ./apps/agentprotocol.ai/ 33 | # run: npm run lint 34 | 35 | - name: Build 36 | working-directory: ./apps/agentprotocol.ai/ 37 | run: npm run build 38 | -------------------------------------------------------------------------------- /packages/client/python/agent_protocol_client/api_response.py: -------------------------------------------------------------------------------- 1 | """API response object.""" 2 | 3 | from __future__ import annotations 4 | from typing import Any, Dict, Optional 5 | from pydantic import Field, StrictInt, StrictStr 6 | 7 | 8 | class ApiResponse: 9 | """ 10 | API response object 11 | """ 12 | 13 | status_code: Optional[StrictInt] = Field(None, description="HTTP status code") 14 | headers: Optional[Dict[StrictStr, StrictStr]] = Field( 15 | None, description="HTTP headers" 16 | ) 17 | data: Optional[Any] = Field( 18 | None, description="Deserialized data given the data type" 19 | ) 20 | raw_data: Optional[Any] = Field(None, description="Raw data (HTTP response body)") 21 | 22 | def __init__( 23 | self, status_code=None, headers=None, data=None, raw_data=None 24 | ) -> None: 25 | self.status_code = status_code 26 | self.headers = headers 27 | self.data = data 28 | self.raw_data = raw_data 29 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/providers.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import { useEffect } from 'react' 4 | import { ThemeProvider, useTheme } from 'next-themes' 5 | 6 | function ThemeWatcher() { 7 | let { resolvedTheme, setTheme } = useTheme() 8 | 9 | useEffect(() => { 10 | let media = window.matchMedia('(prefers-color-scheme: dark)') 11 | 12 | function onMediaChange() { 13 | let systemTheme = media.matches ? 'dark' : 'light' 14 | if (resolvedTheme === systemTheme) { 15 | setTheme('system') 16 | } 17 | } 18 | 19 | onMediaChange() 20 | media.addEventListener('change', onMediaChange) 21 | 22 | return () => { 23 | media.removeEventListener('change', onMediaChange) 24 | } 25 | }, [resolvedTheme, setTheme]) 26 | 27 | return null 28 | } 29 | 30 | export function Providers({ children }) { 31 | return ( 32 | 33 | 34 | {children} 35 | 36 | ) 37 | } 38 | -------------------------------------------------------------------------------- /packages/sdk/js/src/index.ts: -------------------------------------------------------------------------------- 1 | import { 2 | type TaskInput, 3 | type Artifact, 4 | type StepInput, 5 | type StepOutput, 6 | type Step, 7 | type StepRequestBody, 8 | type Task, 9 | type TaskRequestBody, 10 | } from './models' 11 | import { 12 | type StepHandler, 13 | type TaskHandler, 14 | StepResultWithDefaults, 15 | createAgentTask, 16 | listAgentTasks, 17 | getAgentTask, 18 | listAgentTaskSteps, 19 | executeAgentTaskStep, 20 | getAgentTaskStep, 21 | Agent, 22 | } from './agent' 23 | 24 | export { 25 | type TaskInput, 26 | type Artifact, 27 | type StepInput, 28 | type StepOutput, 29 | type Step, 30 | type StepRequestBody, 31 | type Task, 32 | type TaskRequestBody, 33 | type StepHandler, 34 | type TaskHandler, 35 | StepResultWithDefaults as StepResult, 36 | createAgentTask, 37 | listAgentTasks, 38 | getAgentTask, 39 | listAgentTaskSteps, 40 | executeAgentTaskStep, 41 | getAgentTaskStep, 42 | } 43 | 44 | export { v4 } from 'uuid' 45 | 46 | export default Agent 47 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 e2b 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /packages/client/js/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | # OpenAPI Generator Ignore 2 | # Generated by openapi-generator https://github.com/openapitools/openapi-generator 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | -------------------------------------------------------------------------------- /packages/client/python/.openapi-generator-ignore: -------------------------------------------------------------------------------- 1 | # OpenAPI Generator Ignore 2 | # Generated by openapi-generator https://github.com/openapitools/openapi-generator 3 | 4 | # Use this file to prevent files from being overwritten by the generator. 5 | # The patterns follow closely to .gitignore or .dockerignore. 6 | 7 | # As an example, the C# client generator defines ApiClient.cs. 8 | # You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: 9 | #ApiClient.cs 10 | 11 | # You can match any string of characters against a directory, file or extension with a single asterisk (*): 12 | #foo/*/qux 13 | # The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux 14 | 15 | # You can recursively match patterns against a directory, file or extension with a double asterisk (**): 16 | #foo/**/qux 17 | # This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux 18 | 19 | # You can also negate patterns with an exclamation (!). 20 | # For example, you can ignore all files in a docs folder with the file extension .md: 21 | #docs/*.md 22 | # Then explicitly reverse the ignore rule for a single file: 23 | #!docs/README.md 24 | -------------------------------------------------------------------------------- /packages/sdk/python/pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.poetry] 2 | name = "agent_protocol" 3 | version = "1.0.2" 4 | description = "API for interacting with Agents that use the Agent Protocol" 5 | authors = ["AI Engineers Foundation "] 6 | license = "MIT" 7 | readme = "README.md" 8 | homepage = "https://agentprotocol.ai/" 9 | repository = "https://github.com/AI-Engineers-Foundation/agent-protocol/tree/main/packages/sdk/python" 10 | packages = [{ include = "agent_protocol" }] 11 | 12 | [tool.poetry.dependencies] 13 | python = ">=3.10, <4.0.0" 14 | fastapi = "^0.100.0" 15 | hypercorn = "^0.14.4" 16 | pytest = "^7.0.0" 17 | pydantic = ">=1.10.5, <3.0.0" 18 | click = "^8.1.6" 19 | requests = "^2.31.0" 20 | python-multipart = "^0.0.6" 21 | aiofiles = "^23.1.0" 22 | 23 | [tool.poetry.group.dev.dependencies] 24 | fastapi-code-generator = "^0.4.2" 25 | 26 | [build-system] 27 | requires = ["poetry-core"] 28 | build-backend = "poetry.core.masonry.api" 29 | 30 | [tool.poetry.scripts] 31 | agent-protocol = "agent_protocol.cli:cli" 32 | 33 | [tool.poetry.urls] 34 | "Bug Tracker" = "https://github.com/AI-Engineers-Foundation/agent-protocol/issues" 35 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/sdks/custom/page.mdx: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Custom implementation Agent Protocol', 3 | description: 'Create your own way how to implement Agent Protocol', 4 | } 5 | 6 | export const sections = [] 7 | 8 | # Own Implementation 9 | 10 | Maybe there isn't an SDK for your programming language, maybe you need something extra, or maybe you just want to do it yourself. In that case, you can implement the Agent Protocol yourself. 11 | 12 | ## Generating models 13 | 14 | To reduce the amount of writing boilerplate, you can generate the models from the [OpenAPI specification](https://github.com/AI-Engineer-Foundation/agent-protocol/blob/main/schemas/openapi.yml) using some of the tools available [here](https://openapi.tools/). 15 | 16 | ## Test your implementation 17 | 18 | To test your implementation, you can use the [Agent Protocol Compliance Test](/compliance). 19 | 20 | ## Contribute 21 | 22 | If you have implemented the Agent Protocol in your programming language, please consider contributing it to the community. You can do so by creating a pull request to the [Agent Protocol repository](https://github.com/AI-Engineer-Foundation/agent-protocol/). 23 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/GridPattern.jsx: -------------------------------------------------------------------------------- 1 | import { useId } from 'react' 2 | 3 | export function GridPattern({ width, height, x, y, squares, ...props }) { 4 | let patternId = useId() 5 | 6 | return ( 7 | 41 | ) 42 | } 43 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-protocol", 3 | "scripts": { 4 | "ci": "prettier . -c && eslint . --ext .ts,.tsx", 5 | "prettier": "prettier . -w", 6 | "lint": "eslint . --ext .ts,.tsx --fix", 7 | "prepare": "husky install", 8 | "generate:client:js": "openapi-generator-cli generate --global-property apis,models,supportingFiles,modelDocs=false -i schemas/openapi.yml -g typescript-fetch -c packages/client/js/openapitools.json -o packages/client/js --additional-properties=generateSourceCodeOnly=true" 9 | }, 10 | "husky": { 11 | "hooks": { 12 | "pre-commit": "npm run ci" 13 | } 14 | }, 15 | "devDependencies": { 16 | "@openapitools/openapi-generator-cli": "^2.9.0", 17 | "@typescript-eslint/eslint-plugin": "^5.62.0", 18 | "eslint": "^8.45.0", 19 | "eslint-config-prettier": "^8.8.0", 20 | "eslint-config-standard-with-typescript": "^36.1.0", 21 | "husky": "^7.0.0", 22 | "prettier": "^3.0.0", 23 | "prettier-plugin-tailwindcss": "^0.5.11", 24 | "typescript": "^5.1.6" 25 | }, 26 | "dependencies": { 27 | "express": "^4.18.2", 28 | "express-openapi-validator": "^5.1.5", 29 | "express-serve-static-core": "^0.1.1" 30 | } 31 | } -------------------------------------------------------------------------------- /packages/client/python/scripts/generate.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | set -e 3 | 4 | # Ensure we're in the packages/client/python folder 5 | cd "$(dirname "$0")/.." 6 | 7 | if ! command -v npx &> /dev/null 8 | then 9 | if ! command -v npm &> /dev/null 10 | then 11 | echo "npm & npx could not be found" 12 | echo "Install npm and try again" 13 | exit 1 14 | fi 15 | 16 | echo "npx could not be found" 17 | 18 | echo -n "Do you want to install it? (y/N) " 19 | read -r ANSWER 20 | 21 | if [ "$ANSWER" != y ] 22 | then 23 | exit 1 24 | fi 25 | fi 26 | 27 | # Get the version from pyproject.toml and set it in openapitools.json 28 | PACKAGE_VERSION=$(grep -oP '(?<=version = ")[^"]*' pyproject.toml) 29 | sed -i "s/\"packageVersion\": \".*\"/\"packageVersion\": \"$PACKAGE_VERSION\"/" openapitools.json 30 | 31 | npx @openapitools/openapi-generator-cli generate \ 32 | --global-property apis,models,supportingFiles,modelDocs=false \ 33 | -i ../../../schemas/openapi.yml \ 34 | -g python-pydantic-v1 \ 35 | -c openapitools.json \ 36 | --library asyncio \ 37 | --additional-properties=generateSourceCodeOnly=true,packageName=agent_protocol_client 38 | 39 | black . 40 | -------------------------------------------------------------------------------- /packages/client/python/agent_protocol_client/models/__init__.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | 3 | # flake8: noqa 4 | """ 5 | Agent Protocol 6 | 7 | Specification of the API protocol for communication with an agent. 8 | 9 | The version of the OpenAPI document: v1 10 | Generated by OpenAPI Generator (https://openapi-generator.tech) 11 | 12 | Do not edit the class manually. 13 | """ # noqa: E501 14 | 15 | 16 | # import models into model package 17 | from agent_protocol_client.models.artifact import Artifact 18 | from agent_protocol_client.models.get_agent_task404_response import ( 19 | GetAgentTask404Response, 20 | ) 21 | from agent_protocol_client.models.pagination import Pagination 22 | from agent_protocol_client.models.step import Step 23 | from agent_protocol_client.models.step_request_body import StepRequestBody 24 | from agent_protocol_client.models.task import Task 25 | from agent_protocol_client.models.task_artifacts_list_response import ( 26 | TaskArtifactsListResponse, 27 | ) 28 | from agent_protocol_client.models.task_list_response import TaskListResponse 29 | from agent_protocol_client.models.task_request_body import TaskRequestBody 30 | from agent_protocol_client.models.task_steps_list_response import TaskStepsListResponse 31 | -------------------------------------------------------------------------------- /rfcs/2023-08-28-agent-created-RFC-.md: -------------------------------------------------------------------------------- 1 | # Tell the user whether the artifact is agent generated or not 2 | 3 | | Feature name | Artifact Created At | 4 | | :------------ | :---------------------------------------------------------------------------- | 5 | | **Author(s)** | Merwane Hamadi (merwanehamadi@gmail.com) Craig Swift (craigswift13@gmail.com) | 6 | | **RFC PR:** | | 7 | | **Created** | 2023-08-28 | 8 | | **Obsoletes** | | 9 | 10 | ## Summary 11 | 12 | Add agent_created to the artifact response body. 13 | 14 | ## Motivation 15 | 16 | If we don't know whether an artifact is generated by the agent or not, it's hard to know what the agent did or did not do. 17 | 18 | ## Agent Builders Benefit 19 | 20 | - They can tell their users what their agent did. 21 | 22 | ## Design Proposal 23 | 24 | agent_created field in the response body 25 | 26 | ### Alternatives Considered 27 | 28 | ### Compatibility 29 | 30 | - This is backwards compatible. We're just adding something. 31 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/rfc/page.mdx: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Feature requests', 3 | description: 4 | "The RFC (Request For Comments) is a place where we can discuss and propose new ideas for the project. It's also a place where we can document the current state of the project.", 5 | } 6 | 7 | # Feature requests 8 | 9 | Agent Protocol should be a product of a community of agent builders. We want to work with the community to define the protocol in a way that is easy to understand and implement. 10 | RFC (Request for comments) is a way how we want to discuss and propose new ideas for the project. 11 | 12 | ## RFC Process 13 | 14 | 1. Create a new branch from `main` with the name `rfc/your-rfc-name` 15 | 2. Create a new file in `rfcs` folder with the name `your-rfc-name.md` 16 | 3. Write your RFC 17 | 4. Create a PR to `main` branch 18 | 5. Discuss and iterate on your RFC 19 | 6. By default, RFCs are accepted after week of discussion 20 | 7. After RFC is accepted, the PR is merged 21 | 8. New version of the protocol is released and RFC marked as completed 22 | 23 | ## RFC Template 24 | 25 | You can find a template for RFC in [`rfcs/template.md`](https://github.com/AI-Engineer-Foundation/agent-protocol/blob/main/rfcs/template.md). 26 | -------------------------------------------------------------------------------- /.github/workflows/python-sdk-publish.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Publish Python SDK Package 2 | 3 | on: 4 | push: 5 | tags: [python-sdk-v*] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | publish: 12 | name: Build and publish the Python package 13 | runs-on: ubuntu-20.04 14 | defaults: 15 | run: 16 | working-directory: ./packages/sdk/python/ 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v3 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: '3.10' 25 | 26 | - name: Install and configure Poetry 27 | uses: snok/install-poetry@v1 28 | with: 29 | version: 1.5.1 30 | virtualenvs-create: true 31 | virtualenvs-in-project: true 32 | installer-parallel: true 33 | 34 | - name: Build Package 35 | run: poetry build 36 | 37 | - name: Config Poetry 38 | run: | 39 | poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} 40 | 41 | - name: Publish Package 42 | run: poetry publish 43 | 44 | - name: Release 45 | uses: softprops/action-gh-release@v1 46 | with: 47 | generate_release_notes: true 48 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/layout.jsx: -------------------------------------------------------------------------------- 1 | import glob from 'fast-glob' 2 | 3 | import { Providers } from '@/app/providers' 4 | import { Layout } from '@/components/Layout' 5 | import { Analytics } from '@vercel/analytics/react' 6 | 7 | import '@/styles/tailwind.css' 8 | 9 | export const metadata = { 10 | title: { 11 | template: '%s - Agent Protocol', 12 | default: 'Agent Protocol documentation', 13 | }, 14 | } 15 | 16 | export default async function RootLayout({ children }) { 17 | let pages = await glob('**/*.mdx', { cwd: 'src/app' }) 18 | let allSections = await Promise.all( 19 | pages.map(async (filename) => [ 20 | '/' + filename.replace(/(^|\/)page\.mdx$/, ''), 21 | (await import(`./${filename}`)).sections, 22 | ]), 23 | ) 24 | allSections = Object.fromEntries(allSections) 25 | 26 | return ( 27 | 28 | 29 | 30 |
31 | 32 | {children} 33 | 34 | 35 |
36 |
37 | 38 | 39 | ) 40 | } 41 | -------------------------------------------------------------------------------- /.github/workflows/python-client-publish.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Publish Python Agent Client Package 2 | 3 | on: 4 | push: 5 | tags: [python-client-v*] 6 | 7 | permissions: 8 | contents: write 9 | 10 | jobs: 11 | publish: 12 | name: Build and publish the Python package 13 | runs-on: ubuntu-20.04 14 | defaults: 15 | run: 16 | working-directory: ./packages/client/python/ 17 | steps: 18 | - name: Checkout repository 19 | uses: actions/checkout@v3 20 | 21 | - name: Set up Python 22 | uses: actions/setup-python@v4 23 | with: 24 | python-version: '3.10' 25 | 26 | - name: Install and configure Poetry 27 | uses: snok/install-poetry@v1 28 | with: 29 | version: 1.5.1 30 | virtualenvs-create: true 31 | virtualenvs-in-project: true 32 | installer-parallel: true 33 | 34 | - name: Build Package 35 | run: poetry build 36 | 37 | - name: Config Poetry 38 | run: | 39 | poetry config pypi-token.pypi ${{ secrets.PYPI_TOKEN }} 40 | 41 | - name: Publish Package 42 | run: poetry publish 43 | 44 | - name: Release 45 | uses: softprops/action-gh-release@v1 46 | with: 47 | generate_release_notes: true 48 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | # Pull Request 2 | 3 | 4 | 5 | ## Description 6 | 7 | Please provide a brief description of your pull request. Include any relevant context, such as the issue it addresses or the feature it introduces. 8 | 9 | ## Checklist 10 | 11 | Please review and check the following items to ensure your pull request can be processed smoothly: 12 | 13 | - [ ] My code adheres to the project's coding standards and style guidelines. 14 | 15 | - [ ] I have tested my changes thoroughly, including unit tests where applicable. 16 | 17 | - [ ] I have updated the documentation to reflect any changes made in this pull request. 18 | 19 | - [ ] My branch is up-to-date with the latest changes from the main branch. 20 | 21 | - [ ] I have received code review feedback and addressed any comments or concerns. 22 | 23 | ## Additional Notes 24 | 25 | If there are any additional details or considerations that reviewers should be aware of, please provide them here. 26 | 27 | ## References, Fixes and Closes 28 | 29 | List any other pull requests or issues that this pull request references, fixes, or closes, if applicable. 30 | 31 | - References #related_issue_number 32 | - Fixes #related_issue_number 33 | - Closes #related_issue_number 34 | -------------------------------------------------------------------------------- /.github/workflows/js-sdk-shared.yaml: -------------------------------------------------------------------------------- 1 | name: Build and Publish JS SDK Package 2 | 3 | on: 4 | workflow_call: 5 | inputs: 6 | should-publish: 7 | required: false 8 | type: boolean 9 | default: false 10 | 11 | jobs: 12 | build: 13 | name: Build and optionally publish SDK to NPM 14 | runs-on: ubuntu-20.04 15 | steps: 16 | - name: Checkout repository 17 | uses: actions/checkout@v3 18 | 19 | - name: Setup Node 20 | uses: actions/setup-node@v3 21 | with: 22 | node-version: '16.x' 23 | registry-url: 'https://registry.npmjs.org' 24 | cache: npm 25 | cache-dependency-path: package-lock.json 26 | 27 | - name: Install dependencies 28 | working-directory: ./packages/sdk/js/ 29 | run: npm ci 30 | 31 | - name: Build package 32 | working-directory: ./packages/sdk/js/ 33 | run: npm run build 34 | 35 | - name: Publish package 36 | if: ${{ inputs.should-publish }} 37 | run: npm publish --access=public 38 | working-directory: ./packages/sdk/js/ 39 | env: 40 | NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} 41 | 42 | - name: Release 43 | if: ${{ inputs.should-publish }} 44 | uses: softprops/action-gh-release@v1 45 | with: 46 | generate_release_notes: true 47 | -------------------------------------------------------------------------------- /rfcs/2023-08-28-Pagination-RFC.md: -------------------------------------------------------------------------------- 1 | # List tasks, artifacts and steps in a paginated way. 2 | 3 | | Feature name | Support Pagination | 4 | | :------------ | :---------------------------------------------------------------------------- | 5 | | **Author(s)** | Merwane Hamadi (merwanehamadi@gmail.com) Craig Swift (craigswift13@gmail.com) | 6 | | **RFC PR:** | [PR 53](https://github.com/e2b-dev/agent-protocol/pull/53) | 7 | | **Updated** | 2023-08-28 | 8 | | **Obsoletes** | | 9 | 10 | ## Summary 11 | 12 | We just want to be able to list tasks, artifacts and steps in a paginated way. 13 | 14 | ## Motivation 15 | 16 | Every app needs this. It's not really farfetched 17 | 18 | ## Agent Builders Benefit 19 | 20 | - They can paginate their tasks, steps and artifacts. 21 | 22 | ## Design Proposal 23 | 24 | Query parameters for now. 25 | 26 | ### Alternatives Considered 27 | 28 | - query parameter is the simplest, leanest design. We can add more later (body, headers, etc) => let's start lean. 29 | - for now, we won't add the pages in the response of the requests, this is another RFC. 30 | 31 | ### Compatibility 32 | 33 | - This is backwards compatible. We're just adding things. 34 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: ['./src/**/*.{js,mjs,jsx,mdx}'], 4 | darkMode: 'class', 5 | theme: { 6 | fontSize: { 7 | '2xs': ['0.75rem', { lineHeight: '1.25rem' }], 8 | xs: ['0.8125rem', { lineHeight: '1.5rem' }], 9 | sm: ['0.875rem', { lineHeight: '1.5rem' }], 10 | base: ['1rem', { lineHeight: '1.75rem' }], 11 | lg: ['1.125rem', { lineHeight: '1.75rem' }], 12 | xl: ['1.25rem', { lineHeight: '1.75rem' }], 13 | '2xl': ['1.5rem', { lineHeight: '2rem' }], 14 | '3xl': ['1.875rem', { lineHeight: '2.25rem' }], 15 | '4xl': ['2.25rem', { lineHeight: '2.5rem' }], 16 | '5xl': ['3rem', { lineHeight: '1' }], 17 | '6xl': ['3.75rem', { lineHeight: '1' }], 18 | '7xl': ['4.5rem', { lineHeight: '1' }], 19 | '8xl': ['6rem', { lineHeight: '1' }], 20 | '9xl': ['8rem', { lineHeight: '1' }], 21 | }, 22 | typography: require('./typography'), 23 | extend: { 24 | boxShadow: { 25 | glow: '0 0 4px rgb(0 0 0 / 0.1)', 26 | }, 27 | maxWidth: { 28 | lg: '33rem', 29 | '2xl': '40rem', 30 | '3xl': '50rem', 31 | '5xl': '66rem', 32 | }, 33 | opacity: { 34 | 1: '0.01', 35 | 2.5: '0.025', 36 | 7.5: '0.075', 37 | 15: '0.15', 38 | }, 39 | }, 40 | }, 41 | plugins: [ 42 | require('@tailwindcss/typography'), 43 | require('@headlessui/tailwindcss'), 44 | ], 45 | } 46 | -------------------------------------------------------------------------------- /packages/client/js/examples/minimal.ts: -------------------------------------------------------------------------------- 1 | import { Configuration, AgentApi, TaskRequestBody, StepRequestBody } from 'agent-protocol-client'; 2 | 3 | // Defining the host is optional and defaults to http://localhost 4 | // See configuration.ts for a list of all supported configuration parameters. 5 | const configuration = new Configuration({ basePath: "http://localhost:8000" }); 6 | 7 | async function main() { 8 | // Create an instance of the API client 9 | const apiInstance = new AgentApi(configuration); 10 | // Create an instance of the API class 11 | const taskRequestBody: TaskRequestBody = { 12 | input: "Write 'Hello world!' to hi.txt." 13 | }; 14 | 15 | const response = await apiInstance.createAgentTask({ taskRequestBody }); 16 | console.log("The response of AgentApi->createAgentTask:\n"); 17 | console.log(response); 18 | console.log("\n\n"); 19 | 20 | const taskId = response.taskId; 21 | let i = 1; 22 | 23 | while (true) { 24 | const stepRequestBody: StepRequestBody = { 25 | input: String(i) 26 | }; 27 | const step = await apiInstance.executeAgentTaskStep({ taskId, stepRequestBody }); 28 | 29 | if (!step || step.isLast) { 30 | break; 31 | } 32 | 33 | console.log("The response of AgentApi->executeAgentTaskStep:\n"); 34 | console.log(step); 35 | console.log("\n\n"); 36 | i += 1; 37 | } 38 | 39 | console.log("Agent finished its work!"); 40 | } 41 | 42 | main().catch(console.error); -------------------------------------------------------------------------------- /packages/sdk/js/README.md: -------------------------------------------------------------------------------- 1 | # Agent Communication Protocol - JavaScript/TypeScript SDK 2 | 3 | This SDK implements the Agent Communication Protocol in JavaScript/TypeScript 4 | and allows you to easily wrap your agent in a webserver compatible with the 5 | protocol - you only need to define an agent task handler. 6 | 7 | ## Installation 8 | 9 | ```bash 10 | npm install agent-protocol 11 | ``` 12 | 13 | Then add the following code to your agent: 14 | 15 | ### Typescript 16 | 17 | ```typescript 18 | import Agent, { 19 | type StepHandler, 20 | type StepInput, 21 | type StepResult, 22 | type TaskInput, 23 | } from 'agent-protocol' 24 | 25 | async function taskHandler(taskInput: TaskInput | null): Promise { 26 | console.log(`task: ${taskInput}`) 27 | 28 | async function stepHandler(stepInput: StepInput | null): Promise { 29 | console.log(`step: ${stepInput}`) 30 | return { 31 | output: stepInput, 32 | } 33 | } 34 | 35 | return stepHandler 36 | } 37 | 38 | Agent.handleTask(taskHandler, {}).start() 39 | ``` 40 | 41 | See the [https://github.com/AI-Engineer-Foundation/agent-protocol/tree/main/packages/sdk/js/examples](examples folder) for running in serverless environments. 42 | 43 | ## Docs 44 | 45 | You can find more info and examples in the [docs](https://agentprotocol.ai/sdks/js). 46 | 47 | ## Contributing 48 | 49 | ```bash 50 | git clone https://github.com/AI-Engineers-Foundation/agent-protocol 51 | cd agent-protocol/packages/sdk/js 52 | npm install 53 | npm run build 54 | ``` 55 | -------------------------------------------------------------------------------- /packages/sdk/js/src/api.ts: -------------------------------------------------------------------------------- 1 | import * as OpenApiValidator from 'express-openapi-validator' 2 | import yaml from 'js-yaml' 3 | import express, { type Express, Router } from 'express' // <-- Import Router 4 | import type * as core from 'express-serve-static-core' 5 | 6 | import spec from '../../../../schemas/openapi.yml' 7 | 8 | export type ApiApp = core.Express 9 | 10 | export interface RouteContext { 11 | workspace: string 12 | } 13 | 14 | export type RouteRegisterFn = (app: Router, context: RouteContext) => void 15 | 16 | export interface ApiConfig { 17 | context: RouteContext 18 | port: number 19 | callback?: () => void 20 | routes: RouteRegisterFn[] 21 | } 22 | 23 | export const createApi = (config: ApiConfig, start = true): Express => { 24 | const app = express() 25 | 26 | app.use(express.json()) 27 | app.use(express.text()) 28 | app.use(express.urlencoded({ extended: false })) 29 | 30 | const parsedSpec = yaml.load(spec) 31 | 32 | app.use( 33 | OpenApiValidator.middleware({ 34 | apiSpec: parsedSpec as any, 35 | validateRequests: true, // (default) 36 | validateResponses: true, // false by default 37 | }) 38 | ) 39 | 40 | app.get('/openapi.yaml', (_, res) => { 41 | res.setHeader('Content-Type', 'text/yaml').status(200).send(spec) 42 | }) 43 | 44 | const router = Router() 45 | 46 | config.routes.forEach((route) => { 47 | route(router, config.context) 48 | }) 49 | 50 | app.use('/ap/v1', router) 51 | 52 | if (start) { 53 | app.listen(config.port, config.callback) 54 | } 55 | 56 | return app 57 | } 58 | -------------------------------------------------------------------------------- /rfcs/2023-08-28-list-entities-RFC.md: -------------------------------------------------------------------------------- 1 | # List tasks, artifacts and steps in a paginated way. 2 | 3 | | Feature name | Support Pagination | 4 | | :------------ | :---------------------------------------------------------------------------- | 5 | | **Author(s)** | Merwane Hamadi (merwanehamadi@gmail.com) Craig Swift (craigswift13@gmail.com) | 6 | | **RFC PR:** | | 7 | | **Updated** | 2023-08-28 | 8 | | **Obsoletes** | | 9 | 10 | ## Summary 11 | 12 | Allows to list resources. 13 | 14 | ## Motivation 15 | 16 | We can't build any app without an index. An index is a GET /tasks endpoint that list information about tasks. 17 | It's like a table. 18 | 19 | Currently to build that you need to get the list of task ids. And if you want to display 20 tasks. You will make 20 GET calls to show them. 20 | 21 | ## Agent Builders Benefit 22 | 23 | - They can allow their users to list things: Currently they get a list of ids, that's not useful. 24 | 25 | ## Design Proposal 26 | 27 | Just do what everyone does: return an array of objects that represent the resource 28 | 29 | ### Alternatives Considered 30 | 31 | - Just make 26 calls when you need to display a table of 25 tasks (1 call to get an id and then 25 calls to get the information of each task) 32 | 33 | ### Compatibility 34 | 35 | - This is not backwards compatible. 36 | -------------------------------------------------------------------------------- /packages/sdk/js/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "agent-protocol", 3 | "version": "1.0.5", 4 | "description": "API for interacting with Agent", 5 | "homepage": "https://agentprotocol.ai", 6 | "license": "MIT", 7 | "author": { 8 | "name": "aiengfoundation", 9 | "email": "aiengfoundation@gmail.com", 10 | "url": "https://aie.foundation" 11 | }, 12 | "bugs": "https://github.com/AI-Engineer-Foundation/agent-protocol/issues", 13 | "repository": { 14 | "type": "git", 15 | "url": "https://github.com/AI-Engineer-Foundation/agent-protocol/tree/main/packages/sdk/js" 16 | }, 17 | "main": "./dist/index.js", 18 | "types": "dist/index.d.ts", 19 | "scripts": { 20 | "prepublishOnly": "npm run build", 21 | "clean": "rm -rf ./dist", 22 | "build": "rm -rf ./dist && tsup" 23 | }, 24 | "private": false, 25 | "devDependencies": { 26 | "@types/express": "^4.17.17", 27 | "@types/js-yaml": "^4.0.5", 28 | "@types/node": "^20.4.1", 29 | "prettier": "^3.0.0", 30 | "tsup": "^7.1.0", 31 | "typescript": "^5.1.6" 32 | }, 33 | "files": [ 34 | "dist", 35 | "README.md", 36 | "package.json" 37 | ], 38 | "keywords": [ 39 | "agent", 40 | "communication", 41 | "protocol", 42 | "agent-protocol", 43 | "agent-api", 44 | "nodejs", 45 | "javascript", 46 | "typescript", 47 | "sdk", 48 | "api", 49 | "wrapper" 50 | ], 51 | "dependencies": { 52 | "@types/uuid": "^9.0.2", 53 | "express": "^4.18.2", 54 | "express-openapi-validator": "^5.0.4", 55 | "js-yaml": "^4.1.0", 56 | "uuid": "^9.0.0" 57 | } 58 | } -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/Layout.jsx: -------------------------------------------------------------------------------- 1 | 'use client' 2 | 3 | import Link from 'next/link' 4 | import { usePathname } from 'next/navigation' 5 | import { motion } from 'framer-motion' 6 | 7 | import { Footer } from '@/components/Footer' 8 | import { Header } from '@/components/Header' 9 | import { Logo } from '@/components/Logo' 10 | import { Navigation } from '@/components/Navigation' 11 | import { SectionProvider } from '@/components/SectionProvider' 12 | 13 | export function Layout({ children, allSections = {} }) { 14 | let pathname = usePathname() 15 | 16 | return ( 17 | 18 |
19 | 23 |
24 |
25 | 26 | 27 | 28 |
29 |
30 | 31 |
32 |
33 |
34 |
{children}
35 |
36 |
37 |
38 |
39 | ) 40 | } 41 | -------------------------------------------------------------------------------- /packages/client/python/examples/minimal.py: -------------------------------------------------------------------------------- 1 | import asyncio 2 | 3 | from agent_protocol.models import StepRequestBody 4 | from agent_protocol_client import ( 5 | Configuration, 6 | ApiClient, 7 | StepRequestBody, 8 | TaskRequestBody, 9 | AgentApi, 10 | ) 11 | 12 | # Defining the host is optional and defaults to http://localhost 13 | # See configuration.py for a list of all supported configuration parameters. 14 | configuration = Configuration(host="http://localhost:8000") 15 | 16 | 17 | async def main(): 18 | # Enter a context with an instance of the API client 19 | async with ApiClient(configuration) as api_client: 20 | # Create an instance of the API class 21 | api_instance = AgentApi(api_client) 22 | task_request_body = TaskRequestBody(input="Write 'Hello world!' to hi.txt.") 23 | 24 | response = await api_instance.create_agent_task( 25 | task_request_body=task_request_body 26 | ) 27 | print("The response of AgentApi->create_agent_task:\n") 28 | print(response) 29 | print("\n\n") 30 | 31 | task_id = response.task_id 32 | i = 1 33 | 34 | while ( 35 | step := await api_instance.execute_agent_task_step( 36 | task_id=task_id, step_request_body=StepRequestBody(input=str(i)) 37 | ) 38 | ) and step.is_last is False: 39 | print("The response of AgentApi->execute_agent_task_step:\n") 40 | print(step) 41 | print("\n\n") 42 | i += 1 43 | 44 | print("Agent finished its work!") 45 | 46 | 47 | asyncio.run(main()) 48 | -------------------------------------------------------------------------------- /packages/client/js/README.md: -------------------------------------------------------------------------------- 1 | ## agent-protocol-client@v1.0.0 2 | 3 | This generator creates TypeScript/JavaScript client that utilizes [Fetch API](https://fetch.spec.whatwg.org/). The generated Node module can be used in the following environments: 4 | 5 | Environment 6 | 7 | - Node.js 8 | - Webpack 9 | - Browserify 10 | 11 | Language level 12 | 13 | - ES5 - you must have a Promises/A+ library installed 14 | - ES6 15 | 16 | Module system 17 | 18 | - CommonJS 19 | - ES6 module system 20 | 21 | It can be used in both TypeScript and JavaScript. In TypeScript, the definition should be automatically resolved via `package.json`. ([Reference](http://www.typescriptlang.org/docs/handbook/typings-for-npm-packages.html)) 22 | 23 | ### Building 24 | 25 | To build and compile the typescript sources to javascript use: 26 | 27 | ``` 28 | npm install 29 | npm run build 30 | ``` 31 | 32 | ### Testing with the Minimal Example 33 | 34 | - First set up the minimal example agent protocol server in the JS or Python SDK repositories. 35 | - After the minimal SDK example is running, run the minimal example locally by changing the import to `..` and running `npm run build` in the package root. 36 | - Run the minimal client example using `ts-node minimal.ts` once the package is built. 37 | 38 | ### Publishing 39 | 40 | First build the package then run `npm publish` 41 | 42 | ### Consuming 43 | 44 | navigate to the folder of your consuming project and run one of the following commands. 45 | 46 | _published:_ 47 | 48 | ``` 49 | npm install agent-protocol-client@v1.0.0 --save 50 | ``` 51 | 52 | _unPublished (not recommended):_ 53 | 54 | ``` 55 | npm install PATH_TO_GENERATED_PACKAGE --save 56 | ``` 57 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/app/incentives/page.mdx: -------------------------------------------------------------------------------- 1 | export const metadata = { 2 | title: 'Why to adopt the protocol?', 3 | description: 'The incentives to adopt the protocol', 4 | } 5 | 6 | export const sections = [] 7 | 8 | # Why to adopt the protocol? 9 | 10 | Using the protocol should have many benefits for you as a developer. Here are some of the most important ones: 11 | 12 | ## Ease with which you can use the benchmarks. 13 | 14 | The protocol is adopted in [benchmarks](https://github.com/Significant-Gravitas/Auto-GPT-Benchmarks), a benchmarking tool for [Agent Evals](https://github.com/agbenchmark/agent-evals/tree/main). If your agent uses _Agent Protocol_, you can use very simply test your agent and benchmark it against other agents. This will allow you to see how your agent performs compared to others and how you can improve it. 15 | 16 | ## Other people can more easily use and integrate your agent 17 | 18 | By having the standard protocol, other people can just use their current setup to try your agent. There'll be ready to use SDKs, clients, UIs. Also, this means that you can more easily collaborate with other people, because of the expected structure. 19 | 20 | ## Enable building general devtools (for development, deployment and monitoring) that can be built on top of this protocol 21 | 22 | Similarly, this enables to create tools to develop, deploy and monitor agents without extra configuration or boilerplate. 23 | 24 | ## You don’t need to write boilerplate API and you can focus on developing your agent 25 | 26 | Building agents should be about the agent itself, not thinking about how to integrate it with other agents., how to deploy it or how to monitor it. This protocol should help you with that. 27 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/src/components/Tag.jsx: -------------------------------------------------------------------------------- 1 | import clsx from 'clsx' 2 | 3 | const variantStyles = { 4 | medium: 'rounded-lg px-1.5 ring-1 ring-inset', 5 | } 6 | 7 | const colorStyles = { 8 | violet: { 9 | small: 'text-violet-500 dark:text-violet-400', 10 | medium: 11 | 'ring-violet-300 dark:ring-violet-400/30 bg-violet-400/10 text-violet-500 dark:text-violet-400', 12 | }, 13 | sky: { 14 | small: 'text-sky-500', 15 | medium: 16 | 'ring-sky-300 bg-sky-400/10 text-sky-500 dark:ring-sky-400/30 dark:bg-sky-400/10 dark:text-sky-400', 17 | }, 18 | amber: { 19 | small: 'text-amber-500', 20 | medium: 21 | 'ring-amber-300 bg-amber-400/10 text-amber-500 dark:ring-amber-400/30 dark:bg-amber-400/10 dark:text-amber-400', 22 | }, 23 | rose: { 24 | small: 'text-red-500 dark:text-rose-500', 25 | medium: 26 | 'ring-rose-200 bg-rose-50 text-red-500 dark:ring-rose-500/20 dark:bg-rose-400/10 dark:text-rose-400', 27 | }, 28 | zinc: { 29 | small: 'text-zinc-400 dark:text-zinc-500', 30 | medium: 31 | 'ring-zinc-200 bg-zinc-50 text-zinc-500 dark:ring-zinc-500/20 dark:bg-zinc-400/10 dark:text-zinc-400', 32 | }, 33 | } 34 | 35 | const valueColorMap = { 36 | get: 'violet', 37 | post: 'sky', 38 | put: 'amber', 39 | delete: 'rose', 40 | } 41 | 42 | export function Tag({ 43 | children, 44 | variant = 'medium', 45 | color = valueColorMap[children.toLowerCase()] ?? 'violet', 46 | }) { 47 | return ( 48 | 55 | {children} 56 | 57 | ) 58 | } 59 | -------------------------------------------------------------------------------- /apps/agentprotocol.ai/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "tailwindui-protocol", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "dev": "next dev", 7 | "build": "next build", 8 | "start": "next start", 9 | "lint": "next lint", 10 | "generateEndpoints": "node scripts/generateEndpoints.mjs" 11 | }, 12 | "browserslist": "defaults, not ie <= 11", 13 | "dependencies": { 14 | "@algolia/autocomplete-core": "^1.7.3", 15 | "@headlessui/react": "^1.7.15", 16 | "@headlessui/tailwindcss": "^0.2.0", 17 | "@mdx-js/loader": "^2.1.5", 18 | "@mdx-js/react": "^2.1.5", 19 | "@next/mdx": "^13.0.3", 20 | "@sindresorhus/slugify": "^2.1.1", 21 | "@tailwindcss/typography": "^0.5.8", 22 | "@vercel/analytics": "^1.0.2", 23 | "acorn": "^8.8.1", 24 | "autoprefixer": "^10.4.7", 25 | "clsx": "^1.2.0", 26 | "fast-glob": "^3.3.0", 27 | "flexsearch": "^0.7.31", 28 | "framer-motion": "7.8.1", 29 | "mdast-util-to-string": "^3.2.0", 30 | "mdx-annotations": "^0.1.1", 31 | "next": "13.4.12", 32 | "next-themes": "^0.2.1", 33 | "react": "18.2.0", 34 | "react-dom": "18.2.0", 35 | "react-highlight-words": "^0.20.0", 36 | "remark": "^14.0.2", 37 | "remark-gfm": "^3.0.1", 38 | "remark-mdx": "^2.3.0", 39 | "shiki": "^0.11.1", 40 | "simple-functional-loader": "^1.2.1", 41 | "tailwindcss": "^3.3.3", 42 | "unist-util-filter": "^4.0.1", 43 | "unist-util-visit": "^4.1.1", 44 | "zustand": "^4.3.2" 45 | }, 46 | "devDependencies": { 47 | "@readme/openapi-parser": "^2.5.0", 48 | "eslint": "8.45.0", 49 | "eslint-config-next": "13.4.12", 50 | "js-yaml": "^4.1.0", 51 | "prettier": "^2.8.7", 52 | "prettier-plugin-tailwindcss": "^0.2.6" 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /testing_suite/local_test.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Check if a URL was provided as an environment variable 4 | if [ -z "$URL" ]; then 5 | echo "Usage: URL= bash