Skip to content

Commit

Permalink
Merge pull request #47 from merwanehamadi/move-openapi-schema
Browse files Browse the repository at this point in the history
Move openapi schema
  • Loading branch information
waynehamadi committed Aug 28, 2023
2 parents c2cbb36 + 4f172b6 commit f14350a
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/update-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Regenerate Endpoints docs on change
on:
push:
paths:
- 'openapi.yml'
- 'schemas/openapi.yml'

permissions:
contents: write
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,15 @@ follow the [RFC template](./rfcs/template.md).

## ⚙️ Components

### [Protocol](./openapi.yml)
### [Protocol](./schemas/openapi.yml)

The most important part. It specifies which endpoints should the agent expose.
The protocol is defined in [OpenAPI specification](./openapi.yml).
The protocol is defined in [OpenAPI specification](./schemas/openapi.yml).

#### How does the protocol work?

Right now the protocol is defined as a REST API (via the
[OpenAPI spec](./openapi.yml)) with two essential routes for interaction with
[OpenAPI spec](./schemas/openapi.yml)) with two essential routes for interaction with
your agent:

- `POST /agent/tasks` for creating a new task for the agent (for example giving
Expand Down
2 changes: 1 addition & 1 deletion client/python/scripts/generate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ then
fi
fi

npx @openapitools/openapi-generator-cli generate --global-property apis,models,supportingFiles,modelDocs=false -i ./../../openapi.yml -g python-nextgen --library asyncio --additional-properties=generateSourceCodeOnly=true,packageName=agent_protocol_client
npx @openapitools/openapi-generator-cli generate --global-property apis,models,supportingFiles,modelDocs=false -i ./../../schemas/openapi.yml -g python-nextgen --library asyncio --additional-properties=generateSourceCodeOnly=true,packageName=agent_protocol_client
black .
2 changes: 1 addition & 1 deletion docs/scripts/generateEndpoints.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import OpenApi from '@readme/openapi-parser'
import yaml from 'js-yaml'
import fs from 'fs'

let doc = yaml.load(fs.readFileSync('../openapi.yml'))
let doc = yaml.load(fs.readFileSync('../schemas/openapi.yml'))

let endpoints = ''
let $refs = await OpenApi.resolve(doc)
Expand Down
48 changes: 24 additions & 24 deletions docs/src/app/endpoints/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export const metadata = {

# Endpoints

The agent exposes the following endpoints (see the [OpenAPI file](https://github.com/e2b-dev/agent-protocol/blob/main/openapi.yml)):
The agent exposes the following endpoints (see the [OpenAPI file](https://github.com/e2b-dev/agent-protocol/blob/main/schemas/openapi.yml)):

## Create Agent Task {{ tag: 'POST', label: '/agent/tasks' }}

Expand All @@ -17,17 +17,17 @@ The agent exposes the following endpoints (see the [OpenAPI file](https://github
### Body attributes

<Properties>

<Property name="input" type="string" required="undefined">
Input prompt for the task.
</Property>
<Property name="additional_input" type="any" required="undefined">
Input parameters for the task. Any value is allowed.
</Property>
</Properties>

### Response

A new agent task was successfully created.

</Col>
Expand All @@ -53,15 +53,15 @@ curl --request POST http://localhost:8000/agent/tasks
### Path attributes

<Properties>

<Property name="task_id" type="string">
ID of the task
</Property>
</Properties>


### Response

Returned details about an agent task.

</Col>
Expand Down Expand Up @@ -120,25 +120,25 @@ curl http://localhost:8000/agent/tasks/[task_id]/steps
### Path attributes
<Properties>
<Property name="task_id" type="string">
ID of the task
</Property>
</Properties>
### Body attributes
<Properties>
<Property name="input" type="string" required="undefined">
Input prompt for the step.
</Property>
<Property name="additional_input" type="any" required="undefined">
Input parameters for the task step. Any value is allowed.
</Property>
</Properties>
### Response
Executed step for the agent task.
</Col>
Expand All @@ -164,18 +164,18 @@ curl --request POST http://localhost:8000/agent/tasks/[task_id]/steps
### Path attributes
<Properties>
<Property name="task_id" type="string">
ID of the task
</Property>
<Property name="step_id" type="string">
ID of the step
</Property>
</Properties>
### Response
Returned details about an agent task step.
</Col>
Expand Down Expand Up @@ -234,25 +234,25 @@ curl http://localhost:8000/agent/tasks/[task_id]/artifacts
### Path attributes
<Properties>
<Property name="task_id" type="string">
ID of the task
</Property>
</Properties>
### Body attributes
<Properties>
<Property name="file" type="string" required="true">
File to upload.
</Property>
<Property name="relative_path" type="string" required="false">
Relative path of the artifact in the agent's workspace.
</Property>
</Properties>

### Response

Returned the content of the artifact.

</Col>
Expand All @@ -278,18 +278,18 @@ curl --request POST http://localhost:8000/agent/tasks/[task_id]/artifacts
### Path attributes

<Properties>

<Property name="task_id" type="string">
ID of the task
</Property>
<Property name="artifact_id" type="string">
ID of the artifact
</Property>
</Properties>


### Response

Returned the content of the artifact.

</Col>
Expand Down
2 changes: 1 addition & 1 deletion docs/src/app/endpoints/page.template.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ export const metadata = {

# Endpoints

The agent exposes the following endpoints (see the [OpenAPI file](https://github.com/e2b-dev/agent-protocol/blob/main/openapi.yml)):
The agent exposes the following endpoints (see the [OpenAPI file](https://github.com/e2b-dev/agent-protocol/blob/main/schemas/openapi.yml)):
2 changes: 1 addition & 1 deletion docs/src/app/sdks/custom/page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Maybe there isn't an SDK for your programming language, maybe you need something

## Generating models

To reduce the amount of writing boilerplate, you can generate the models from the [OpenAPI specification](https://github.com/e2b-dev/agent-protocol/blob/main/openapi.yml) using some of the tools available [here](https://openapi.tools/).
To reduce the amount of writing boilerplate, you can generate the models from the [OpenAPI specification](https://github.com/e2b-dev/agent-protocol/blob/main/schemas/openapi.yml) using some of the tools available [here](https://openapi.tools/).

## Test your implementation

Expand Down
2 changes: 1 addition & 1 deletion rfcs/AP-RFC-1.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,4 +78,4 @@ If the resource is not found, the agent should return `404` status code.

## Detailed Design (Optional)

You can find the full spec in the [API spec](./../openapi.yml).
You can find the full spec in the [API spec](./../schemas/openapi.yml).
File renamed without changes.
2 changes: 1 addition & 1 deletion sdk/js/src/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
type TaskRequestBody,
} from './models'

import spec from '../../../openapi.yml'
import spec from '../../../schemas/openapi.yml'

const app = express()

Expand Down
4 changes: 2 additions & 2 deletions sdk/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
generate:
poetry run fastapi-codegen \
--generate-routers \
--input ../../openapi.yml \
--input ../../schemas/openapi.yml \
--output agent_protocol
mv agent_protocol/main.py agent_protocol/server.py
rm -rf agent_protocol/routers
rm agent_protocol/dependencies.py
black .
black .

0 comments on commit f14350a

Please sign in to comment.