Skip to content

Commit

Permalink
update doc about bedrock flow agent & direct call for classifier
Browse files Browse the repository at this point in the history
  • Loading branch information
cornelcroi committed Dec 2, 2024
1 parent 801a391 commit 7e766c4
Show file tree
Hide file tree
Showing 3 changed files with 132 additions and 23 deletions.
45 changes: 45 additions & 0 deletions docs/src/content/docs/agents/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -180,4 +180,49 @@ When creating a new agent, you can specify various options using the `AgentOptio
</TabItem>
</Tabs>

### Direct Agent Usage

When you have a single agent use case, you can bypass the orchestrator and call the agent directly. This approach leverages the power of the Multi Agent Orchestrator framework while focusing on a single agent scenario:

<Tabs syncKey="runtime">
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
```typescript
// Initialize the agent
const agent = new CustomAgent({
name: "custom-agent",
description: "Handles specific tasks"
});

// Call the agent directly
const response = await agent.agentProcessRequest(
userInput,
userId,
sessionId,
chatHistory,
{ param1: "value1" }
);
```
</TabItem>
<TabItem label="Python" icon="seti:python">
```python
# Initialize the agent
agent = CustomAgent(
name="custom-agent",
description="Handles specific tasks"
)

# Call the agent directly
response = await agent.agent_process_request(
input_text=user_input,
user_id=user_id,
session_id=session_id,
chat_history=chat_history,
additional_params={"param1": "value1"}
)
```
</TabItem>
</Tabs>

This approach is useful for single agent scenarios where you don't need orchestration but want to leverage the powerful capabilities of the Multi Agent Orchestrator framework.

These options allow you to customize various aspects of the agent's behavior and configuration.
44 changes: 44 additions & 0 deletions docs/src/content/docs/classifiers/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,50 @@ When deciding between different classifiers, consider:

By thoroughly testing and debugging your chosen Classifier, you can ensure accurate intent classification and efficient query routing in your Multi-Agent Orchestrator.

## Direct Classifier Access

### With Context Management
Test the classifier with full conversation history handling:

<Tabs syncKey="runtime">
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
```typescript
const response = await orchestrator.classifyRequest(userInput, userId, sessionId);
```
</TabItem>
<TabItem label="Python" icon="seti:python">
```python
response = await orchestrator.classify_request(user_input, user_id, session_id)
```
</TabItem>
</Tabs>

This method:
- Retrieves conversation history automatically
- Maintains context across test calls
- Ideal for end-to-end testing

### Without Context
Test raw classification without conversation history:

<Tabs syncKey="runtime">
<TabItem label="TypeScript" icon="seti:typescript" color="blue">
```typescript
const response = await orchestrator.classifier.classify(userInput, []);
```
</TabItem>
<TabItem label="Python" icon="seti:python">
```python
response = await orchestrator.classifier.classify(user_input, [])
```
</TabItem>
</Tabs>

Best for:
- Prompt tuning
- Single-input validation
- Classification unit tests

---

For more detailed information on each classifier, refer to the [BedrockClassifier](/multi-agent-orchestrator/classifiers/built-in/bedrock-classifier) and [AnthropicClassifier](/classifiers/built-in/anthropic-classifier) documentation pages.
66 changes: 43 additions & 23 deletions examples/bedrock-flows/readme.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,50 @@
## BedrockFlowsAgent example
This example, in Python and Typescript, show how to integrate your Bedrock Flows into the multi-agent orchestrator.

This is the flow we used for our testing.

### tech-agent-flow

In this flow we connected an input node to a prompt node and the output of the prompt is connected to an output node.


![tech-agent-flow](./tech-agent-flow.png)


The prompt node has 2 inputs:
# BedrockFlowsAgent Example

This example demonstrates how to use the **[BedrockFlowsAgent](https://awslabs.github.io/multi-agent-orchestrator/agents/built-in/bedrock-flows-agent/)** for direct agent invocation, avoiding the multi-agent orchestration when you only need a single specialized agent.

## Direct Agent Usage
Call your agent directly using:

Python:
```python
response = await orchestrator.agent_process_request(
user_input,
user_id,
session_id,
classifier_result
)
```

TypeScript:
```typescript
const response = await orchestrator.agentProcessRequest(
userInput,
userId,
sessionId,
classifierResult
)
```

This approach leverages the BedrockFlowsAgent's capabilities:
- Conversation history management
- Bedrock Flow integration
- Custom input/output encoding

### Tech Agent Flow Configuration
The example flow connects:
- Input node → Prompt node → Output node

The prompt node accepts:
- question (current question)
- history (previous conversation)

![tech-agent-flow](./tech-agent-flow.png)
![prompt-node-configuration](./prompt-config.png)

📝 **Note**
📅 As of December 2, 2024, Bedrock Flows does not include built-in memory management.

📝 Note

📅 As of December 2, 2024, Bedrock Flows does not include a memory feature to retain previous interactions.

In this example, we demonstrate:
- 1️⃣ How to integrate your flow into a multi-agent orchestrator.
- 2️⃣ How to incorporate conversation history into your flow to provide a smoother user experience and generate more accurate results.

🚀 Let's get started!
See the code samples above for complete implementation details.

---
*Note: For multi-agent scenarios, add your agents to the orchestrator and use `orchestrator.route_request` (Python) or `orchestrator.routeRequest` (TypeScript) to enable classifier-based routing.*

0 comments on commit 7e766c4

Please sign in to comment.