Your First Agent

In this assignment, you'll create your first multi-agent AI application that focuses on prompt engineering and optimization. The application will consist of two specialized agents working together to enhance user prompts:

Inputs

User Prompt & Target LLM

Improve Structure

Enhances prompt structure

Optimize

For target model

Output

Enhanced Prompt

How It Works

This is similar to what happens behind the scenes when you use ChatGPT - the system automatically enhances and optimizes your input to get better results from the language model.

Agent Components

Prompt Structure Agent

This agent will improve the structure of the input prompt, as well as the clarity and completeness.

LLM Optimization Agent

Ensures the prompt is optimized for the specific LLM model it will be executed on, taking into account model capabilities and best practices.

Required Inputs

  • The original prompt from the user
  • The target LLM model for execution

Useful Resources

Code Examples

Passing input to the Tasks

set_and_track_goals = Task(
    description=f"Set the user's fitness goal to {fitness_goal} and track their progress with a "
                f"personalized plan, also take into account the last weight measurements: {historical_weight_data}.",
    expected_output="A fitness plan for muscle gain and progress tracking setup.",
    agent=fitness_tracker_agent,
)
...
crew.kickoff(inputs={'fitness_goal': 'Muscle gain', 
                     'historical_weight_data': ".".join([80, 85, 82, 84, 83])})

How to use expected_output

enhance_prompt_task = Task(
    description="Improve this prompt ({initial_prompt}) to make it more descriptive and detailed for image generation.",
    expected_output='"image_description": "Enhanced Prompt here',
    agent=prompt_improver_agent
)