agentleFS
lauren-frameworklauren-framework/lauren-ai/skills/common-agent-patterns/SKILL.md

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.

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
  1. Distinctive:

    When you need deterministic tool execution without an LLM making routing decisions:

    line 59

≈ “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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

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"})

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.