patterns_skill

This skill provides design patterns for Langroid multi-agent frameworks, guiding agent configuration, tool handling, task control, and CLI integrations.
  • Python

1.2k

GitHub Stars

8

Bundled Files

2 months ago

Catalog Refreshed

4 months ago

First Indexed

Readme & install

Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.

Installation

Preview and clipboard use veilstrat where the catalogue uses aiagentskills.

npx veilstrat add skill pchalasani/claude-code-tools --skill patterns

  • agent-handler-validation-with-state.md5.6 KB
  • agent-tool-handler-with-state.md5.3 KB
  • done-sequences-specific-tool.md3.9 KB
  • mcp-tool-integration.md4.5 KB
  • quiet-mode.md2.1 KB
  • run-batch-tasks.md6.1 KB
  • SKILL.md4.6 KB
  • task-return-tool.md6.0 KB

Overview

This skill documents design patterns for building agents with the Langroid multi-agent LLM framework. It focuses on agent configuration, tool handlers, task control, batch workflows, and integrations with MCP servers and CLI coding agents. The patterns are practical, implementation-focused, and aimed at reliable, maintainable agent behavior.

How this skill works

The skill presents clear patterns you can apply when designing Langroid agents and tasks. Each pattern explains the objective, when to use it, and the concrete mechanism (agent methods, TaskConfig, run_batch_tasks, mcp_tool integration, quiet_mode). Examples show how to wire tools, validate outputs, manage state, and control task termination. Patterns are framework-agnostic but include actionable Python idioms for common scenarios.

When to use it

  • When you need a simple agent that returns a structured tool response directly.
  • When tool handlers must access external resources or maintain retryable state.
  • When tool outputs require validation against input context before accepting.
  • When you want to terminate a task only on a specific tool emission.
  • When processing many similar inputs concurrently without manual concurrency management.
  • When integrating external MCP tools (e.g., Claude Code) or silencing agent noise for clean CLI output.

Best practices

  • Define stateful tool handlers as agent methods when you need shared resources, counters, or deterministic retries.
  • Return plain error strings from handlers to trigger automatic LLM retries; use AgentDoneTool/DoneTool appropriately to signal success.
  • Use TaskConfig.done_sequences to control exactly which tool emission ends a task.
  • Use run_batch_tasks for isolation between items and to limit concurrency via batch_size to avoid connection exhaustion.
  • Validate critical fields in handler methods and return clear error messages so the LLM can self-correct.
  • Wrap long-running runs in quiet_mode() to suppress framework noise and print your own progress messages.

Example use cases

  • A CLI code agent that edits and writes files via MCP tools exposed by Claude Code, with post-processing of tool results.
  • A task that must preserve placeholders from the input; a handler validates and forces LLM retries until valid.
  • Batch-linting or refactoring of hundreds of files using the same agent logic, executed in parallel with run_batch_tasks.
  • A test harness that terminates only when a specific verification tool emits a pass signal via TaskConfig.done_sequences.
  • A small agent that returns a single structured ToolMessage as the final output for downstream processing.

FAQ

Use AgentDoneTool when the agent-level handler needs to run before task termination and you want the agent to control completion. Use DoneTool for handlers that signal final success without needing agent post-processing.

How do I avoid exhausting model or server connections in batch jobs?

Use run_batch_tasks with a controlled batch_size so tasks run in parallel up to the concurrency limit. Each item gets a cloned agent with fresh state to prevent shared-connection issues.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational