-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21 from jlowin/agent-selection
Update agent selection
- Loading branch information
Showing
7 changed files
with
196 additions
and
113 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from control_flow import Agent, Task | ||
from control_flow.dx import ai_flow | ||
from control_flow.instructions import instructions | ||
|
||
teacher = Agent(name="teacher") | ||
student = Agent(name="student") | ||
|
||
|
||
@ai_flow | ||
def demo(): | ||
with Task("Teach a class by asking and answering 3 questions") as task: | ||
for _ in range(3): | ||
question = Task( | ||
"ask the student a question. Wait for the student to answer your question before asking another one.", | ||
str, | ||
agents=[teacher], | ||
) | ||
with instructions("one sentence max"): | ||
Task( | ||
"answer the question", | ||
str, | ||
agents=[student], | ||
context=dict(question=question), | ||
) | ||
|
||
task.run() | ||
return task | ||
|
||
|
||
t = demo() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.