common-agent-patterns
Skill0 starsChanged 6 months agoMITView on GitHub
Provides copy-paste complete Lauren AI agent implementations for the most common production scenarios. Covers a research agent with web search and knowledge base, a customer service bot with memory and guardrails, a data-analysis agent with database tools, and a sequential pipeline agent. Use when scaffolding a new agent or when a complete working example is needed rather than API reference.
In this repository65 other files it gives its agents.
- AGENTS.mdAGENTS.md
- skills/building-agents/agents.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- llms-full.txtllms.txt
- llms.txtllms.txt
- adding-guardrailsSkill
- agent-health-timeoutSkill
- agent-permission-scopingSkill
- agent-session-isolationSkill
- agent-step-loggingSkill
- agent-supervisor-routerSkill
- agent-telemetrySkill
- async-agent-backgroundSkill
- building-agentsSkill
- building-teamsSkill
- building-toolsSkill
- calendar-scheduling-toolSkill
- callback-tracing-handlerSkill
- chain-of-thought-promptingSkill
- chat-model-configurationSkill
- code-execution-sandboxSkill
- context-window-managementSkill
- conversation-memorySkill
- conversation-state-dbSkill
- database-query-toolSkill
- document-loadersSkill
- document-rerankingSkill
- email-notification-toolSkill
- embedding-model-ingestionSkill
- fallback-model-chainSkill
- few-shot-injectionSkill
- filesystem-toolSkill
- human-in-the-loopSkill
- hybrid-searchSkill
- inspecting-streamsSkill
- integrating-with-laurenSkill
- json-schema-enforcementSkill
- llm-provider-connectionSkill
- llm-rate-limitingSkill
- long-term-vector-memorySkill
- managing-memorySkill
- migrating-to-lauren-aiSkill
- multi-agent-delegationSkill
- multi-tool-orchestrationSkill
- multi-turn-tool-stateSkill
- output-guardrailsSkill
- plan-and-execute-agentSkill
- prompt-injection-defenseSkill
- prompt-versioningSkill
- rag-pipelineSkill
- react-agent-loopSkill
- response-validation-retrySkill
- rest-api-toolSkill
- securing-agentsSkill
- semantic-cacheSkill
- streaming-response-handlerSkill
- structured-output-parsingSkill
- sub-agent-spawningSkill
- system-prompt-templatingSkill
- testing-agentsSkill
- The first 60 shown.
The file
We split this skill into the rules it gives an agent
1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
0
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 59
When you need deterministic tool execution without an LLM making routing decisions:
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Common Agent Patterns
Use
codemap find "SymbolName"to locate any symbol before reading — it gives exact file + line range and is faster than grep.
Complete, copy-pasteable agent patterns. Each is a working snippet you can drop into a project with minimal changes.
Patterns
- Research agent: searches the web, synthesises results, streams tokens → research-agent.md
- Customer service bot: multi-turn, memory, guardrails, agent handoff → customer-service-bot.md
- Data-analysis agent: queries a database, formats results, explains findings → data-analysis-agent.md
- Pipeline agent: sequential tool chain with no LLM mid-loop, streaming → see below
Quick reference: minimal streaming agent
from lauren_ai import agent, tool, use_tools, AgentRunnerBase, LLMConfig, LLMModule
@tool()
async def calculator(expression: str) -> dict:
"""Evaluate a Python math expression.
Args:
expression: A safe arithmetic expression, e.g. '2 + 2'.
"""
try:
result = eval(expression, {"__builtins__": {}})
return {"result": result}
except Exception as e:
return {"error": str(e)}
@agent(model="claude-haiku-4-5-20251001", system="You are a math tutor. Use the calculator for any arithmetic.")
@use_tools(calculator)
class MathTutorAgent: ...
# Wire (or inject via AgentModule in production)
cfg = LLMConfig(provider="anthropic", model="claude-haiku-4-5-20251001", api_key="sk-ant-...")
provider = LLMModule.for_root(cfg)
runner = AgentRunnerBase(transport=provider.transport_instance)
agent_instance = MathTutorAgent()
# Blocking
result = await runner.run(agent_instance, "What is 17 * 23?")
print(result.content)
# Streaming
async for chunk in await runner.run_stream(agent_instance, "What is 17 * 23?"):
if chunk.delta:
print(chunk.delta, end="", flush=True)Pipeline agent (sequential tool chain, no LLM loop)
When you need deterministic tool execution without an LLM making routing decisions:
from lauren_ai import tool, AgentRunnerBase
@tool()
async def fetch_data(source: str) -> dict:
"""Fetch raw data from a source."""
return {"data": f"raw content from {source}"}
@tool()
async def transform_data(data: str, format: str = "json") -> dict:
"""Transform data into the specified format."""
return {"transformed": data, "format": format}
@tool()
async def save_result(content: str, filename: str) -> dict:
"""Save content to a file."""
return {"saved": filename, "bytes": len(content)}
# Call tools directly via ToolExecutor without an agent loop
from lauren_ai._tools._executor import ToolExecutor
executor = ToolExecutor(tools=[fetch_data, transform_data, save_result], config=cfg)
raw = await executor.call("fetch_data", {"source": "https://api.example.com/data"})
transformed = await executor.call("transform_data", {"data": raw["data"], "format": "csv"})
saved = await executor.call("save_result", {"content": transformed["transformed"], "filename": "output.csv"})Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

