invoke_harness
async
¶
invoke_harness(
harness_arn: HarnessArn,
runtime_session_id: SessionId,
messages: HarnessMessages,
*,
config_overrides: Optional[AsyncBedrockAgentCoreClientConfig] = None,
qualifier: Optional[HarnessEndpointName] = None,
runtime_user_id: Optional[str] = None,
trace_parent: Optional[str] = None,
trace_state: Optional[str] = None,
trace_id: Optional[str] = None,
baggage: Optional[str] = None,
model: Optional[HarnessModelConfiguration] = None,
system_prompt: Optional[HarnessSystemPrompt] = None,
tools: Optional[HarnessTools] = None,
skills: Optional[HarnessSkills] = None,
allowed_tools: Optional[HarnessAllowedTools] = None,
max_iterations: Optional[int] = None,
max_tokens: Optional[int] = None,
timeout_seconds: Optional[int] = None,
actor_id: Optional[str] = None,
) -> AsyncGenerator[InvokeHarnessResponse]
Operation to invoke a Harness.
Parameters:
-
harness_arn(HarnessArn) –The ARN of the harness to invoke.
-
qualifier(Optional[HarnessEndpointName], default:None) –The endpoint name to invoke. If omitted, the DEFAULT endpoint is used.
-
runtime_session_id(SessionId) –The session ID for the invocation. Use the same session ID across requests to continue a conversation.
-
runtime_user_id(Optional[str], default:None) –An identifier for the end user making the request. This value is passed through to the runtime container.
-
trace_parent(Optional[str], default:None) –W3C trace context parent header containing version, trace ID, parent span ID, and trace flags.
-
trace_state(Optional[str], default:None) –W3C trace context state header for vendor-specific trace information.
-
trace_id(Optional[str], default:None) –Trace ID for maintaining observability through the operation.
-
baggage(Optional[str], default:None) –W3C Baggage header for user-defined context propagation. Format: key1=value1,key2=value2
-
messages(HarnessMessages) –The messages to send to the agent.
-
model(Optional[HarnessModelConfiguration], default:None) –The model configuration to use for this invocation. If specified, overrides the harness default.
-
system_prompt(Optional[HarnessSystemPrompt], default:None) –The system prompt to use for this invocation. If specified, overrides the harness default.
-
tools(Optional[HarnessTools], default:None) –The tools available to the agent for this invocation. If specified, overrides the harness default.
-
skills(Optional[HarnessSkills], default:None) –The skills available to the agent for this invocation. If specified, overrides the harness default.
-
allowed_tools(Optional[HarnessAllowedTools], default:None) –The tools that the agent is allowed to use for this invocation. If specified, overrides the harness default.
-
max_iterations(Optional[int], default:None) –The maximum number of iterations the agent loop can execute. If specified, overrides the harness default.
-
max_tokens(Optional[int], default:None) –The maximum number of tokens the agent can generate per iteration. If specified, overrides the harness default.
-
timeout_seconds(Optional[int], default:None) –The maximum duration in seconds for the agent loop execution. If specified, overrides the harness default.
-
actor_id(Optional[str], default:None) –The actor ID for memory operations. Overrides the actor ID configured on the harness.
Raises:
-
AccessDeniedException–The exception that occurs when you do not have sufficient permissions to perform an action. Verify that your IAM policy includes the necessary permissions for the operation you are trying to perform.
-
InternalServerException–The exception that occurs when the service encounters an unexpected internal error. This is a temporary condition that will resolve itself with retries. We recommend implementing exponential backoff retry logic in your application.
-
ResourceNotFoundException–The exception that occurs when the specified resource does not exist. This can happen when using an invalid identifier or when trying to access a resource that has been deleted.
-
RuntimeClientError–The exception that occurs when there is an error in the runtime client. This can happen due to network issues, invalid configuration, or other client-side problems. Check the error message for specific details about the error.
-
ServiceQuotaExceededException–The exception that occurs when the request would cause a service quota to be exceeded. Review your service quotas and either reduce your request rate or request a quota increase.
-
ThrottlingException–The exception that occurs when the request was denied due to request throttling. This happens when you exceed the allowed request rate for an operation. Reduce the frequency of requests or implement exponential backoff retry logic in your application.
-
ValidationException–The exception that occurs when the input fails to satisfy the constraints specified by the service. Check the error message for details about which input parameter is invalid and correct your request.
-
UnknownServiceError–The service returned an error code this client does not model.
Source code in docs_src/capo_bedrock_agentcore/_services/async_bedrock_agent_core.py
1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 | |