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.
37 lines
732 B
37 lines
732 B
11 months ago
|
from swarms import Agent, OpenAIChat, SequentialWorkflow
|
||
1 year ago
|
|
||
11 months ago
|
# Example usage
|
||
1 year ago
|
llm = OpenAIChat(
|
||
|
temperature=0.5,
|
||
11 months ago
|
max_tokens=3000,
|
||
1 year ago
|
)
|
||
|
|
||
11 months ago
|
# Initialize the Agent with the language agent
|
||
1 year ago
|
agent1 = Agent(
|
||
11 months ago
|
agent_name="John the writer",
|
||
1 year ago
|
llm=llm,
|
||
11 months ago
|
max_loops=1,
|
||
11 months ago
|
dashboard=False,
|
||
|
)
|
||
11 months ago
|
|
||
1 year ago
|
|
||
11 months ago
|
# Create another Agent for a different task
|
||
|
agent2 = Agent("Summarizer", llm=llm, max_loops=1, dashboard=False)
|
||
11 months ago
|
|
||
1 year ago
|
|
||
1 year ago
|
# Create the workflow
|
||
11 months ago
|
workflow = SequentialWorkflow(
|
||
|
name="Blog Generation Workflow",
|
||
|
description=(
|
||
11 months ago
|
"Generate a youtube transcript on how to deploy agents into"
|
||
|
" production"
|
||
11 months ago
|
),
|
||
|
max_loops=1,
|
||
|
autosave=True,
|
||
|
dashboard=False,
|
||
11 months ago
|
agents=[agent1, agent2],
|
||
1 year ago
|
)
|
||
1 year ago
|
|
||
|
# Run the workflow
|
||
|
workflow.run()
|