Skip to content

Commit

Permalink
Updated docs for new features
Browse files Browse the repository at this point in the history
  • Loading branch information
VRSEN committed Apr 8, 2024
1 parent dcc658b commit 1e05862
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
20 changes: 12 additions & 8 deletions docs/advanced-usage/agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,13 @@ class AgentName(Agent):
schemas_folder="./schemas",
tools_folder="./tools"
)

def response_validator(self, message: str) -> str:
"""This function is used to validate the response before sending it to the user or another agent."""
if "bad word" in message:
return "Please don't use bad words."

return message
```

To initialize the agent, you can simply import the agent and instantiate it:
Expand All @@ -87,13 +94,10 @@ agent = AgentName()

### Importing existing agents

For the most complex and requested use cases, we will be creating premade agents that you can import and reuse in your own projects.
For the most complex and requested use cases, we will be creating premade agents that you can import and reuse in your own projects. To import an existing agent, you can run the following CLI command:

!!! warning "Will be deprecated in future versions."
We are planning to deprecate agent imports in future versions, as this takes away the flexibility of the framework. Instead, we are planning to add a functionality to download agent source files locally from github, which will allow you to modify the inner logic and tools as you see fit.
```bash
agency-swarm import-agent --name "AgentName" --destination "/path/to/directory"
```

```py
from agency_swarm.agents.browsing import BrowsingAgent
browsing_agent = BrowsingAgent()
browsing_agent.instructions += "\n\nYou can add additional instructions here."
```
This will copy all your agent source files locally. You can then import the agent as shown above. To check available agents, simply run this command without any arguments.
10 changes: 10 additions & 0 deletions docs/advanced-usage/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,13 @@ tools = ToolFactory.from_openapi_schema(
else:
return "Success. The action has been taken."
```
4. Consider `one_call_at_a_time` class attribute to prevent multiple instances of the same tool from running at the same time. This is useful when you want your agents to see the results of the previous action before proceeding with the next one.

```python
class Action1(BaseTool):
input: str = Field(...)
one_call_at_a_time: bool = True

def run(self):
# your code here
```

0 comments on commit 1e05862

Please sign in to comment.