Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
harishmohanraj committed Jan 28, 2025
1 parent d7ee96d commit 5bbcd1b
Show file tree
Hide file tree
Showing 12 changed files with 55 additions and 39 deletions.
2 changes: 1 addition & 1 deletion autogen/_website/process_notebooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -1031,7 +1031,7 @@ def main() -> None:
# Post-processing steps after all notebooks are handled
if not args.dry_run:
copy_examples_mdx_files(args.website_directory)
update_navigation_with_notebooks(args.website_directory)
# update_navigation_with_notebooks(args.website_directory)
fix_internal_references_in_mdx_files(args.website_directory)
add_authors_and_social_img_to_blog_posts(args.website_directory)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
---
title: Conversable agent
---

### GitHub Codespaces

Before we jump into some code, each code block will have a button that opens it in GitHub Codespaces so you can start playing with AG2 inside a fully configured environment.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Ending a chat
---
title: Ending a chat
---

There are a number of ways a chat can end:
1. The maximum number of turns in a chat is reached
Expand Down Expand Up @@ -71,9 +73,9 @@ agent_b = ConversableAgent(
# agent_b > agent_a replies with message "... DONE!" > agent_b ends before replying
```

::note
<Note>
If the termination condition is met and the agent's `human_input_mode` is "ALWAYS" or 'TERMINATE' (ConversableAgent's default), you will be asked for input and can decide to end the chat. If it is "NEVER" it will end immediately.
::
</Note>

### 3. Number of automatic replies

Expand All @@ -96,9 +98,9 @@ agent_a.initiate_chat(agent_b, ...)
# agent_a > agent_b > agent_a with first auto reply > agent_b > agent_a with second auto reply > agent_b > agent_a ends before replying
```

::note
<Note>
If the agent's `human_input_mode` is "ALWAYS" or 'TERMINATE' (ConversableAgent's default), you will be asked for input and can decide to end the chat. If it is "NEVER" it will end immediately.
::
</Note>

### 4. Human replies with 'exit'
During the course of the conversation, if you are prompted and reply 'exit', the chat will end.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# GroupChat
---
title: GroupChat
---

`GroupChat` has four built-in conversation patterns:

Expand All @@ -14,9 +16,9 @@ Coordinating the `GroupChat` is the `GroupChatManager`, an agent that provides a

Let's enhance our lesson planner example to include a lesson reviewer and a teacher agent.

:::tip
<Tip>
You can start any multi-agent chats using the `initiate_chat` method
:::
</Tip>

--SNIPPET: groupchat.py

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Human in the loop
---
title: Human in the loop
---

If the previous ConversableAgent example you were able to chat with the agent and this is because another agent was automatically created to represent you, the human in the loop, when using an agent's `run` method.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
## Install the AG2 Package

:::tip
---
title: Installing ag2
---
<Tip>
We recommended using a virtual environment for your project to keep your packages contained. See [venv](https://docs.python.org/3/library/venv.html).
:::
</Tip>

Install AG2 on your machine:

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## LLM configurations
---
title: LLM configuration
---

Your AG2 agents are likely to need to use an LLM and you can configure one, or more, for each agent.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Orchestrating many agents
---
title: Orchestrating many agents
---

Many hands make for light work, so it's time to move on from our simple two-agent conversations and think about orchestrating workflows containing many agents, a strength of the AG2 framework.

Expand All @@ -8,8 +10,8 @@ GroupChat contains a number of built-in conversation patterns to determine the n

Swarm is a conversation pattern based on agents with handoffs. There's a shared context and each agent has tools and the ability to transfer control to other agents. The [original swarm concept](https://github.com/openai/swarm) was created by OpenAI.

:::note
<Note>
We'll refer to *[conversation patterns](https://docs.ag2.ai/docs/tutorial/conversation-patterns)* throughout the documentation - they are simply a structured way of organizing the flow between agents.
:::
</Note>

Next > groupchat.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
# Structured outputs
---
title: Structured outputs
---

Working with freefrom text from LLMs isn't optimal when you know how you want the reply formatted.

Expand Down Expand Up @@ -66,8 +68,8 @@ print(json.dumps(lesson_plan_json, indent=2))
"script": "Introduction (10 minutes):\nBegin the class by asking students what they already know about the solar system. Write their responses on the board. \n\nIntroduce the topic by explaining that today they will be learning about the solar system, which includes the Sun, planets, moons, and other celestial objects.\n\nDirect Instruction (20 minutes):\nUse a visual aid (such as a poster or video) to show the solar system's structure. \n\nDiscuss the eight planets: Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune. \n\nFor each planet, mention:\n- Its position from the Sun.\n- Key characteristics (e.g., size, color, temperature).\n- Any notable features (e.g., rings, atmosphere). \n\nInteractive Activity (15 minutes):\nSplit the class into small groups. Give each group a set of planet cards that include pictures and information. Have them work together to put the planets in order from the Sun. Each group will present their order and one interesting fact about each planet they discussed."
}
```
::tip
<Tip>
Add a `format` function to the LessonPlan class in the example to convert the returned value into a string. [Example here](https://docs.ag2.ai/notebooks/agentchat_structured_outputs#define-the-reasoning-model-2).
::
</Tip>

Next > ending-a-chat.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
## Swarm
---
title: Swarm
---

Swarms provide controllable flows between agents that are determined at the agent-level. You define hand-off, post-tool, and post-work transitions from an agent to another agent (or to end the swarm).

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# Tools
---
title: Tools
---

Agents gain significant utility through tools as they provide access to external data, APIs, and functionality.

In AG2, using tools is done in two parts, an agent *suggests* which tools to use (via their LLM) and another *executes* the tool.

::note
In a conversation the executor agent must follow the agent that suggests a tool.
::
<Note>In a conversation the executor agent must follow the agent that suggests a tool.</Note>

In the swarm example above, we attached tools to our agents and, as part of the swarm, AG2 created a tool executor agent to run recommended tools. Typically, you'll create two agents, one to decide which tool to use and another to execute it.

Expand Down
23 changes: 10 additions & 13 deletions website/mint-json-template.json.jinja
Original file line number Diff line number Diff line change
Expand Up @@ -66,18 +66,6 @@
{
"name": "Ecosystem",
"url": "ecosystem"
},
{
"name": "Examples",
"url": "notebooks"
},
{
"name": "Blog",
"url": "blog"
},
{
"name": "Community Talks",
"url": "talks"
}
],
"anchors": [],
Expand All @@ -100,7 +88,16 @@
{
"group": "Basic Concepts",
"pages": [
"user-guide/openai-assistant/gpt_assistant_agent"
"docs/user-guide/basic-concepts/installing-ag2",
"docs/user-guide/basic-concepts/llm-configuration",
"docs/user-guide/basic-concepts/conversable-agent",
"docs/user-guide/basic-concepts/human-in-the-loop",
"docs/user-guide/basic-concepts/orchestrations",
"docs/user-guide/basic-concepts/groupchat",
"docs/user-guide/basic-concepts/swarm",
"docs/user-guide/basic-concepts/tools",
"docs/user-guide/basic-concepts/structured-outputs",
"docs/user-guide/basic-concepts/ending-a-chat"
]
}
]
Expand Down

0 comments on commit 5bbcd1b

Please sign in to comment.