Skip to content

Commit

Permalink
Update docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
LeoLjl committed Nov 20, 2024
1 parent 582a6cb commit daeb0c5
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
1 change: 1 addition & 0 deletions website/blog/2024-11-15-CaptainAgent/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ authors:
- jialeliu
- LinxinS97
- jieyuz2
- skzhang1
tags: [LLM, GPT, AutoBuild]
---
![Illustration of how CaptainAgent build a team](img/overall.png)
Expand Down
15 changes: 14 additions & 1 deletion website/docs/topics/captainagent/agent_library.mdx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Agent Library
## Library Structure
A simple agent in agent library requires three fields:
- description: This describes the functionality of the agent.
- system_message: This provides the system message of the agent for initialization.
- name: The name of the agent.
- model (optional): The backbone model of the agent.
- tags (optional): The tag of the backbone model to use.

An example of the agent library is as follows.
```
Expand All @@ -16,7 +19,7 @@ An example of the agent library is as follows.
We provide a predefined agent library in `notebook/captainagent_expert_library.json`.

## Adding advanced agents
We also support adding agents with advanced capability to the library, aside from agents with different system message. Just need to add a `model_path` field and any other arguments that needs to pass while initialization. For example, to add a WebSurferAgent:
We also support adding agents with advanced capability to the library, aside from agents with customized system message. Just need to add a `agent_path` field and any other arguments that needs to pass while initialization. For example, to add a WebSurferAgent:

```
[
Expand All @@ -37,3 +40,13 @@ We also support adding agents with advanced capability to the library, aside fro
}
]
```

Under the hood, the code will import the module according to the `agent_path`. The core code that implements this feature is:
```
module_path, model_class_name = agent_path.replace("/", ".").rsplit(".", 1)
module = importlib.import_module(module_path)
model_class = getattr(module, model_class_name)
agent = model_class(**kwargs)
```

Make sure the correct path is provided to the config according to the code.

0 comments on commit daeb0c5

Please sign in to comment.