Skip to content
async-python-patterns logo

Async Python Patterns

async-python-patterns

Comprehensive guidance for implementing asynchronous Python applications using asyncio, concurrent programming patterns, and async/await for building high-performance, non-blocking systems.

techwavedev/agi-agent-kit0installs4stars

SKILL.md

Full skill instructions

Async Python Patterns

Comprehensive guidance for implementing asynchronous Python applications using asyncio, concurrent programming patterns, and async/​await for building high-performance, non-blocking systems.

Use this skill when

  • Building async web APIs (FastAPI, aiohttp, Sanic)
  • Implementing concurrent I/​O operations (database, file, network)
  • Creating web scrapers with concurrent requests
  • Developing real-time applications (WebSocket servers, chat systems)
  • Processing multiple independent tasks simultaneously
  • Building microservices with async communication
  • Optimizing I/​O-bound workloads
  • Implementing async background tasks and queues

Do not use this skill when

  • The workload is CPU-bound with minimal I/​O.
  • A simple synchronous script is sufficient.
  • The runtime environment cannot support asyncio/​event loop usage.

Instructions

  • Clarify workload characteristics (I/​O vs CPU), targets, and runtime constraints.
  • Pick concurrency patterns (tasks, gather, queues, pools) with cancellation rules.
  • Add timeouts, backpressure, and structured error handling.
  • Include testing and debugging guidance for async code paths.
  • If detailed examples are required, open resources/​implementation-playbook.md.

Refer to resources/​implementation-playbook.md for detailed patterns and examples.

Resources

  • resources/​implementation-playbook.md for detailed patterns and examples.

<!-- AGI-INTEGRATION-START -->

AGI Framework Integration

Adapted for @techwavedev/​agi-agent-kit Original source: antigravity-awesome-skills

Memory-First Protocol

Retrieve prior API design decisions, database schema choices, and error handling patterns. Cache API response templates for consistent error formatting.

# Check for prior backend/​API context before starting
python3 execution/​memory_manager.py auto --query "API design patterns and architecture decisions for Async Python Patterns"

Storing Results

After completing work, store backend/​API decisions for future sessions:

python3 execution/​memory_manager.py store \
  --content "API architecture: REST with HATEOAS, JWT auth, rate limiting at 100 req/​min per tenant" \
  --type decision --project <project> \
  --tags async-python-patterns backend

Multi-Agent Collaboration

Share API contract changes with frontend agents so they update their client code, and with QA agents for test coverage.

python3 execution/​cross_agent_context.py store \
  --agent "<your-agent>" \
  --action "Implemented API endpoints — 5 new routes with OpenAPI spec and integration tests" \
  --project <project>

Agent Team: Code Review

After implementation, dispatch code_review_team for two-stage review (spec compliance + code quality) before merging.

<!-- AGI-INTEGRATION-END -->