Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Agent.build() and return app for use in serverless environments #99

Merged
merged 5 commits into from
Apr 2, 2024

Conversation

nalbion
Copy link
Contributor

@nalbion nalbion commented Feb 10, 2024

Pull Request

Description

Small refactor to createApi() to return app and optionally not start listening. This allows the JavaScript library to be used from serverless functions in AWS, Google etc.

Checklist

Please review and check the following items to ensure your pull request can be processed smoothly:

  • [*] My code adheres to the project's coding standards and style guidelines.

  • [*] I have tested my changes thoroughly, including unit tests where applicable.

  • [*] I have updated the documentation to reflect any changes made in this pull request.

  • [*] My branch is up-to-date with the latest changes from the main branch.

  • I have received code review feedback and addressed any comments or concerns.

Copy link

vercel bot commented Feb 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
agentprotocolai ⬜️ Ignored (Inspect) Visit Preview Feb 14, 2024 7:31am

jzanecook
jzanecook previously approved these changes Apr 1, 2024
@jzanecook jzanecook dismissed their stale review April 2, 2024 17:44

Testing yielded different results

@jzanecook
Copy link
Collaborator

jzanecook commented Apr 2, 2024

Hey @nalbion I'm trying to run this and I'm running into the following error using the minimal example:

❯ ts-node minimal.ts
Agent listening at http://localhost:8000
Internal Server Error: /response must be object
    at ResponseValidator._validate (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:201:13)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:73:23
    at ServerResponse.json_hook (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/framework/modded.express.mung.ts:39:16)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/agent-protocol/src/agent.ts:100:25
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
task: d49ea465-d956-47fe-9ded-2d2753ef065d
step: Write the word 'Washington' to a .txt file
step: y
task: e650d874-7de7-4236-9c0f-20198e605ece
Internal Server Error: /response must be object
    at ResponseValidator._validate (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:201:13)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:73:23
    at ServerResponse.json_hook (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/framework/modded.express.mung.ts:39:16)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/agent-protocol/src/agent.ts:100:25
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
task: 8c7abfce-7f2f-4ee5-8fc3-d7185ecbc8db
Internal Server Error: /response must be object
    at ResponseValidator._validate (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:201:13)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/middlewares/openapi.response.validator.ts:73:23
    at ServerResponse.json_hook (/mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/express-openapi-validator/src/framework/modded.express.mung.ts:39:16)
    at /mnt/sda1/home/z/Documents/Projects/RAW/agent-protocol/packages/sdk/js/node_modules/agent-protocol/src/agent.ts:100:25
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
task: 562e4515-78e0-46de-826c-fc5568f14429

Do you think you could merge in some of the new changes to the js sdk and verify that this is an issue on your side as well?


Nevermind, I didn't use a local import for the minimal example. This is working.

@jzanecook jzanecook merged commit 4310e7f into Div99:main Apr 2, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants