AI-Engineer-Foundation / agent-protocol

Common interface for interacting with AI agents. The protocol is tech stack agnostic - you can use it with any framework for building agents.
https://agentprotocol.ai
MIT License
932 stars 114 forks source link

JS / TS Client library #43

Open jakubno opened 1 year ago

jakubno commented 1 year ago

Is your feature request related to a problem? Please describe.

We want to generate as much of the code as possible from the OpenAPI. This will help us to stay up to date with the protocol and in the same time it improves development speed and limits possible bugs in implementation.

Describe the solution you'd like

Additional context

I would recommend using of the OpenAPI codegens.

Feel free to come with something else

alchaplinsky commented 11 months ago

Hey @jakubno, I've been playing with making calls to agent-protocol in TypeScript and hacked together a simple client for it. It is pretty basic and it has no error handling, but I can work on improving it if that's something you'd be interested in adding to the repo. Let me know, I'd like to contribute! Cheers!

jzanecook commented 11 months ago

Wow @alchaplinsky that looks awesome! I'd love to make a new repo for it and transition it over, although I do have some concerns. Mainly in that it doesn't look like it uses the Open API generator for the spec (which means you wrote it all manually right?)

I did the same thing with the TS SDK early on :laughing:

If you want to keep improving it and base it on the openapi.yml spec, I'd be happy to bring it into the fold :+1:

alchaplinsky commented 11 months ago

@jzanecook Yeah, it's not generated, it's something that I put together while playing with SDK. I'll look closer into openapi.yml spec, definitely better to have based on certain standards. I'd love to keep improving and evolving it and hopefully contribute to other repos as well!

jzanecook commented 11 months ago

@alchaplinsky That sounds great! Are you also on our Discord by any chance? Feel free to ask questions in there as well.

Honestly, if you can get it to generate based on the spec and it's working then I'd love to get it into its own repository and we can improve it from there.

alchaplinsky commented 11 months ago

@jzanecook Yes, I am on AIEF Discord. Sounds good, I'll work on it and will let you know when it's ready!

wilsonianb commented 8 months ago

It looks like the python client was generated using @openapitools/openapi-generator-cli

The OpenAPI Generator is a Java project. openapi-generator-cli will download the appropriate JAR file and invoke the java executable to run the OpenAPI Generator. You must have the java binary executable available on your PATH for this to work.

I'm not crazy about needing Java. Would it be ok to instead require devs to have docker (just for client generation)? https://www.npmjs.com/package/@openapitools/openapi-generator-cli#use-docker-instead-of-running-java-locally

There's also openapi-type-codegen ("we do not want to use JAVA codegen in our builds"😅), but then we're using different tooling for the python and js clients...

wilsonianb commented 8 months ago

I'm also wondering if there should be a single script (in the root package.json?) to regenerate all clients and sdks based on the current OpenAPI specs. You could then have husky and/or a GitHub Actions workflow validate that everything's up to date.

wilsonianb commented 8 months ago

~OpenAI~ Microsoft is also here to help https://github.com/microsoft/kiota