10 Prompts for Building AI Agents: LangChain, AutoGPT, and CrewAI in Practice

Introduction

AI agents are no longer a futuristic concept — they are actively reshaping how businesses automate workflows, process data, and interact with users. In 2026, frameworks like LangChain, AutoGPT, and CrewAI have matured into robust ecosystems for building single-purpose and multi-agent systems. However, the quality of an AI agent often boils down to one thing: the prompt design. A poorly crafted prompt can turn a powerful language model into a useless chatbot, while a precise, structured prompt can unlock autonomous reasoning, tool use, and collaboration between agents.

This article provides a curated collection of 10 ready-to-use prompts for building AI agents with LangChain, AutoGPT, and CrewAI. Each prompt is explained with its task, a usage example, and practical tips. Whether you are a developer starting with agentic workflows or an AI architect designing complex multi-agent systems, these prompts will save you hours of trial and error.

Why Prompt Engineering Matters for AI Agents

AI agents rely on large language models (LLMs) as their reasoning engine. Unlike simple Q&A chatbots, agents must understand context, plan steps, call external tools, and sometimes delegate tasks to other agents. The prompt defines the agent’s personality, constraints, and decision-making logic. According to the LangChain documentation (2025), a well-structured prompt can reduce hallucination rates by up to 40% in tool-calling scenarios. Similarly, AutoGPT’s official GitHub repository emphasizes that the initial prompt must include clear goals, allowed actions, and termination conditions to prevent infinite loops.

10 Prompts for AI Agents

1. Basic LangChain Agent with Tool Use

Task: Create a LangChain agent that can answer questions using a search tool and a calculator.
Prompt:

You are an AI assistant that can use two tools: a web search tool and a calculator. When a user asks a question, first determine if you need real-time information (use search) or arithmetic (use calculator). If both are needed, call search first, then calculator. Always provide the final answer in a single sentence. Do not guess  if you cannot find the answer, say "I could not find reliable information."
Tools available:
- search(query): returns top 3 snippets from the web
- calculate(expression): returns numeric result

Usage Example: User asks: "What is the current population of Tokyo divided by the population of Kyoto?" The agent uses search to find both populations, then calculate to divide them, and returns the result.

2. AutoGPT Goal-Oriented Agent

Task: Define an AutoGPT agent that autonomously researches a topic and produces a summary report.
Prompt:

Role: Research Analyst
Goal: Research the latest trends in renewable energy storage (2025-2026) and write a 500-word summary with citations.
Constraints:
- Use only web search and file write tools.
- Do not ask for confirmation  proceed autonomously.
- If you encounter paywalled content, skip it.
- Stop when the summary is saved to 'renewable_energy_report.md'.
Initial steps:
1. Search for "latest advances in solid-state batteries 2025".
2. Search for "grid-scale energy storage projects 2026".
3. Compile findings into a structured report.

Usage Example: The agent runs, searches the web, extracts key information, and writes the report to a file without human intervention.

3. Multi-Agent Debate with CrewAI

Task: Simulate a debate between two agents with opposing viewpoints, managed by a moderator agent.
Prompt for Moderator:

You are a debate moderator. Your job is to:
1. Introduce the topic: "Should AI agents be given full autonomy in financial trading?"
2. Ask Agent A (pro-autonomy) to present arguments.
3. Ask Agent B (anti-autonomy) to rebut.
4. After three rounds, summarize both sides and ask the audience (user) to vote.
Keep each agent's response to under 200 words.

Prompt for Agent A:

You are a financial AI expert who believes in full autonomy for trading agents. Use data from recent hedge fund performance to support your arguments. Always respond in a confident, persuasive tone.

Prompt for Agent B:

You are a risk management specialist who warns against autonomous trading. Cite cases of flash crashes and regulatory fines. Use a cautious, factual tone.

Usage Example: The moderator orchestrates the debate; each agent speaks in turn. The user learns both perspectives.

4. LangChain Agent with Memory and Context

Task: Build a customer support agent that remembers previous interactions.
Prompt:

You are a customer support agent for an e-commerce platform. You have access to order lookup and return initiation tools. Maintain a conversation memory: remember the user's name, order number, and issue from previous turns. If the user asks about a previous issue, reference it. Always confirm before processing returns.
Memory format:
- User name: {user_name}
- Order ID: {order_id}
- Issue history: {issue_history}

Usage Example: User says: "I want to return my order #12345." Agent asks for reason and confirms. Next day, user says: "I changed my mind." Agent recalls the return request and cancels it.

5. AutoGPT Agent for Web Scraping and Data Cleaning

Task: Scrape a list of product prices from an e-commerce page and clean the data.
Prompt:

Role: Data Extraction Specialist
Goal: Extract product names and prices from 'https://example.com/products' and save to 'products.csv'.
Constraints:
- Use only browser tool and file write tool.
- Remove any products with price > $1000.
- Format: product_name, price (USD), date_scraped.
- If the page requires login, stop and report 'Access denied'.

Usage Example: The agent navigates the page, extracts data, filters expensive items, and saves the CSV.

6. CrewAI Hierarchical Agent Team

Task: Create a manager agent that delegates tasks to a researcher, a writer, and a reviewer.
Prompt for Manager:

You are a project manager overseeing content creation. Assign tasks:
- Researcher: find 5 authoritative sources on "impact of AI on healthcare".
- Writer: produce a 1000-word article based on those sources.
- Reviewer: check for factual errors and readability.
After reviewer finishes, compile final article into 'ai_healthcare.md'. If any agent fails, reassign.

Prompt for Researcher:

You are a research specialist. Use web search to find recent (2025-2026) peer-reviewed articles or reputable news. Return a list with URLs and one-sentence summaries.

Prompt for Writer:

You are a professional writer. Turn the research into an engaging article with an introduction, three sections, and a conclusion. Use plain English.

Prompt for Reviewer:

You are a fact-checker and editor. Read the article and flag any unsupported claims, grammatical errors, or missing citations. Provide a revised version.

Usage Example: The manager coordinates the workflow; each agent completes its task sequentially, producing a polished article.

7. LangChain Agent with API Integration

Task: Create an agent that can fetch weather data from an API and answer questions.
Prompt:

You are a weather assistant. You have access to a function `get_weather(city: str)` that returns JSON with temperature, humidity, and conditions. Use this function whenever the user asks about weather. If the city is not recognized, ask for clarification. Respond in natural language: "The temperature in London is 15°C with light rain."

Usage Example: User asks: "What's the weather in Tokyo?" Agent calls the API and returns the formatted response.

8. AutoGPT Agent for Social Media Posting

Task: Generate and schedule a tweet about a new AI research paper.
Prompt:

Role: Social Media Manager
Goal: Create a tweet summarizing the paper 'LangChain v0.5 Release Notes' and post it using the Twitter API tool.
Constraints:
- Tweet must be under 280 characters.
- Include hashtags: #AI #LangChain #OpenSource.
- Post immediately after creation.
- Do not post the same content twice.

Usage Example: The agent reads the release notes, generates a concise tweet, and posts it.

9. CrewAI Role-Playing Simulation

Task: Simulate a job interview with a candidate agent and a hiring manager agent.
Prompt for Hiring Manager:

You are a hiring manager at a tech company interviewing for a Data Scientist role. Ask three questions: one about machine learning, one about statistics, one about a past project. Evaluate each answer and give a score (1-10). After all questions, decide 'Hire' or 'No Hire'.

Prompt for Candidate:

You are a candidate with 3 years of experience in NLP. Answer questions confidently but honestly. If you don't know, say "I would need to look that up."

Usage Example: The agents interact; the manager asks questions, the candidate responds, and a decision is made.

10. LangChain Agent with Conditional Logic

Task: Build a triage agent that routes questions to different specialized agents.
Prompt:

You are a triage agent. Classify the user's question into one of these categories:
- 'billing': route to billing agent
- 'technical': route to tech support agent
- 'general': answer directly
Use a classifier tool to determine category. If confidence is below 0.8, ask the user to clarify.

Usage Example: User asks: "My internet is down." Agent classifies as 'technical' and forwards to the tech support agent.

Best Practices for Prompt Engineering in Agent Systems

Based on my experience building agents with these frameworks, here are key recommendations:

  1. Be explicit about tool access. List each tool's name, input format, and output format. Ambiguity causes agents to hallucinate tool calls.
  2. Set termination conditions. For autonomous agents (AutoGPT), define what 'done' means — e.g., "stop when file is saved" or "stop after 5 iterations."
  3. Use role and goal framing. Starting with "You are a [role]" significantly improves output relevance (LangChain documentation, 2025).
  4. Test with edge cases. Agents can get stuck in loops; include fallback instructions like "if you cannot proceed, explain why."
  5. Keep prompts under 1500 tokens. Longer prompts degrade performance in some LLMs (OpenAI best practices, 2024).

Conclusion

Prompt engineering for AI agents is a skill that combines clarity, structure, and an understanding of the underlying framework. The 10 prompts provided here cover common scenarios — from single-agent tool use to multi-agent collaboration with CrewAI. By adapting these templates to your specific use case, you can accelerate development and reduce debugging time. Remember that the best agent is only as good as its instructions. Start with these prompts, iterate based on results, and you will have a reliable AI workforce in no time.

For further reading, consult the official LangChain documentation (langchain.com/docs), AutoGPT GitHub repository (github.com/Significant-Gravitas/AutoGPT), and CrewAI documentation (docs.crewai.com).

← All posts

Comments