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.

Home Page:https://agentprotocol.ai

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

JS / TS Client library

jakubno opened this issue · comments

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

  • It should be in TypeScript
  • Add makefile with generate command generate, which will regenerate the code

Additional context

I would recommend using of the OpenAPI codegens.

Feel free to come with something else

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!

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 😆

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 👍

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

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

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

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

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.

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