mirror of
https://github.com/MervinPraison/PraisonAI.git
synced 2026-11-09 11:51:37 -10:00
- simple_input.py: Basic user input example - medium_complexity_input.py: Multiple inputs with tools and context - advanced_dynamic_input.py: Class-based system with conditional logic - environment_variable_input.py: Combining env vars with user input - streamlit_ui_input.py: Web-based UI for dynamic input These examples demonstrate various approaches to handling dynamic user input in PraisonAI agents. Closes #66 Co-authored-by: Mervin Praison <[email protected]>
30 lines
811 B
Python
30 lines
811 B
Python
"""
|
|
Simple Input Example for PraisonAI
|
|
|
|
This example demonstrates how to use basic user input to create dynamic agents and tasks.
|
|
The user is prompted for a search query, and the agent searches for information about it.
|
|
"""
|
|
|
|
from praisonaiagents import Agent, Task, PraisonAIAgents
|
|
|
|
# Get user input
|
|
user_query = input("What would you like to search for? ")
|
|
|
|
# Create agent
|
|
agent = Agent(
|
|
name="SearchAgent",
|
|
role="Information Finder",
|
|
goal="Find information about user's query",
|
|
backstory="Expert researcher with web access"
|
|
)
|
|
|
|
# Create task with dynamic input
|
|
task = Task(
|
|
description=f"Search for information about: {user_query}",
|
|
expected_output=f"Summary of findings about {user_query}",
|
|
agent=agent
|
|
)
|
|
|
|
# Run
|
|
agents = PraisonAIAgents(agents=[agent], tasks=[task])
|
|
agents.start() |