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

[Work In Progress] Agent Protocol CLI #78

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions cli/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/target/
**/*.rs.bk
Cargo.lock
20 changes: 20 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "apc"
version = "1.0.0"
authors = ["AI Engineer Foundation <[email protected]>"]
description = "Agent Protocol CLI for communication with an agent."
license = "MIT"
edition = "2018"

[dependencies]
serde = "^1.0"
serde_derive = "^1.0"
serde_with = "^2.0"
serde_json = "^1.0"
url = "^2.2"
uuid = { version = "^1.0", features = ["serde", "v4"] }
clap = { version = "4.4.6", features = ["derive"] }
tokio = { version = "1.33.0", features = ["full"] }
[dependencies.reqwest]
version = "^0.11"
features = ["json", "multipart"]
41 changes: 41 additions & 0 deletions cli/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Agent Protocol CLI

## Introduction

This is a cross-platform CLI tool for the agent protocol.

## Execution

Prerequisites: make sure `cargo` and `rust` are available.

To execute the tool, run:

```rust
cargo build
cargo run -h
```

## Formatting

More about code formatting, see [rustfmt](https://github.com/rust-lang/rustfmt)

```rust
rustup toolchain install nightly
rustup component add rustfmt --toolchain nightly
cargo +nightly fmt
```

Updates: let's just use the default rust format settings by running `cargo fmt`

## The AP API

Questions:
1. How to visualize the Spec?
1. Shall we modualize the Spec?

## Generator Script

The generator script has some issue.

For instance, the `TaskRequestBody` has a field called `input` and it is optional.
However, after coversion, its type becomes `Option<Option<String>>`
15 changes: 15 additions & 0 deletions cli/generate_from_spec.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/bash

mkdir tmp
cd tmp

openapi-generator-cli generate -i ../../schemas/openapi.yml -g rust

mv ./src/apis ../src/
mv ./src/models ../src/
mv ./src/lib.rs ../src/
mv ./docs ../docs

cd ../

rm -rfv tmp
Loading