agentCLAWHUBUnverified

ia-python-services

Python patterns for CLI tools, async concurrency, and backend services. Use when working with Python code, building CLI apps, FastAPI services, async with asyncio, background jobs, or configuring uv, ruff, ty, pytest, or pyproject.toml. Skill: ia-python-services Owner: iliaal Summary: Python patterns for CLI tools, async concurrency, and backend services. Use when working with Python code, building CLI apps, FastAPI services, async with asyncio, background jobs, or configuring uv, ruff, ty, pytest, or pyproject.toml. Tags: latest:5.0.1 Version history: v5.0.1 | 2026-10-03T17:10:05.225Z | user v5.0.1 v5.0.0 | 2026-09-26T23:18:51.617Z | user v5.0.0 v4

OpenClaw

Rank

62

Safety

84

Downloads

2.3k

Updated

Oct 9, 2026

Version

5.0.1

Source

CLAWHUB

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 2.3K downloads reported by the source. Last updated 10/9/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Public facts

Every fact links back to the source it came from.

Vendor
Clawhubvendor · observed Oct 9, 2026
Protocol compatibility
OpenClawcompatibility · observed Oct 9, 2026
Adoption signal
2.3K downloadsadoption · observed Oct 9, 2026
Latest release
5.0.1release · observed Oct 3, 2026
Handshake status
UNKNOWNsecurity

Install and run

Setup complexity: low.

clawhub skill install s17bcar8wq0xhegs0ny6f57ypd8484bw:compound-eng-python-services
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-iliaal-compound-eng-python-services/snapshot"

Documentation

CLAWHUB

145,667 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: ia-python-services
class: language
description: >-
  Python patterns for CLI tools, async concurrency, and backend services. Use
  when working with Python code, building CLI apps, FastAPI services,
  async with asyncio, background jobs, or configuring uv, ruff, ty, pytest, or
  pyproject.toml.
paths: "**/*.py,**/pyproject.toml,**/ruff.toml,**/uv.lock"
---

# Python Services & CLI

## Working rules

- Validate external inputs and responses at boundaries; preserve exception causes.
- Keep simple sequential work synchronous. Bound concurrent work, preserve cancellation, and keep task references.
- Give network calls timeouts; retry only failures and operations whose semantics permit it.
- Enforce job idempotency with atomic writes and database constraints.
- Preserve published API behavior and shared migration history.
- Match telemetry to an operational question and verify its output.

## Discipline

- Simplicity first: every change as simple as possible, impact minimal code
- Only touch what's necessary; avoid introducing unrelated changes
- No hacky workarounds: if a fix feels wrong, step back and implement the clean solution
- Before adding a new abstraction, verify it appears in 3+ places. If not, inline it.
- Verify: see Verify section below; pass all checks with zero warnings before declaring done


## Verify

- `uv run pytest` passes with zero failures
- `uv run ruff check .` passes with zero warnings
- `uv run ty check .` passes with zero errors
- Coverage target: 80%+ (`uv run pytest --cov`; add `--cov-report=html` for a browsable report)

## Task-specific references

Read the relevant reference before implementing or reviewing the matching behavior:

- For packaging, environment configuration, CLI setup, or pytest behavior: [tooling-and-tests.md](./references/tooling-and-tests.md).
- For asyncio, background jobs, retries, pooling, timeouts, or health checks: [concurrency-and-resilience.md](./references/concurrency-and-resilience.md).
- For APIs, validation, errors, migrations, logging, metrics, or traces: [service-boundaries.md](./references/service-boundaries.md).

Existing specialized references, when the corresponding topic applies:

- [cli-tools.md](./references/cli-tools.md).
- [fastapi.md](./references/fastapi.md).

_meta.json

{
  "ownerId": "kn715jrbbh71q9zncr0bqdkr8n848q1a",
  "slug": "compound-eng-python-services",
  "version": "5.0.1",
  "publishedAt": 1791047405225
}

references/cli-tools.md

# Python CLI Tools

> When to read: when packaging a Python CLI: entry points, argparse vs typer vs click, structured logging, distribution.

## CLI Tools

**Entry points** in pyproject.toml:
```toml
[project.scripts]
my-tool = "my_package.cli:main"
```

**Click** (recommended for complex CLIs):
```python
import click

@click.group()
@click.version_option()
def cli(): ...

@cli.command()
@click.argument("name")
@click.option("--count", default=1, type=int)
def greet(name: str, count: int):
    for _ in range(count):
        click.echo(f"Hello, {name}!")

def main():
    cli()
```

**argparse** for simple CLIs: subparsers for subcommands, `parser.add_argument("--output", "-o")`.

Use `src/` layout. Include `py.typed` for type hints. `importlib.resources.files()` for package data access.

references/concurrency-and-resilience.md

# Concurrency and resilience

## Parallelism

| Workload | Approach |
|----------|----------|
| Many concurrent I/O calls | `asyncio` (gather, create_task) |
| CPU-bound computation | `multiprocessing.Pool` or `concurrent.futures.ProcessPoolExecutor` |
| Mixed I/O + CPU | `asyncio.to_thread()` to offload blocking work |
| Simple scripts, few connections | Stay synchronous |

### Sync vs Async Decision

**Use async (asyncio) when:**
- I/O-bound work has multiple concurrent operations (HTTP calls, database queries, file I/O happening in parallel)
- WebSocket servers or long-lived connections require it
- The framework requires it (FastAPI async endpoints, aiohttp)

**Stay synchronous when:**
- Work is CPU-bound (computation, data transformation): async adds nothing, use multiprocessing instead
- Building simple scripts and CLI tools with sequential I/O
- All I/O is sequential anyway (one DB query, process result, one API call)
- The team lacks async debugging experience (asyncio stack traces are harder to read)

**Rule of thumb:** if the code is not waiting on multiple I/O operations concurrently, sync is simpler and correct. Do not add async complexity for a single sequential pipeline.

**Key rule:** Stay fully sync or fully async within a call path.

**An awaitable returned into a sync path is a silent failure, not a type error.** A synchronous dispatch registry typed loosely (`dict[str, Callable[..., Any]]` for a tool executor, plugin table, or handler map) accepts an `async def` without complaint, and the type checker cannot catch it because a coroutine function is a `Callable` whose return type is `Any`. The call then returns a coroutine object instead of a result, and any code that stringifies or serializes the return value emits `<coroutine object handle at 0x...>` as its output while nothing raises; the only trace is a `RuntimeWarning: coroutine 'handle' was never awaited` at garbage collection, easy to lose in logs. Guard at the registry boundary and fail loudly:

```python
import inspect

result = handler(*args)
if inspect.isawaitable(result):
    if inspect.iscoroutine(result):
        result.close()  # suppress the never-awaited warning and release the frame
    logger.error("handler %s is async but registered in a sync registry", name)
    raise TypeError(f"handler {name!r} returned an awaitable from a synchronous dispatch")
```

Where the registry is meant to accept both, dispatch explicitly (`inspect.iscoroutinefunction(handler)` at registration time, then `asyncio.run` / `await` on the matching path) rather than letting the mismatch reach a serializer.

**asyncio patterns:**
- `asyncio.gather(*tasks)` for concurrent I/O; use `return_exceptions=True` for partial failure tolerance
- `asyncio.TaskGroup` (3.11+) for structured concurrency: automatic cancellation of sibling tasks on failure; prefer over `gather` when all tasks must succeed
- A bare `asyncio.create_task(...)` whose result is discarded can vanish mid-flight: the event loop

references/fastapi.md

# FastAPI Services

> When to read: when structuring a FastAPI app: project layout, dependency injection, async lifecycle, validation with Pydantic, OpenAPI generation.

## FastAPI Services

**Project structure:**
```
app/
├── api/v1/endpoints/    # Route handlers
├── core/                # config.py, security.py, database.py
├── models/              # SQLAlchemy models
├── schemas/             # Pydantic request/response
├── services/            # Business logic
├── repositories/        # Data access (generic CRUD base)
└── main.py              # Lifespan, middleware, router includes
```

**Lifespan** for startup/shutdown: `@asynccontextmanager async def lifespan(app):`

**Configuration**: `pydantic_settings.BaseSettings` with `model_config = {"env_file": ".env"}`. Required fields = no default (fails fast at boot). `env_nested_delimiter = "__"` for grouped config. `secrets_dir` for Docker/K8s mounted secrets.

**Dependency injection**: `Depends(get_db)` for sessions, `Depends(get_current_user)` for auth. Override in tests: `app.dependency_overrides[get_db] = mock_db`. A `yield` dependency's cleanup runs **after the response is sent** by default (`scope="request"`); `Depends(get_db, scope="function")` closes it when the path operation returns, **before** the response goes out, so a DB session or lock is released without waiting on a slow client. A `"request"`-scoped dependency may only depend on other `"request"`-scoped ones; `"function"` may depend on either.

**Responses**: return Pydantic models with `response_model`; pydantic-core serializes to JSON in Rust, so `ORJSONResponse` and `UJSONResponse` are deprecated (FastAPI 0.131.0, emit `FastAPIDeprecationWarning`) and no longer a performance win. Do not recommend them; reach for a custom `Response.render()` only for non-default encoding options such as indentation.

**Server-Sent Events**: native since FastAPI 0.135.0: `from fastapi.sse import EventSourceResponse, ServerSentEvent`, set `response_class=EventSourceResponse` on a path operation that `yield`s. Plain yielded objects become JSON `data:` fields (strings are JSON-quoted); yield `ServerSentEvent(data=..., event=..., id=..., retry=...)` to set SSE fields, or `raw_data=` for an unquoted string (`data` and `raw_data` are mutually exclusive). Works on any method, including `POST`. No third-party `sse-starlette` needed.

**Async DB**: SQLAlchemy `AsyncSession` with `asyncpg`. Session-per-request via `async with AsyncSessionLocal() as session: yield session`.

**Repository pattern**: Generic `BaseRepository[ModelType, CreateSchema, UpdateSchema]` with get/get_multi/create/update/delete. Service layer holds business logic, routes stay thin.
Github ReposUpdated 2h agoRank 70

AionUi

Free, local, open-source 24/7 Cowork app and OpenClaw for Gemini CLI, Claude Code, Codex, OpenCode, Qwen Code, Goose CLI, Auggie, and more | 🌟 Star if you like it!

MCPOPENCLAW
Github ReposUpdated 6mo agoRank 70

activepieces

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

OPENCLAW
Github ReposUpdated 6mo agoRank 70

cherry-studio

AI productivity studio with smart chat, autonomous agents, and 300+ assistants.

MCPOPENCLAW
Github ReposUpdated 7mo agoRank 70

CopilotKit

The Frontend for Agents & Generative UI. React + Angular

OPENCLAW

Machine-readable data

The same record, as JSON, for agents and crawlers.

{
  "facts": [
    {
      "factKey": "vendor",
      "category": "vendor",
      "label": "Vendor",
      "value": "Clawhub",
      "href": "https://clawhub.ai/iliaal/skills/compound-eng-python-services",
      "sourceUrl": "https://clawhub.ai/iliaal/skills/compound-eng-python-services",
      "sourceType": "profile",
      "confidence": "medium",
      "observedAt": "2026-10-09T16:05:01.225Z",
      "isPublic": true
    },
    {
      "factKey": "protocols",
      "category": "compatibility",
      "label": "Protocol compatibility",
      "value": "OpenClaw",
      "href": "https://www.xpersona.co/api/v1/agents/clawhub-iliaal-compound-eng-python-services/contract",
      "sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-iliaal-compound-eng-python-services/contract",
      "sourceType": "contract",
      "confidence": "medium",
      "observedAt": "2026-10-09T16:05:01.225Z",
      "isPublic": true
    },
    {
      "factKey": "traction",
      "category": "adoption",
      "label": "Adoption signal",
      "value": "2.3K downloads",
      "href": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceUrl": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceType": "profile",
      "confidence": "medium",
      "observedAt": "2026-10-09T16:05:01.225Z",
      "isPublic": true
    },
    {
      "factKey": "latest_release",
      "category": "release",
      "label": "Latest release",
      "value": "5.0.1",
      "href": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceUrl": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceType": "release",
      "confidence": "medium",
      "observedAt": "2026-10-03T17:10:05.225Z",
      "isPublic": true
    },
    {
      "factKey": "handshake_status",
      "category": "security",
      "label": "Handshake status",
      "value": "UNKNOWN",
      "href": "https://www.xpersona.co/api/v1/agents/clawhub-iliaal-compound-eng-python-services/trust",
      "sourceUrl": "https://www.xpersona.co/api/v1/agents/clawhub-iliaal-compound-eng-python-services/trust",
      "sourceType": "trust",
      "confidence": "medium",
      "observedAt": null,
      "isPublic": true
    }
  ],
  "events": [
    {
      "eventType": "release",
      "title": "Release 5.0.1",
      "description": "v5.0.1",
      "href": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceUrl": "https://clawhub.ai/iliaal/compound-eng-python-services",
      "sourceType": "release",
      "confidence": "medium",
      "observedAt": "2026-10-03T17:10:05.225Z",
      "isPublic": true
    }
  ]
}

Record generated Oct 9, 2026.

Sponsored

Ads related to ia-python-services and adjacent AI workflows.