Elffuss BraidHub

kikocis/Based-Agent public

6cf46b4c5884 · 1.4 KiBRenderedRawPermalink
1# Swarm basic
2
3This folder contains basic examples demonstrating core Swarm capabilities. These examples show the simplest implementations of Swarm, with one input message, and a corresponding output. The `simple_loop_no_helpers` has a while loop to demonstrate how to create an interactive Swarm session.
4
5### Examples
6
71. **agent_handoff.py**
8
9 - Demonstrates how to transfer a conversation from one agent to another.
10 - **Usage**: Transfers Spanish-speaking users from an English agent to a Spanish agent.
11
122. **bare_minimum.py**
13
14 - A bare minimum example showing the basic setup of an agent.
15 - **Usage**: Sets up an agent that responds to a simple user message.
16
173. **context_variables.py**
18
19 - Shows how to use context variables within an agent.
20 - **Usage**: Uses context variables to greet a user by name and print account details.
21
224. **function_calling.py**
23
24 - Demonstrates how to define and call functions from an agent.
25 - **Usage**: Sets up an agent that can respond with weather information for a given location.
26
275. **simple_loop_no_helpers.py**
28 - An example of a simple interaction loop without using helper functions.
29 - **Usage**: Sets up a loop where the user can continuously interact with the agent, printing the conversation.
30
31## Running the Examples
32
33To run any of the examples, use the following command:
34
35```shell
36python3 <example_name>.py
37```