Seu agente IA tem spec? Ou está voando no escuro?
OpenSpec: Framework pra AI specs (formal). Seu agente: tem spec escrito? Ou você pensa "prompt = spec"? Spec = novo obrigatório.
Equipe OpenClaw · Time de Engenharia & Produto
A Equipe OpenClaw é formada por engenheiros, designers e especialistas em IA dedicados a construir a melhor plataforma de agentes conversacionais para negócios brasileiros. Combinamos expertise…
Seu agente IA tem spec? Ou está voando no escuro?
Você é founder de SaaS.
Seu agente de IA:
- Atende clientes (WhatsApp, chat, API)
- Você pergunta: "O que agente deve fazer?"
- Resposta: "Responder perguntas de clientes"
- Your assumption: "OK, pedi pro LLM fazer isso. Spec = done."
- Reality: Você NÃO tem spec (just hope)
- Agora customer reclama: "Seu agente deu resposta errada"
- You investigate: "Por quê? Agente foi treinado pra fazer certo!"
- Real answer: "Você não definiu formally o que 'certo' significa"
- Bigger problem: "Agente está quebrado, você não sabe onde"
- Your question: "Como debugar agente sem spec?"
- Real answer: "Você não consegue. Blind spot total."
- Solution: "Formalizar spec (OpenSpec framework)"
Seu problema AGORA:
- OpenSpec (framework novo) publicou: "AI specs são obrigatórias"
- What it does: Estrutura formal pra definir o que agente deve fazer
- Finding: "Sem spec formal, agentes são unreliable (você não controla)"
- Implication: "Competitor com AI spec formal > você sem spec"
- Your realization: "Meu agente não tem spec. Está voando blind."
- Bigger problem: "Não posso debugar. Não posso validar. Não posso garantir qualidade."
- Timeline: "Spec design = 2-4 semanas (não é rápido)"
- Your opportunity: "Implementar AI spec (antes de issue crítica)"
O que OpenSpec está sinalizando:
"AI agents without formal specification are unreliable, undebuggable, and unmaintainable. You think your prompt is a spec. It's not. Spec is formal: What are the inputs? What are the valid outputs? What are error cases? What are constraints? Without formal spec, your agent behavior is undefined, debugging is impossible, compliance is unverifiable. OpenSpec provides lightweight framework to define AI specs. This is becoming table-stakes, not optional."
O problema: AI agents sem spec (invisível até falha)
Por que spec é diferente de prompt
=== SCENARIO: Seu SaaS de atendimento ao cliente ===
Your current setup (typical): ├─ Agente: Claude 3.5 Sonnet ├─ Prompt: "You are a customer support agent. Answer questions helpfully." ├─ Context: Customer message ├─ Output: Response (hopefully good) ├─ Your assumption: "Prompt = spec. Agent knows o que fazer." └─ Reality: "Prompt é vago. Agente improvisa (qualidade indefinida)."
=== WHAT IS A SPEC? ===
Spec = Formal definition of behavior ├─ Includes: │ ├─ Input schema (what data comes in?) │ ├─ Output schema (what data goes out?) │ ├─ Valid outputs (what's acceptable?) │ ├─ Invalid outputs (what's NOT acceptable?) │ ├─ Constraints (rules to follow) │ ├─ Edge cases (how to handle errors?) │ ├─ Performance requirements (latency, accuracy) │ ├─ Compliance requirements (LGPD, accuracy, fairness) │ └─ Examples (what correct output looks like) ├─ Spec is NOT the prompt (prompt is how you ask agent) ├─ Spec is NOT the model (model is the tool) ├─ Spec IS the formal agreement (what agent MUST do) └─ Result: Testable, debuggable, verifiable
=== EXAMPLE: Support Agent WITHOUT spec vs WITH spec ===
Scenario A: No formal spec (current) ├─ Prompt: "Answer customer support questions" ├─ Customer: "Can I get a refund?" ├─ Agent response A1: "Yes, you can get a refund. Here's how..." │ └─ Is this correct? Unknown (no spec to check against) ├─ Different customer: "Can I get a refund?" ├─ Agent response A2: "Refunds are not available. Sorry!" │ └─ Wait, this contradicts A1. Which is correct? Unknown (no spec) ├─ Your investigation: "Why different responses to same question?" ├─ Reality: "No spec = behavior undefined = different outputs OK" ├─ Customer complaint: "Your agent gave me conflicting info!" ├─ Cost: Manual review + re-train agenti (4-8 hours) ├─ Root cause: "No formal spec = no consistency check" └─ Impact: FAILURE (unreliable agent)
Scenario B: Formal spec (with OpenSpec) ├─ Spec input: Customer asks about refund ├─ Spec output schema: │ ├─ response_type: "answer" | "escalate" (only 2 valid options) │ ├─ valid_conditions: [ │ │ ├─ "order_created <= 30_days_ago", │ │ ├─ "customer_has_no_previous_refund", │ │ └─ "order_not_shipped" │ ├─ if_all_met: return "Yes, refund available. Here's process..." │ ├─ if_not_met: return "Refund not available. Escalating to human." │ └─ no_other_responses_allowed (strict) ├─ Validation: Every agent output checked against spec ├─ Customer A: "Can I get refund?" (meets conditions) │ └─ Agent output: "Yes, refund available" (matches spec) ├─ Customer B: "Can I get refund?" (does NOT meet conditions) │ └─ Agent output: "Escalating to human" (matches spec) ├─ Result: CONSISTENT (both outputs align with spec) ├─ Debugging: "If output doesn't match spec, we know agent failed" ├─ Cost: Zero (output validated automatically) └─ Impact: SUCCESS (reliable, debuggable agent)
Por que spec é crítico (agora)
5 razões pra formalizar AI specs
1. Debugging é impossível sem spec
Scenario: Agent behavior is wrong
Without spec: ├─ Customer: "Agent gave me wrong answer" ├─ You investigate: "Show me the response" ├─ Customer: "Agent said refund policy is 60 days. But website says 30." ├─ You check: "Hmm, our prompt says 'generous refund policy'. Vague." ├─ Investigation: "Which is correct? 30 or 60?" ├─ Problem: "No spec to check against. Both could be 'correct' per prompt." ├─ Fix: "Re-prompt agent (hope it works)? But how do you know if fixed?" ├─ Result: Blind debugging (you don't know if you fixed it) └─ Time cost: 4-8 hours per incident
With spec: ├─ Customer: "Agent gave me wrong answer" ├─ You check spec: "Refund policy output must be exactly: 'Refunds within 30 days'" ├─ You check agent output: "Agent said '60 days'" ├─ Conclusion: "Agent violated spec. Output is WRONG." ├─ Root cause: "Check agent reasoning logs. Find why it deviated." ├─ Fix: "Enforce spec validation. If output != spec, reject + retry." ├─ Verification: "Re-run same input. Output now matches spec. Fixed." ├─ Result: Systematic debugging (you know exactly what's wrong) └─ Time cost: <30 minutes per incident
2. Testing is impossible without spec
Scenario: How do you know if agent works?
Without spec: ├─ You test agent: "Does it answer questions? Yes." ├─ Testing criteria: Vague ("seems good") ├─ Success rate: Unknown (no clear definition of success) ├─ Regression: Unknown (if you change prompt, did you break something?) ├─ Metric: "Customer satisfaction" (3 month lag to know if broken) ├─ Problem: Can't test (no spec = no pass/fail criteria) └─ Result: Ship broken agent to production
With spec: ├─ You test agent: "Does output match spec?" ├─ Testing criteria: Explicit │ ├─ Input: "Can I get a refund?" │ ├─ Expected output: "Yes/No" (per spec) │ ├─ Agent output: "Yes" (if customer meets conditions) │ └─ Pass: Output matches spec. GOOD. ├─ Success rate: 95/100 test cases pass. Clear metric. ├─ Regression: Changed prompt. Re-run tests. 87/100 pass (regression!). Fix it. ├─ Metric: "% of outputs matching spec" (real-time, not 3 months) ├─ Problem: Can test systematically (spec = pass/fail criteria) └─ Result: Ship reliable agent to production
3. Compliance is unverifiable without spec
Scenario: Is your agent LGPD-compliant?
Without spec: ├─ You claim: "Our agent respects customer privacy" ├─ Auditor asks: "Prove it. What's your privacy spec?" ├─ You respond: "Uh... we have a prompt saying 'be respectful'?" ├─ Auditor: "That's not a spec. How do you verify compliance?" ├─ You: "We... review outputs manually?" ├─ Auditor: "How many outputs do you review? All? Random sample?" ├─ You: "Random sample. Maybe 1%?" ├─ Auditor: "1% is not compliance verification. You have no proof." ├─ Result: FAIL (no formal compliance verification) ├─ Risk: LGPD fine if you violate privacy (R$ 50K-500K) └─ Cost: Liability, fines, reputation damage
With spec: ├─ You claim: "Our agent respects customer privacy" ├─ Spec defines: "Agent must not ask for SSN, bank info, passwords. Ever." ├─ Auditor asks: "How do you enforce this spec?" ├─ You respond: "Every agent output is validated against this spec." │ ├─ If agent tries to ask for SSN: │ ├─ Validation layer detects violation │ ├─ Output is blocked (rejected) │ ├─ Agent tries again (within spec) │ └─ Result: Zero violations ├─ Auditor: "Show me the logs" ├─ You: "100% of outputs validated. Zero violations in 3 months." ├─ Auditor: "This is proof of compliance. PASS." └─ Result: PASS (formal compliance verification)
4. Maintenance is nightmare without spec
Scenario: Update agent prompt (next quarter)
Without spec: ├─ You update prompt: "Be more casual in tone" ├─ Agent behavior changes (tone is now casual) ├─ But also: Some outputs are now TOO casual (not professional) ├─ Discovery: "Customer complained. Agent was rude." ├─ Investigation: "Why did tone change?" ├─ Reality: "You changed prompt. Didn't expect side effects." ├─ Fix: "Revert prompt? Or retrain?" ├─ Problem: "No spec to check. Don't know what's 'correct'." ├─ Result: Chaotic updates (each change is risky) └─ Cost: 4-8 hours per update + unexpected breaks
With spec: ├─ You update prompt: "Be more casual in tone" ├─ Before change: Run spec tests (baseline). 95% pass. ├─ After change: Run spec tests. 87% pass (regression!). ├─ Analysis: "Tone change broke 8% of outputs (spec violations)." ├─ Decision: "Revert change. Need to update spec first (allow casual tone)." ├─ Proper process: │ ├─ Update spec: "Allow casual tone (but stay professional)" │ ├─ Update prompt: "Be more casual in tone" │ ├─ Run spec tests again: 94% pass (acceptable, small regression) │ ├─ Investigate failing 6%: "These cases need human + agent combo" │ ├─ Update spec: "For complex cases, escalate to human" │ ├─ Run tests: 98% pass. Deploy. ├─ Result: Controlled change (spec prevents regressions) └─ Cost: 2-3 hours per update (vs 4-8 blind)
5. Scaling is unpredictable without spec
Scenario: Agent works for 1,000 users. Now deploying to 1M users.
Without spec: ├─ Agent works fine at 1K scale: "95% customer satisfaction" ├─ Scale to 1M: Customer satisfaction drops to 60% ├─ Investigation: "Why? Same agent!" ├─ Reality: "LLM behavior varies under load. No spec enforcement." ├─ Problem: "At 1M scale, 5% bad outputs = 50,000 unhappy customers" ├─ Fix: "Unclear. Might be prompt, might be load, might be model." ├─ Cost: Lost customers, reputation damage └─ Result: Unpredictable at scale
With spec: ├─ Agent works fine at 1K scale: "95% compliance (output matches spec)" ├─ Scale to 1M: Run compliance checks │ ├─ 1M outputs validated against spec │ ├─ Compliance: 94% (slight drop, expected) │ ├─ Violations: 60K outputs don't match spec (out of 1M) │ ├─ Analysis: "Load is causing model to hallucinate outside spec" │ ├─ Fix: "Add strict output validation. Force compliance." │ ├─ Re-run: 99.5% compliance (violations blocked) ├─ Result: Predictable, controlled scaling └─ Cost: Planned, preventable
Como criar AI spec (OpenSpec framework)
4-step framework pra estruturar AI specs
Step 1: Define input schema (o que vem?)
Example: Customer support agent
Input spec: ├─ customer_message: string (required) │ ├─ Max length: 1000 characters │ ├─ Min length: 1 character │ └─ Examples: "Can I get a refund?", "How do I reset password?" ├─ customer_id: string (required) │ ├─ Format: UUID or email │ └─ Example: "john@example.com" ├─ account_status: enum (required) │ ├─ Valid values: ["active", "suspended", "banned"] │ └─ Example: "active" ├─ customer_history: list of previous orders (optional) │ ├─ Attributes: [order_id, amount, date, status] │ └─ Example: [{"order_id": "O123", "amount": 500, "date": "2024-09-01", "status": "shipped"}] └─ Instruction: "Answer customer question based on context"
This is input schema = what agent receives (formalized)
Step 2: Define output schema (o que sai?)
Example: Customer support agent
Output spec: ├─ response_type: enum (required) │ ├─ Valid values: ["direct_answer", "escalate_to_human", "clarification_needed"] │ └─ Description: "Type of response agent should give" ├─ message: string (required) │ ├─ Max length: 500 characters │ ├─ Min length: 10 characters │ └─ Must NOT contain: [SSN, credit card, passwords] ├─ confidence: float (required) │ ├─ Range: 0.0 to 1.0 │ └─ Description: "How confident is agent in response?" ├─ escalation_reason: string (conditional) │ ├─ Required if: response_type == "escalate_to_human" │ ├─ Max length: 200 characters │ └─ Valid reasons: ["payment_issue", "complex_query", "policy_exception"] └─ metadata: object (optional) ├─ processing_time_ms: int ├─ model_used: string └─ tokens_used: int
This is output schema = what agent returns (formalized)
Step 3: Define constraints (regras)
Example: Customer support agent
Constraints (HARD LIMITS): ├─ Safety constraints: │ ├─ MUST NOT ask for: [SSN, credit card, password, bank account] │ ├─ MUST NOT make promises agent can't keep: ["money back guarantee", "free shipping", "same-day delivery"] │ ├─ MUST NOT escalate to human for: ["pricing questions", "opening hours", "FAQ topics"] │ └─ MUST escalate for: ["refund requests >R$1000", "complaints", "legal issues"] ├─ Business constraints: │ ├─ Refund policy: Only within 30 days, conditions: [no_previous_refund, order_not_damaged] │ ├─ Response time: <2 seconds (latency) │ ├─ Availability: 24/7 (reliability) │ └─ Accuracy: >95% (quality) ├─ Compliance constraints: │ ├─ LGPD: No PII in logs (only anonymized data) │ ├─ Accuracy: Information must match website (refund policy, hours, pricing) │ └─ Fairness: No discrimination based on: [gender, race, age, nationality] └─ Language constraints: ├─ Must respond in: Portuguese (customer language) ├─ Tone: Professional but friendly └─ Complexity: Avoid jargon (clear to non-technical users)
This is constraints = what agent MUST follow (no exceptions)
Step 4: Define validation logic (como checar?)
Example: Customer support agent
Validation (how to check if output matches spec): ├─ Step 1: Check output schema │ ├─ Is response_type one of: ["direct_answer", "escalate_to_human", "clarification_needed"]? │ ├─ If NO → INVALID (output doesn't match schema) │ ├─ Is message between 10-500 chars? │ ├─ If NO → INVALID │ ├─ Is confidence between 0.0-1.0? │ └─ If NO → INVALID ├─ Step 2: Check constraints │ ├─ Does message contain [SSN, credit card, password]? │ ├─ If YES → INVALID (violates safety constraint) │ ├─ If response_type == "escalate_to_human", is escalation_reason valid? │ ├─ If NO → INVALID (missing required field) │ ├─ Does message match our refund policy (30 days)? │ └─ If NO → INVALID (violates business constraint) ├─ Step 3: Check business rules │ ├─ Is information accurate? (matches website) │ ├─ If NO → INVALID (violates compliance) │ ├─ Is response in Portuguese? │ └─ If NO → INVALID (violates language constraint) ├─ Step 4: Overall validation │ ├─ If all checks PASS → Output is VALID ✓ │ ├─ If any check FAILS → Output is INVALID ✗ │ └─ Action if INVALID: Reject output, retry agent, or escalate to human └─ Validation is AUTOMATIC (no manual review needed)
This is validation logic = how to verify agent follows spec
Conclusão: AI spec é agora necessário
O que OpenSpec está sinalizando:
-
Formal specs are table-stakes (não opcional)
- You think: "Prompt = spec. Agent knows o que fazer."
- Reality: "Prompt é vago. Spec é formal. Precisa ambos."
- Implication: "Sem spec formal, agente é unreliable."
-
Debugging without spec is blind (impossível)
- You think: "Customer reclamou. Debugo agent."
- Reality: "Sem spec, não sabe o que 'correto' significa. Debugging blind."
- Implication: "Spec = debugging map. Sem spec = lost in forest."
-
Testing without spec is meaningless (não é testing)
- You think: "Testei agent. Funciona."
- Reality: "Testei contra o quê? Sem spec, 'funciona' é indefinido."
- Implication: "Spec = criteria de sucesso. Sem spec = sem standard."
-
Compliance without spec is unverifiable (risco legal)
- You think: "Agent respeita privacidade."
- Reality: "Sem spec formal, como prova? Auditor dirá: 'Não é prova'."
- Implication: "Spec = audit trail. Sem spec = liability."
-
Scaling without spec is unpredictable (risky)
- You think: "Agent works em 1K users. Scale to 1M?"
- Reality: "Behavior muda com escala. Sem spec, você não vê até quebrar."
- Implication: "Spec = predictability. Sem spec = surprise failures at scale."
Seu checklist (faça esta semana):
- Seu agente tem spec formal? (input + output + constraints + validation)
- Você pode debugar problemas? (spec = debug map)
- Você pode testar agente? (spec = pass/fail criteria)
- Você pode provar compliance? (spec = audit trail)
- Você pode escalar previsível? (spec = predictable behavior)
Se respondeu NÃO a qualquer um, seu agente NÃO tem spec.
Na OpenClaw:
Ajudamos SaaS builders a criar formal AI specs (usando OpenSpec framework):
- Spec design: Como estruturar input + output + constraints? (framework)
- Validation layer: Como implementar automatic validation? (code)
- Testing: Como testar agente contra spec? (CI/CD)
- Debugging: Como diagnosticar spec violations? (tools)
- Compliance: Como provar compliance via spec? (audit)
- Scaling: Como escalar com spec (predictível)? (operations)
Você pode continuar sem spec (e descobrir problemas em produção).
Ou você pode implementar AI spec AGORA (em 2-4 semanas) e estar 100% prepared.
Formal AI Specifications | OpenSpec Framework | Agent Reliability & Compliance →
Publicado em 17 de setembro de 2026