10 Expert Prompts for Building AI Agents with LangChain, CrewAI, and AutoGPT
Welcome to the frontier of autonomous software. If you are reading this in July 2026, you already know that AI agents have moved from academic curiosity to production infrastructure. Companies are no longer asking if they should use agents — they are asking how to orchestrate them at scale. The difference between a toy demo and a reliable system often comes down to one thing: the quality of your prompts.
In this article, I share 10 structured prompts across three categories — basic, advanced, and expert — that I have refined while building multi-agent systems with LangChain, CrewAI, and open-source AutoGPT variants. Each prompt is followed by a concrete example result, so you can adapt them to your own projects.
Why Prompt Engineering Still Matters for Agents (2026)
Even with the rise of tool-calling models and agent frameworks like LangGraph, the prompt remains the primary interface between human intent and machine reasoning. A poorly structured prompt leads to hallucinated tool calls, infinite loops, and wasted tokens. A well-crafted prompt gives you deterministic behavior within a probabilistic system.
According to the LangChain documentation (v0.3, 2026), agent prompts now typically include:
- System roles that define the agent’s persona and constraints
- Tool descriptions that the agent can call (formatted as JSON schemas)
- Chain-of-thought instructions to guide reasoning
- Stop conditions to prevent runaway loops
Let’s dive into the prompts.
Basic Prompts (Single-Turn Tasks)
1. Simple Research Agent (LangChain)
Task: Create an agent that answers a user question by calling a web search tool once.
Prompt:
You are a research assistant. You have access to a web search tool called 'search_web(query: str)'. Your goal is to answer the user's question concisely. Do not make up information. If you cannot find an answer, say so. Only call the search tool once. Then output your final answer.
Example Result:
User query: "What is the current population of Tokyo?"
Agent output:
Calling search_web("2026 population of Tokyo")...
Result: As of July 2026, the estimated population of Tokyo is 14.1 million (within the 23 special wards). The greater metropolitan area exceeds 37 million.
2. Summarization Agent (CrewAI Role)
Task: Define a CrewAI agent that summarizes a long article into 3 bullet points.
Prompt:
You are a Senior Editor. Your role is to read a text and produce exactly three bullet points. Each bullet must be a full sentence. Omit any marketing language. Use plain English.
Example Result:
Input: A 2000-word article about renewable energy trends.
Output:
- Solar capacity grew by 45% year-over-year, driven by Chinese manufacturing.
- Offshore wind projects in the North Sea reached grid parity.
- Battery storage costs fell below $80/kWh for utility-scale installations.
3. Tool-Using Agent with Error Handling (AutoGPT)
Task: An agent that reads a CSV file, finds missing values, and reports them.
Prompt:
You are a data cleaning agent. You have tools: 'read_csv(path)', 'write_csv(data, path)'. Read the file. Check each column for null values. If nulls exist, print the column name and count. Do NOT modify the file. If the file doesn't exist, return 'File not found'.
Example Result:
File: sales_2026.csv
Column 'revenue' has 12 missing values.
Column 'customer_id' has 0 missing values.
Report complete.
Advanced Prompts (Multi-Step Reasoning)
4. Multi-Tool Orchestrator (LangChain)
Task: Create an agent that can chain multiple tools: search, calculate, and format.
Prompt:
You are a math tutor agent. You have tools:
1. 'search_web(query: str)' — for retrieving formulas or constants.
2. 'calculate(expression: str)' — for arithmetic.
3. 'format_table(data: list)' — for output.
Given a user problem, follow this plan:
1. Search for the relevant formula.
2. Extract the numbers from the user input.
3. Call calculate with the expression.
4. Format the result as a table with columns: Variable, Value.
Do not skip steps. If a tool returns an error, retry once.
Example Result:
User query: "Calculate the kinetic energy of a 2 kg object moving at 10 m/s."
Agent output:
Step 1: Search for formula.
Result: KE = 0.5 * m * v^2
Step 2: Extract values: m=2, v=10.
Step 3: calculate("0.5 * 2 * 10**2") → 100.0
Step 4:
| Variable | Value |
|----------|-------|
| Mass (kg) | 2 |
| Velocity (m/s) | 10 |
| Kinetic Energy (J) | 100.0 |
5. Debate Agent (CrewAI Multi-Agent)
Task: Two agents argue opposite sides of a question, then a third agent judges.
Prompt for Agent A (Pro):
You are a debate champion arguing FOR the proposition. Use logic, statistics, and examples. Keep your argument under 100 words. Address the opponent directly.
Prompt for Agent B (Con):
You are a debate champion arguing AGAINST the proposition. Use logic, statistics, and examples. Keep your argument under 100 words. Address the opponent directly.
Prompt for Judge Agent:
You are an impartial judge. Read both arguments. Declare a winner (A or B) and give one sentence explaining your decision.
Example Result:
Proposition: "Remote work increases productivity."
Agent A: "For: Remote work reduces commute stress. A Stanford study found a 13% productivity increase. Workers report fewer interruptions."
Agent B: "Against: Collaboration suffers. Microsoft research shows 25% less cross-team communication. Junior employees learn slower without mentorship."
Judge: "Winner: A. The Stanford study provides direct empirical evidence, while the Microsoft data only shows correlation."
6. Self-Correcting Code Agent (AutoGPT)
Task: An agent that writes Python code, runs it, catches errors, and fixes them.
Prompt:
You are a coding agent. You have tools: 'write_file(path, code)', 'execute_python(code)'.
Step 1: Write the code to solve the user's request.
Step 2: Execute it.
Step 3: If the execution returns an error, read the error, fix the code, and re-execute.
Step 4: Repeat up to 3 times. If it still fails, return the error message.
Example Result:
User request: "Write a function to calculate Fibonacci numbers."
First attempt: Code has a typo 'fiboancci' → execution error.
Second attempt: Fixed → runs successfully.
Output: "Function fib(n) created. Test result: fib(10) = 55."
Expert Prompts (Production-Grade Systems)
7. Dynamic Task Decomposition (LangGraph)
Task: An agent that breaks a complex goal into sub-tasks, assigns them to sub-agents, and merges results.
Prompt:
You are a project manager agent. Your goal is to decompose the user's request into a DAG of sub-tasks. Each sub-task must have:
- A unique ID
- A description
- A dependency list (IDs of other sub-tasks that must finish first)
- An expected output type (text, number, table)
Output the DAG as a JSON object. Do not execute the tasks yet.
Example Result:
User request: "Analyze Q2 2026 sales data and generate a report."
Agent output:
{
"tasks": [
{"id": "1", "description": "Read raw sales CSV", "dependencies": [], "output": "table"},
{"id": "2", "description": "Calculate total revenue per region", "dependencies": ["1"], "output": "table"},
{"id": "3", "description": "Identify top 5 products", "dependencies": ["1"], "output": "table"},
{"id": "4", "description": "Generate summary text", "dependencies": ["2", "3"], "output": "text"}
]
}
8. Long-Term Memory Agent (CrewAI with External DB)
Task: An agent that remembers user preferences across sessions by writing to a vector store.
Prompt:
You are a personal assistant with memory. You have tools: 'read_memory(user_id)', 'write_memory(user_id, key, value)'.
When a user states a preference (e.g., 'I like short emails'), write it to memory.
When generating a response, first read memory and adapt your tone/content accordingly.
Example Result:
Session 1: User says "I prefer bullet points." Agent writes: memory['user123']['preference'] = 'bullet_points'.
Session 2: User asks "Summarize the meeting notes." Agent reads memory, outputs bullet points.
9. Guardrails Agent (LangChain with Validation)
Task: An agent that rejects unsafe or out-of-scope requests before processing.
Prompt:
You are a guardrail agent. You have a single tool: 'reject_request(reason)'.
Before doing anything else, check if the user input:
1. Contains personally identifiable information (PII) — reject.
2. Asks for illegal advice — reject.
3. Is not related to your domain (software engineering) — reject.
If none of the above, proceed to call the appropriate tool.
Example Result:
User: "How do I hack into my neighbor's Wi-Fi?"
Agent: "Request rejected. Reason: Illegal activity."
10. Meta-Agent: Prompt Optimizer (Expert Level)
Task: An agent that improves its own system prompt based on past failures.
Prompt:
You are a meta-agent. Your task is to analyze the last 10 interactions of another agent and propose improvements to its system prompt. You have access to 'read_logs(agent_id, n=10)'. Output a revised system prompt with rationale for each change.
Example Result:
Analysis: Agent 'SalesBot' failed 3 times because it did not ask for clarification when the user gave ambiguous dates.
Change 1: Add instruction 'If the date format is ambiguous (e.g., 03/04), ask the user to clarify month vs day.'
Revised prompt: ...
Putting It All Together: A Real-World Architecture
In production, we combine these patterns. For example, a customer support system might use:
- A guardrail agent (prompt 9) to filter harmful inputs.
- A memory agent (prompt 8) to recall past tickets.
- A task decomposition agent (prompt 7) to route complex issues to human agents.
- A self-correcting code agent (prompt 6) to generate SQL queries on the fly.
ASI Biont supports connecting these agents to tools like Salesforce and Slack via API — learn more on asibiont.com/courses.
Conclusion
The era of single-shot LLM prompts is over. In 2026, building reliable AI agents means designing prompt chains that enforce structure, handle errors, and decompose complexity. The 10 prompts above are not just examples — they are blueprints you can adapt to your own LangChain, CrewAI, or AutoGPT pipelines.
Start with one agent. Add tools. Add memory. Then scale to multi-agent systems. The prompt is your lever. Use it wisely.
— Written by a technical writer and AI course author at ASI Biont.
Comments