top of page
Search

How To Become an Agentic AI Engineer in 6 Months

1 hour ago
5 min read

My Agentic AI Engineering in 6 Months — with Practical Python & DevOps Guide




1. Python & Async Foundations

Core skills: Python, asyncio, concurrency, FastAPI, exception handling.

import asyncioasync 

def get_policy():    
await asyncio.sleep(1)  # Simulate API latency    return {"coverage": 500000}

async def get_risk():    
await asyncio.sleep(1)    return {"risk_score": 0.25}

async def main():    
policy, risk = await asyncio.gather(        get_policy(), get_risk()    )    return {"policy": policy, "risk": risk}

print(asyncio.run(main()))

Agentic system example: An underwriting agent needs policy information from one API and customer risk information from another. Instead of waiting for each request sequentially, asyncio.gather() executes both I/O operations concurrently. This reduces latency and establishes the foundation for agents that coordinate multiple tools, external services, and LLM calls. In production, add timeouts, retries, and concurrency limits.


2. LLM Fundamentals for Agents

Core skills: Model APIs, system prompts, structured output, tool calling, tokens.

from openai import OpenAI
from pydantic import BaseModel

client = OpenAI()

class RiskAssessment(BaseModel):    
risk_level: str    
explanation: str

response = client.responses.parse(    model="gpt-4.1",    input=[        {"role": "system",         "content": "Analyze insurance risk."},        {"role": "user",         "content": "Applicant age 45, nonsmoker."}    ],    text_format=RiskAssessment)

print(response.output_parsed)

Agentic system example: The underwriting agent uses an LLM to interpret applicant information and produce a structured risk assessment. Pydantic enforces the response schema so downstream components can consume predictable fields rather than parsing free-form text. The assessment is preliminary: an actual underwriting decision must also use validated risk models, business rules, and appropriate human review.


3. Tool Calling & Structured Outputs

Core skills: Function calling, Pydantic, tool schemas, validation.

from langchain_core.tools import tool

@tool
def calculate_risk(age: int, smoker: bool) -> dict:    
"""Calculate a simplified applicant risk score."""    

score = 0.2 + (0.3 if smoker else 0)    
score += 0.1 if age > 60 else 0    
return {"risk_score": round(score, 2)}
# Agent can invoke this registered tool

result = calculate_risk.invoke({    "age": 45,    "smoker": False})
print(result)

Agentic system example: The underwriting agent determines when it needs a risk calculation and invokes the appropriate Python tool. The tool returns structured data that the agent can incorporate into its reasoning. Unlike a traditional chatbot that might invent a risk score, the agent obtains a deterministic result from an authorized function. The formula here is illustrative, not a validated insurance risk model.


4. Memory & State Management

Core skills: LangGraph state, checkpoints, Redis, vector databases, session persistence.

from langgraph.graph import StateGraph, END
from typing import TypedDictclass 

AgentState(TypedDict):    
applicant_id: str    
risk_score: floatdef 

assess(state: AgentState):    

return {"risk_score": 0.25}

graph = StateGraph(AgentState)
graph.add_node("assess", assess)
graph.set_entry_point("assess")
graph.add_edge("assess", END)agent = graph.compile()

print(agent.invoke({"applicant_id": "A123",                    "risk_score": 0.0}))

Agentic system example: The underwriting agent maintains a structured state containing the applicant ID and risk score. As the workflow executes, each node reads and updates this state. In production, LangGraph checkpointing can persist execution history in a database, allowing interrupted underwriting cases to resume without restarting. Long-term knowledge retrieval can be handled separately through a vector database.


5. Single Agent Workflows

Core skills: ReAct, planning, tool execution, iterative reasoning, loop limits.

from langgraph.prebuilt import create_react_agent
from langchain_openai import 

ChatOpenAImodel = ChatOpenAI(model="gpt-4.1")

agent = create_react_agent(    model=model,    tools=[calculate_risk])

result = agent.invoke(    {"messages": [        ("user", "Calculate risk for a "         "45-year-old nonsmoker.")    ]},    config={"recursion_limit": 10})

print(result["messages"][-1].content)

Agentic system example: A single underwriting agent receives a goal, reasons about whether it needs external information, invokes the risk calculation tool, observes the result, and generates its assessment. The ReAct pattern enables repeated reasoning and action until the task is complete. A recursion limit prevents uncontrolled execution, while production implementations should additionally enforce tool-call budgets and timeouts.


6. Multi-Agent Orchestration

Core skills: LangGraph, supervisor patterns, agent handoffs, shared state.

from langgraph.graph import StateGraph, END

from typing import TypedDictclass 

State(TypedDict):    
documents_verified: bool    
risk_score: float

def document_agent(s):    

return {"documents_verified": True}def risk_agent(s):    

return {"risk_score": 0.25}workflow = StateGraph(State)

workflow.add_node("documents", document_agent)

workflow.add_node("risk", risk_agent)

workflow.set_entry_point("documents")workflow.add_edge("documents", "risk")

workflow.add_edge("risk", END)app = workflow.compile()

Agentic system example: An underwriting workflow coordinates specialized components: a document verification agent checks applicant records, while a risk agent evaluates the applicant. LangGraph orchestrates the handoff and shares the results through state. This example uses a fixed sequence; a more sophisticated supervisor agent could dynamically route tasks, request missing information, and reconcile disagreements between specialized agents.


7. Human-in-the-Loop Systems

Core skills: Approval gates, workflow interrupts, human decisions, auditability.

from langgraph.types import interrupt

def approval_node(state):    
decision = interrupt({        "applicant_id": state["applicant_id"],        "risk_score": state["risk_score"],        "action": "Request underwriter approval"    })    

return {"approved": decision["approved"]}

Agentic system example: Before an underwriting agent issues a consequential decision, the workflow pauses and requests approval from a human underwriter. LangGraph's interrupt() enables this pause, and a persistent checkpointer allows the execution to resume after an authorized reviewer submits a decision. The production system must also authenticate the reviewer, verify permissions, and record the approval in an audit log.


8. Evaluation & Quality Assurance

Core skills: Pytest, regression tests, evaluation datasets, LLM-as-judge.

def test_risk_calculation():    
result = calculate_risk.invoke({        "age": 45,        "smoker": False    })    assert result["risk_score"] == 0.2

def test_smoker_risk():    
result = calculate_risk.invoke({        "age": 45,        "smoker": True    })    assert result["risk_score"] == 0.5

Agentic system example: Every change to the underwriting agent should be tested against known scenarios. Deterministic unit tests validate individual tools, while end-to-end evaluations measure whether the agent selects appropriate tools, follows underwriting rules, and produces grounded assessments. For nondeterministic LLM behavior, use a labeled evaluation dataset and potentially an LLM judge, with human calibration for important decisions.


9. Observability & Tracing

Core skills: LangSmith, OpenTelemetry, latency monitoring, cost tracking.

import osos.environ

["LANGSMITH_TRACING"] = "true"os.environ

["LANGSMITH_PROJECT"] = "underwriting-agent"
# Configure LANGSMITH_API_KEY securely# before executing the agent.result = agent.invoke({    "messages": [        ("user", "Assess applicant age 45.")    ]})

Agentic system example: When an underwriting agent produces an unexpected assessment, observability helps engineers trace the sequence of LLM calls, tool executions, and intermediate outputs. LangSmith can capture execution traces and latency information, while additional instrumentation can track token costs, failures, and throughput. Sensitive applicant information should be redacted or excluded from traces according to the organization's data policies.


10. Security & Guardrails

Core skills: Input validation, PII protection, prompt injection defense, authorization.

from pydantic import BaseModel, Fieldclass 

ApplicantInput(BaseModel):    applicant_id: str = Field(        pattern=r"^[A-Z][0-9]{3,8}$"    )    age: int = Field(ge=18, le=100)def authorize(user, applicant):    
if applicant.id not in user.allowed_cases:        raise PermissionError("Access denied")    
return True

Agentic system example: The underwriting agent must validate incoming data and enforce permissions before accessing applicant records or executing sensitive tools. Pydantic prevents malformed inputs, while authorization logic restricts the agent to cases the requesting user may access. These controls complement prompt-injection defenses, tool allowlists, PII redaction, and sandboxing; input validation alone cannot prevent an LLM from following malicious instructions embedded in documents.


11. Production Deployment

Core skills: Docker, FastAPI, Kubernetes, CI/CD, autoscaling, rollback.

Dockerfile


FROM python:3.12-slim

WORKDIR /app

COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

USER 10001

EXPOSE 8000

CMD ["uvicorn", "main:app",
     "--host", "0.0.0.0",
     "--port", "8000"]

Kubernetes deployment excerpt


apiVersion: apps/v1
kind: Deployment
metadata:
  name: underwriting-agent
spec:
  replicas: 3
  selector:
    matchLabels:
      app: underwriting-agent
  template:
    metadata:
      labels:
        app: underwriting-agent
    spec:
      containers:
        - name: agent
          image: registry.example.com/agent:v1
          ports:
            - containerPort: 8000

Agentic system example: The underwriting agent is packaged as a Docker container exposing a FastAPI endpoint. Kubernetes manages multiple replicas, providing the foundation for scaling and rolling deployments. A production deployment additionally needs health probes, resource limits, secrets management, network policies, persistent state, CI/CD pipelines, and rollback procedures. For self-hosted LLMs, vLLM or SGLang can serve models as separate inference services.


12. Open Source & Portfolio

Core skills: Git, GitHub, documentation, architecture diagrams, automated testing.


# Initialize the project
git init

# Install application dependencies
pip install -r requirements.txt

# Run automated tests
pytest tests/

# Build the Docker image
docker build -t underwriting-agent:v1 .

# Commit the implementation
git add .
git commit -m "Build underwriting agent MVP"

Agentic system example: Publish a working demonstration of the underwriting agent with its source code, architecture documentation, example API requests, test cases, and deployment instructions. Use synthetic applicant data rather than real insurance records. A strong engineering portfolio demonstrates not just a successful agent run, but also how the system handles invalid inputs, tool failures, approval checkpoints, security constraints, and production monitoring.


How the 12 sections fit together

Conceptual architecture of the complete underwriting agent platform. The layers interact bidirectionally in a real deployment.



 
 
 

Comments


©2020 by Arturo Devesa.

bottom of page