Salta al contenuto

Bedrock agent invokation does not return "returnControl" element

0

All, in my Python call i am trying to invoke my agent. Agent is instructed to call a specific function for certain condition. Call Is: agent = BedrockAgent(agentAliasId='...',agentId='...') response = agent.invokeWithFunction( enableTrace=True, endSession=False, prompt='provede...', ) in a console agent asks for specific function information. in Python, trace is also indicates that function should be invilved. The problem is that is i do not see returnControl element in response. Agent and Agent alias are verified and action is "return control" in a console definition. Any help would be appreciated Thank you Yevgeniy

posta 2 anni fa1K visualizzazioni
3 Risposte
1
Risposta accettata

That was a bug in boto3. Latest version - 1.34.111 - works

con risposta 2 anni fa
ESPERTO
verificato 2 anni fa
0

Hello.

If you execute invoke_agent() as is, the response will include "returnControl".
Have you tried running invoke_agent()?
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/bedrock-agent-runtime/client/invoke_agent.html

ESPERTO
con risposta 2 anni fa
0

yes, and it does not return "returnControl".

class BedrockAgent: def init(self, agentId = "..", agentAliasId= "", name = "bedrock-agent-runtime", verify = False): self.agentId = agentId self.agentAliasId = agentAliasId self.client = boto3.client(name, verify=verify)

def invokeWithFunction(self, prompt, enableTrace=False, endSession=True, sessionId=str(uuid.uuid4())): response = self.client.invoke_agent( agentAliasId= self.agentAliasId, agentId=self.agentId, enableTrace=enableTrace, endSession=endSession, inputText=prompt, sessionId=sessionId) return response


agent = BedrockAgent(agentAliasId='...',agentId='...') response = agent.invokeWithFunction( enableTrace=True, endSession=False, prompt='please find ...', ) completion = response.get("completion") if completion: for event in completion: print("----------- Event -----------------") print(event)

Thank you, YK

con risposta 2 anni fa

Accesso non effettuato. Accedi per postare una risposta.

Una buona risposta soddisfa chiaramente la domanda, fornisce un feedback costruttivo e incoraggia la crescita professionale del richiedente.