Lesson 3 of 5 Building Agents and Tool Integrations

Configuring Agents with Amazon Bedrock Agents

This lesson covers how Amazon Bedrock Agents, a fully managed capability, builds agents by configuration, instructions, a model, action groups and knowledge bases, with Bedrock running the orchestration loop.

Learning outcomes

After completing this lesson, you will be able to:

  • Configure instructions, action groups and knowledge bases.
  • Deploy agents with versions and aliases.
  • Use traces, advanced prompts and multi-agent collaboration.
  • Use return of control for actions that need the user's own credentials.

Instructions, action groups and knowledge bases

An agent has instructions that describe its role and task, a model used for orchestration, and capabilities. Action groups define the actions the agent can take, described either with an OpenAPI schema or with function details (name, description and parameters). Each action group has an executor: a Lambda function that receives the action and parameters and returns a result, or return of control, in which the agent returns the action and parameters to the calling application to execute, for example when the action must run with the user's own credentials or in an on-premises system.

Knowledge bases associated with the agent are queried when the model decides they are relevant. Built-in action groups add user input (the agent can ask the user for missing information) and code interpretation (the agent writes and runs code in a sandbox). A guardrail can be attached, and memory keeps session summaries across sessions.

The following diagram shows the return of control sequence.

Return of control in Amazon Bedrock Agents. The agent chooses the action, but instead of a Lambda executor it returns the action and parameters to the desktop application, which performs the update in the on-premises system with the user's own session and sends the result back in the next InvokeAgent call.
No Lambda executor is involved in this action group.
Match the pairs

Bedrock Agents building blocks

Exam skills 2.1.1 · 2.1.6

Match each Amazon Bedrock Agents capability with what it provides.

Log in to try this activity Interactive activities are free with an account.

Versions, aliases and invocation

An agent is edited as a working draft and tested in the console. Creating a version takes an immutable snapshot, and an alias points to a version. Applications call InvokeAgent with the agent ID, alias ID, a session ID and the user's input, and receive the response as a stream. Session attributes pass context such as the user's ID to the action group Lambda functions. Releasing a new version and rolling back are done by updating the alias. Inline agents (InvokeInlineAgent) define the configuration at invocation time, which suits applications that assemble tools dynamically.

resp = agent_rt.invoke_agent(
    agentId="AGENT12345", agentAliasId="PRODALIAS1", sessionId=session_id,
    inputText="Cancel my order 1182 and tell me when the refund arrives.",
    sessionState={"sessionAttributes": {"customerId": customer_id}},
    enableTrace=True,
)
for event in resp["completion"]:
    if "chunk" in event:
        print(event["chunk"]["bytes"].decode())
    elif "trace" in event:
        log_trace(event["trace"])   # rationale, invocation input, observation, guardrail actions

Traces, advanced prompts and multi-agent collaboration

With tracing enabled, the response stream includes trace events for each step: pre-processing, orchestration with the model's rationale, the action group or knowledge base invocation, the observation and post-processing, plus guardrail interventions. Traces are essential for debugging and for transparency. Advanced prompts let developers override the default prompt templates for each step.

Multi-agent collaboration lets a supervisor agent coordinate collaborator agents, each specialised with its own action groups and knowledge bases, either by planning and delegating or by routing each request to the right collaborator. The following table summarises the building blocks.

Building blockPurpose
Instructions and modelDefine the agent's role and reasoning model
Action group (OpenAPI or function details)Actions with a Lambda executor or return of control
Knowledge baseRetrieval when relevant
User input / code interpretationAsk the user; run code in a sandbox
Version and aliasImmutable releases and rollback
TraceStep-by-step rationale and observations
Supervisor and collaboratorsMulti-agent collaboration
Scenario questions

Debugging and extending Bedrock agents

Exam skills 2.1.1 · 2.5.6

Practise using traces and collaboration in Amazon Bedrock Agents.

Log in to try this activity Interactive activities are free with an account.
Worked example

Actions with the user's credentials

An agent must update records in an on-premises system that only the user's desktop application can reach, using the user's own session.

A Lambda executor in AWS cannot reach the system or act as the user. Configuring the action group with return of control makes InvokeAgent return the chosen action and parameters to the application, which performs the update locally and sends the result back in the next InvokeAgent call.

Check yourself

Which setting shows an agent's rationale, actions and observations?

Show answer

enableTrace on InvokeAgent.

Exam Tips

Remember for the exam

  • Action groups: OpenAPI schema or function details; Lambda executor or return of control.
  • Release with versions and aliases; roll back by moving the alias.
  • enableTrace shows rationale, actions, observations and guardrail actions.
  • Supervisor and collaborator agents for multi-agent collaboration.