-
Notifications
You must be signed in to change notification settings - Fork 353
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multi-agent application documentation (#541)
Co-authored-by: Sydney Runkle <[email protected]> Co-authored-by: David Montague <[email protected]>
- Loading branch information
1 parent
6ee9d15
commit 4537c07
Showing
15 changed files
with
945 additions
and
192 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# `pydantic_ai.usage` | ||
|
||
::: pydantic_ai.usage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
Example of a multi-agent flow where one agent delegates work to another, then hands off control to a third agent. | ||
|
||
Demonstrates: | ||
|
||
* [agent delegation](../multi-agent-applications.md#agent-delegation) | ||
* [programmatic agent hand-off](../multi-agent-applications.md#programmatic-agent-hand-off) | ||
* [usage limits](../agents.md#usage-limits) | ||
|
||
In this scenario, a group of agents work together to find the best flight for a user. | ||
|
||
The control flow for this example can be summarised as follows: | ||
|
||
```mermaid | ||
graph TD | ||
START --> search_agent("search agent") | ||
search_agent --> extraction_agent("extraction agent") | ||
extraction_agent --> search_agent | ||
search_agent --> human_confirm("human confirm") | ||
human_confirm --> search_agent | ||
search_agent --> FAILED | ||
human_confirm --> find_seat_function("find seat function") | ||
find_seat_function --> human_seat_choice("human seat choice") | ||
human_seat_choice --> find_seat_agent("find seat agent") | ||
find_seat_agent --> find_seat_function | ||
find_seat_function --> buy_flights("buy flights") | ||
buy_flights --> SUCCESS | ||
``` | ||
|
||
## Running the Example | ||
|
||
With [dependencies installed and environment variables set](./index.md#usage), run: | ||
|
||
```bash | ||
python/uv-run -m pydantic_ai_examples.flight_booking | ||
``` | ||
|
||
## Example Code | ||
|
||
```python {title="flight_booking.py"} | ||
#! examples/pydantic_ai_examples/flight_booking.py | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,3 +55,7 @@ img.index-header { | |
min-height: 120px; | ||
margin-bottom: 10px; | ||
} | ||
|
||
.mermaid { | ||
text-align: center; | ||
} |
Oops, something went wrong.