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

An issue with bedrock-agent-runtime and InvokeAgent in AWS Bedrock #259

Open
akaromka opened this issue Nov 14, 2024 · 2 comments
Open

An issue with bedrock-agent-runtime and InvokeAgent in AWS Bedrock #259

akaromka opened this issue Nov 14, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@akaromka
Copy link

Dependencies

 [com.cognitect.aws/api "0.8.692"]
 [com.cognitect.aws/endpoints "1.1.12.772"]
 [com.cognitect.aws/bedrock-agent-runtime "869.2.1687.0"]

Description with failing test case

I am trying to InvokeAgent using the following code:

(def bedrock-client (aws/client {:api :bedrock-agent-runtime}))
(let [request {:agentId "QWERTY"
                 :agentAliasId "QWERTY"
                 :sessionId "123456789"
                 :inputText prompt}
        response (aws/invoke bedrock-client
                             {:op :InvokeAgent
                              :request request})]
    response)

Stack traces

{:cognitect.anomalies/category :cognitect.anomalies/fault, :cognitect.aws.client.impl/throwable #error {
 :cause No matching clause: 0
 :via
 [{:type java.lang.IllegalArgumentException
   :message No matching clause: 0
   :at [clojure.data.json$next_token invokeStatic json.clj 321]}]
 :trace
 [[clojure.data.json$next_token invokeStatic json.clj 321]
  [clojure.data.json$next_token invoke json.clj 317]
  [clojure.data.json$_read invokeStatic json.clj 406]
  [clojure.data.json$_read invoke json.clj 404]
  [clojure.data.json$_read1 invokeStatic json.clj 453]
  [clojure.data.json$_read1 invoke json.clj 451]
  [clojure.data.json$read_str invokeStatic json.clj 547]
  [clojure.data.json$read_str doInvoke json.clj 539]
  [clojure.lang.RestFn invoke RestFn.java 442]
  [cognitect.aws.shape$json_parse invokeStatic shape.clj 152]
  [cognitect.aws.shape$json_parse invoke shape.clj 149]
  [cognitect.aws.protocols.rest$parse_body invokeStatic rest.clj 252]
  [cognitect.aws.protocols.rest$parse_body invoke rest.clj 244]
  [cognitect.aws.protocols.rest$parse_http_response invokeStatic rest.clj 265]
  [cognitect.aws.protocols.rest$parse_http_response invoke rest.clj 258]
  [cognitect.aws.protocols.rest_json$eval22166$fn__22167 invoke rest_json.clj 41]
  [clojure.lang.MultiFn invoke MultiFn.java 239]
  [cognitect.aws.client.impl$handle_http_response invokeStatic impl.clj 30]
  [cognitect.aws.client.impl$handle_http_response invoke impl.clj 24]
  [cognitect.aws.client.impl$send_request$fn__21527$state_machine__10049__auto____21556$fn__21559 invoke impl.clj 87]
  [cognitect.aws.client.impl$send_request$fn__21527$state_machine__10049__auto____21556 invoke impl.clj 83]
  [clojure.core.async.impl.ioc_macros$run_state_machine invokeStatic ioc_macros.clj 972]
  [clojure.core.async.impl.ioc_macros$run_state_machine invoke ioc_macros.clj 971]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invokeStatic ioc_macros.clj 976]
  [clojure.core.async.impl.ioc_macros$run_state_machine_wrapped invoke ioc_macros.clj 974]
  [clojure.core.async.impl.ioc_macros$take_BANG_$fn__10067 invoke ioc_macros.clj 985]
  [clojure.core.async.impl.channels.ManyToManyChannel$fn__4790$fn__4791 invoke channels.clj 100]
  [clojure.lang.AFn run AFn.java 22]
  [java.util.concurrent.ThreadPoolExecutor runWorker ThreadPoolExecutor.java 1144]
  [java.util.concurrent.ThreadPoolExecutor$Worker run ThreadPoolExecutor.java 642]
  [clojure.core.async.impl.concurrent$counted_thread_factory$reify__4659$fn__4660 invoke concurrent.clj 29]
  [clojure.lang.AFn run AFn.java 22]
  [java.lang.Thread run Thread.java 1570]]}}
@scottbale
Copy link
Collaborator

scottbale commented Dec 17, 2024

Thanks for logging this. I think this should be resolved with the latest version (871.2.29.35, just released) of the bedrock and endpoints artifacts. I'll leave this issue open for the time being just in case. My teammate has managed to reproduce this issue even with the newest bedrock artifact 871.2.29.35. We are investigating...

@marcobiscaro2112
Copy link
Collaborator

The InvokeAgent operation is a streaming operation (that yields a response with content type application/vnd.amazon.eventstream), and aws-api doesn't support streaming operations (we don't know how to decode an Amazon Event stream payload).

@scottbale scottbale added the enhancement New feature or request label Dec 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants