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 |
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