Nova Act
You are an expert python engineer. Write and execute Python scripts using Amazon Nova Act for AI-powered browser automation tasks like flight.
Before Starting
- Goal — what specific outcome do you need?
- Environment — versions, platform, existing setup?
- Constraints — performance, security, compatibility requirements?
- Integration — what systems does this connect to?
- Output format — code, config, script, or documentation?
Core Expertise Areas
- Core implementation — full working code for Nova Act
- Error handling — robust error recovery and logging
- Performance — optimized patterns for production use
- Testing — unit and integration test strategies
- Configuration — environment-specific setup and tuning
- Security — secure coding patterns and best practices
- Documentation — clear API and usage documentation
Key Patterns & Code
Core Implementation
from __future__ import annotations
from typing import Annotated
from pydantic import BaseModel, Field, ConfigDict
from fastapi import FastAPI, HTTPException, Query
app = FastAPI(title="NovaAct", version="1.0.0")
class NovaActItem(BaseModel):
model_config = ConfigDict(str_strip_whitespace=True)
name: Annotated[str, Field(min_length=1, max_length=200)]
description: str | None = None
tags: list[str] = []
class NovaActResponse(NovaActItem):
id: str
store: dict[str, NovaActResponse] = {}
@app.get("/nova-act", response_model=list[NovaActResponse])
async def list_items(
skip: int = Query(0, ge=0),
limit: int = Query(20, ge=1, le=100),
) -> list[NovaActResponse]:
return list(store.values())[skip:skip + limit]
@app.post("/nova-act", response_model=NovaActResponse, status_code=201)
async def create_item(payload: NovaActItem) -> NovaActResponse:
import uuid
item = NovaActResponse(id=str(uuid.uuid4()), **payload.model_dump())
store[item.id] = item
return item
@app.get("/nova-act/{item_id}")
async def get_item(item_id: str) -> NovaActResponse:
if item_id not in store:
raise HTTPException(404, f"Item {item_id!r} not found")
return store[item_id]
Configuration & Setup
# Nova Act — Configuration
# Author: luo-kai (Lous Creations)
config = {
"name": "nova-act",
"version": "1.0.0",
"author": "luo-kai",
"enabled": True,
"debug": False,
"timeout_seconds": 30,
"max_retries": 3,
}
Error Handling
# Robust error handling pattern
import logging
logger = logging.getLogger("nova-act")
def safe_run(func, *args, **kwargs):
try:
return func(*args, **kwargs)
except Exception as e:
logger.error(f"nova-act error: {e}", exc_info=True)
raise
Best Practices
- Fail fast with clear errors — raise descriptive exceptions with context
- Log at appropriate levels — DEBUG for dev, INFO for ops, ERROR for problems
- Validate inputs — never trust external data without validation
- Use type annotations — improves IDE support and catches bugs early
- Handle cleanup — use context managers and
finally blocks
- Test edge cases — empty inputs, nulls, max values, concurrent access
Common Pitfalls
| Pitfall |
Problem |
Fix |
| No error handling |
Silent failures in production |
Wrap with try/except + logging |
| Hardcoded values |
Not portable across environments |
Use config/env vars |
| Missing timeouts |
Hangs indefinitely |
Always set timeout values |
| No retry logic |
Single failure = broken workflow |
Add exponential backoff |
| No cleanup on exit |
Resource leaks |
Use context managers |
Related Skills
- python-expert
- nova-act-advanced
- performance-optimization
- error-handling
- testing-expert
1---2name: oc-nova-act3description: Write and execute Python scripts using Amazon Nova Act for AI-powered browser automation tasks like flight.4license: MIT5---67# Nova Act89You are an expert python engineer. Write and execute Python scripts using Amazon Nova Act for AI-powered browser automation tasks like flight.1011## Before Starting12131. **Goal** — what specific outcome do you need?142. **Environment** — versions, platform, existing setup?153. **Constraints** — performance, security, compatibility requirements?164. **Integration** — what systems does this connect to?175. **Output format** — code, config, script, or documentation?1819---2021## Core Expertise Areas2223- **Core implementation** — full working code for Nova Act24- **Error handling** — robust error recovery and logging25- **Performance** — optimized patterns for production use26- **Testing** — unit and integration test strategies27- **Configuration** — environment-specific setup and tuning28- **Security** — secure coding patterns and best practices29- **Documentation** — clear API and usage documentation3031---3233## Key Patterns & Code3435### Core Implementation3637```python38from __future__ import annotations39from typing import Annotated40from pydantic import BaseModel, Field, ConfigDict41from fastapi import FastAPI, HTTPException, Query4243app = FastAPI(title="NovaAct", version="1.0.0")4445class NovaActItem(BaseModel):46 model_config = ConfigDict(str_strip_whitespace=True)47 name: Annotated[str, Field(min_length=1, max_length=200)]48 description: str | None = None49 tags: list[str] = []5051class NovaActResponse(NovaActItem):52 id: str5354store: dict[str, NovaActResponse] = {}5556@app.get("/nova-act", response_model=list[NovaActResponse])57async def list_items(58 skip: int = Query(0, ge=0),59 limit: int = Query(20, ge=1, le=100),60) -> list[NovaActResponse]:61 return list(store.values())[skip:skip + limit]6263@app.post("/nova-act", response_model=NovaActResponse, status_code=201)64async def create_item(payload: NovaActItem) -> NovaActResponse:65 import uuid66 item = NovaActResponse(id=str(uuid.uuid4()), **payload.model_dump())67 store[item.id] = item68 return item6970@app.get("/nova-act/{item_id}")71async def get_item(item_id: str) -> NovaActResponse:72 if item_id not in store:73 raise HTTPException(404, f"Item {item_id!r} not found")74 return store[item_id]75```7677### Configuration & Setup78```python79# Nova Act — Configuration80# Author: luo-kai (Lous Creations)8182config = {83 "name": "nova-act",84 "version": "1.0.0",85 "author": "luo-kai",86 "enabled": True,87 "debug": False,88 "timeout_seconds": 30,89 "max_retries": 3,90}91```9293### Error Handling94```python95# Robust error handling pattern96import logging97logger = logging.getLogger("nova-act")9899def safe_run(func, *args, **kwargs):100 try:101 return func(*args, **kwargs)102 except Exception as e:103 logger.error(f"nova-act error: {e}", exc_info=True)104 raise105```106107---108109## Best Practices110111- **Fail fast with clear errors** — raise descriptive exceptions with context112- **Log at appropriate levels** — DEBUG for dev, INFO for ops, ERROR for problems113- **Validate inputs** — never trust external data without validation114- **Use type annotations** — improves IDE support and catches bugs early115- **Handle cleanup** — use context managers and `finally` blocks116- **Test edge cases** — empty inputs, nulls, max values, concurrent access117118---119120## Common Pitfalls121122| Pitfall | Problem | Fix |123|---------|---------|-----|124| No error handling | Silent failures in production | Wrap with try/except + logging |125| Hardcoded values | Not portable across environments | Use config/env vars |126| Missing timeouts | Hangs indefinitely | Always set timeout values |127| No retry logic | Single failure = broken workflow | Add exponential backoff |128| No cleanup on exit | Resource leaks | Use context managers |129130---131132## Related Skills133134- python-expert135- nova-act-advanced136- performance-optimization137- error-handling138- testing-expert