You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
swarms/playground/agents/full_stack_agent.py

34 lines
826 B

10 months ago
from swarms import Agent, Anthropic, tool
10 months ago
# Tool
@tool # Wrap the function with the tool decorator
def search_api(query: str, max_results: int = 10):
"""
Search the web for the query and return the top `max_results` results.
"""
return f"Search API: {query} -> {max_results} results"
## Initialize the workflow
agent = Agent(
agent_name="Youtube Transcript Generator",
agent_description=(
9 months ago
"Generate a transcript for a youtube video on what swarms" " are!"
10 months ago
),
10 months ago
llm=Anthropic(),
10 months ago
max_loops="auto",
autosave=True,
dashboard=False,
streaming_on=True,
verbose=True,
stopping_token="<DONE>",
tools=[search_api],
)
# Run the workflow on a task
agent(
"Generate a transcript for a youtube video on what swarms are!"
" Output a <DONE> token when done."
)