Python Developer Interview Questions (Part 2): Multithreading, Async, FastAPI, Django and Flask
Python interview questions for 2–4 years: multithreading, multiprocessing, asyncio, FastAPI, Django, Flask and real scenarios, with code and real output.
Agentforce interview questions for Python developers (2–4 years): Apex actions, Agentforce Python SDK, Agent API, Azure AI and real scenarios, with code.
This is Part 2 of our AI Agent Developer interview series for Python developers with 2–4 years of experience. Part 1 covered core Python, FastAPI and Generative AI. Here we move to the platform side of the job: Salesforce Agentforce, the official Agentforce Python SDK, the Agent API, Python on Azure, and the scenario-based questions that decide most interviews.
Companies increasingly want their AI agents to work directly with customer data in Salesforce, while heavy processing runs in Python services on Azure. That combination is exactly what these Agentforce interview questions test: can you design the agent, write the Apex actions, connect a Python service securely, automate deployment and keep it all running in production?
| Section | Questions | What the interviewer is checking |
|---|---|---|
| Part 1 · Sections 1–3: Python, FastAPI, Generative AI | Q1–Q19 | Python and AI foundations |
| Section 4: Salesforce Agentforce for developers | Q20–Q34 | Agentforce architecture, Apex actions, Python SDK, Agent API |
| Section 5: Python on Azure | Q35–Q39 | Cloud deployment, security, monitoring |
| Section 6: Scenario-based and problem-solving | Q40–Q45 | Debugging, trade-offs, real-world judgement |
Interview Preparation Tip: Agentforce questions are rarely about definitions alone. Be ready to explain why an agent picked a topic, how an action stays secure and how you would test it. Several answers here build on Part 1 (for example tool calling in Q14 and RAG in Q15), so keep Part 1 open too.
Salesforce Agentforce is now a common requirement in job descriptions, even for Python roles, because companies want their AI agents to work directly with customer data in Salesforce. This part covers what developers are asked: architecture, Apex actions, integration with Python services, the Agentforce Python SDK and the Agent API. For admin-focused questions, see our Top 30 Salesforce Agentforce Interview Questions and the Agentforce Prompt Builder interview questions.
Short answer: Agentforce is Salesforce’s platform for building autonomous AI agents that understand requests, reason over Salesforce data and take actions. An agent is built from topics, instructions and actions, it is grounded in CRM and Data Cloud data, and it runs on top of the Einstein Trust Layer.
| Building block | What it is | Python developer’s view |
|---|---|---|
| Agent | The AI assistant: for customers (external) or employees (internal) | The whole application |
| Topic | A job the agent can do, such as “Order Support”, with a description and scope | A route or module |
| Instructions | Plain-language rules for a topic | Business rules in the prompt |
| Action | A Flow, Apex method, prompt template or API the agent can call | A tool in the tool-calling loop (Q14) |
| Atlas Reasoning Engine | Picks the topic and actions for each request | The planner / agent loop |
| Data Cloud and knowledge | Unified customer data and documents for grounding | The RAG layer |
| Einstein Trust Layer | Masking, zero data retention, toxicity checks, audit trail | Security and compliance layer |
Customer / employee (web chat, WhatsApp, Slack, Lightning page)
│
▼
┌───────────────────────────┐
│ Agentforce agent │
│ ┌─────────────────────┐ │
│ │ Atlas Reasoning │ │ 1. understand the request
│ │ Engine │ │ 2. pick a topic
│ └──────────┬──────────┘ │ 3. plan and run actions
│ Topic + instructions │
└────┬─────────┬─────────┬──┘
▼ ▼ ▼
Flow Apex Prompt template / API
│ │ │
└────┬────┴────┬────┘
▼ ▼
Salesforce data External systems (Python on Azure)
│
▼
Einstein Trust Layer (masking · zero retention · toxicity · audit)
│
▼
LLM
Short answer: Atlas reads the user’s message and the conversation, classifies it into the best-matching topic using the topic descriptions, then plans which actions to run, runs them, checks the results and either asks a follow-up question or writes the final answer.
User message
│
▼
Understand intent + conversation history
│
▼
Classify into a TOPIC ◀── topic names, descriptions, scope
│
▼
Plan ACTIONS ◀── action names, descriptions, inputs
│
▼
Run action(s) ──▶ observe results ──▶ need more? ──yes──▶ (loop)
│ │
│ no
▼ ▼
Ask a clarifying question Generate the grounded answer
This is why interviewers ask so much about descriptions: Atlas has nothing else to go on. Clear, specific, non-overlapping descriptions are the single biggest lever on agent quality.
| Choose Agentforce when… | Choose a custom Python agent when… |
|---|---|
| The data and processes live mainly in Salesforce | The data lives mainly outside Salesforce |
| You need Salesforce security (sharing rules, FLS) on every answer | You need full control over the model, prompts and orchestration |
| Admins should be able to change topics and instructions | You need a framework feature Agentforce does not offer |
| Channels such as Service Cloud, Slack and Experience Cloud matter | The agent runs inside your own product or on edge devices |
Many real projects combine both: Agentforce is the front door for Salesforce users, and heavy processing (document analysis, scoring models) runs in a Python service on Azure that an Agentforce action calls (see Q26).
Short answer: One topic per clear job, a description that says exactly what the topic covers, a scope that says what it does not cover, and short, testable instructions.
| Weak | Strong | |
|---|---|---|
| Topic name | Orders | Order Status and Delivery |
| Description | Helps with orders | Answers questions about the status, tracking and delivery date of existing orders |
| Scope | (empty) | Only existing orders. Refunds and cancellations are handled by the Refunds topic. |
| Instruction | Be helpful | If the customer has not given an order number, ask for it before calling any action. |
Rule of thumb: if two topic descriptions could both match the same customer sentence, Atlas will sometimes pick the wrong one. Rewrite until each sentence clearly belongs to one topic.
| Action type | Use it for | Example |
|---|---|---|
| Flow | Declarative logic admins can maintain | Create a case, update a field |
Apex (@InvocableMethod) | Complex logic, bulk queries, callouts | Calculate a refund, call an external API |
| Prompt template | Generating text grounded in record data | Summarise an account, draft an email |
| Standard actions | Built-in capabilities | Query records, answer questions with knowledge |
| External APIs | Systems outside Salesforce via Named Credentials, External Services or MuleSoft | Check stock in an ERP |
Short answer: Mark a static method with @InvocableMethod and describe its inputs and outputs with @InvocableVariable. The labels and descriptions are what Atlas reads, so write them like documentation. The method must be bulk-safe: it receives a list.
public with sharing class OrderStatusAction {
public class Request {
@InvocableVariable(label='Order Number' description='The customer order number, for example 00012345' required=true)
public String orderNumber;
}
public class Response {
@InvocableVariable(label='Order Status' description='Current status of the order')
public String status;
@InvocableVariable(label='Expected Delivery' description='Expected delivery date of the order')
public Date expectedDelivery;
}
@InvocableMethod(label='Get Order Status'
description='Returns the status and expected delivery date of an existing order by its order number')
public static List<Response> getStatus(List<Request> requests) {
Set<String> numbers = new Set<String>();
for (Request r : requests) {
numbers.add(r.orderNumber);
}
Map<String, Order> byNumber = new Map<String, Order>();
for (Order o : [SELECT OrderNumber, Status, EndDate FROM Order
WHERE OrderNumber IN :numbers WITH USER_MODE]) {
byNumber.put(o.OrderNumber, o);
}
List<Response> results = new List<Response>();
for (Request r : requests) {
Order o = byNumber.get(r.orderNumber);
Response res = new Response();
res.status = (o == null) ? 'Not found' : o.Status;
res.expectedDelivery = (o == null) ? null : o.EndDate;
results.add(res);
}
return results;
}
}
Points interviewers look for: with sharing and WITH USER_MODE so the agent only sees what its user may see, one SOQL query for all requests (no query inside the loop), and a clear “Not found” instead of an exception.
Short answer: Expose the Python logic as a secure REST API (for example FastAPI on Azure Container Apps), store the endpoint and authentication in a Salesforce Named Credential, and call it from an Apex invocable action. The agent then uses that Apex action like any other.
Agentforce agent
│ chooses action "Get Account Risk Score"
▼
Apex @InvocableMethod
│ callout:Risk_Service/score (Named Credential: URL + OAuth)
▼
Azure API Management / Container Apps
│
▼
FastAPI service (Python) ──▶ ML model / Azure OpenAI / database
│
▼
JSON response ──▶ Apex ──▶ Agent ──▶ grounded answer to the user
public with sharing class RiskScoreAction {
public class Request {
@InvocableVariable(label='Account Id' description='Salesforce Id of the account to score' required=true)
public Id accountId;
}
public class Response {
@InvocableVariable(label='Risk Score' description='Churn risk from 0 (low) to 100 (high)')
public Decimal riskScore;
@InvocableVariable(label='Reason' description='Short explanation of the score')
public String reason;
}
@InvocableMethod(label='Get Account Risk Score'
description='Returns a churn risk score from 0 to 100 and the main reason for an account')
public static List<Response> score(List<Request> requests) {
List<Response> results = new List<Response>();
for (Request r : requests) { // agents send one request at a time; callout limit is 100
HttpRequest req = new HttpRequest();
req.setEndpoint('callout:Risk_Service/score');
req.setMethod('POST');
req.setHeader('Content-Type', 'application/json');
req.setTimeout(10000);
req.setBody(JSON.serialize(new Map<String, Object>{ 'account_id' => r.accountId }));
Response res = new Response();
HttpResponse http = new Http().send(req);
if (http.getStatusCode() == 200) {
Map<String, Object> body = (Map<String, Object>) JSON.deserializeUntyped(http.getBody());
res.riskScore = Decimal.valueOf(String.valueOf(body.get('score')));
res.reason = (String) body.get('reason');
} else {
res.reason = 'The risk service is not available right now.';
}
results.add(res);
}
return results;
}
}
from fastapi import Depends, FastAPI
from pydantic import BaseModel, Field
app = FastAPI(title="Risk Service")
class ScoreRequest(BaseModel):
account_id: str = Field(min_length=15, max_length=18)
class ScoreResponse(BaseModel):
score: float = Field(ge=0, le=100)
reason: str
@app.post("/score", response_model=ScoreResponse, dependencies=[Depends(verify_salesforce_token)])
def score(req: ScoreRequest) -> ScoreResponse:
features = load_features(req.account_id) # usage, tickets, payments ...
value, reason = model.predict_with_reason(features)
return ScoreResponse(score=round(value, 1), reason=reason)
Mention the non-functional points: a timeout shorter than the agent’s patience, a friendly fallback message, OAuth instead of a static key, and logging the Salesforce request ID on both sides for tracing.
Short answer: Agentforce grounds answers with Salesforce data the user can access and with unstructured content such as Knowledge articles and files. Data Cloud indexes this content for semantic search, and retrievers fetch the relevant chunks at run time: the same RAG pattern as Q15, managed by the platform.
Short answer: The Einstein Trust Layer is the security layer between Agentforce and the LLM. It grounds prompts in Salesforce data that the user is allowed to see, masks sensitive data, enforces zero data retention with LLM partners, checks for toxicity and keeps an audit trail.
For a Python developer the key point is this: when your Python service calls Salesforce, you get these controls; when it calls an LLM directly (for example Azure OpenAI), you must build masking, logging and access control yourself.
Short answer: The Agentforce Python SDK (agentforce-sdk on PyPI, imported as agent_sdk) is an official Salesforce library for creating, managing and deploying Agentforce agents from Python code instead of clicking through Agent Builder. It also lets you send messages to a deployed agent.
pip install agentforce-sdk
Know the current status: the SDK’s GitHub repository (salesforce/agent-sdk) was archived by Salesforce on 2 September 2026 and is now read-only; the latest version on PyPI is 0.2.1. Mentioning this in an interview shows that you check your dependencies. For a new project, pin the version, test it in a sandbox and confirm the recommended tooling with your Salesforce team (for example the Salesforce CLI and Agentforce DX).
Short answer: The SDK provides several authentication classes in agent_sdk.core.auth. You pick one and pass it to Agentforce(auth=...). For automated pipelines, use the JWT bearer flow or client credentials, never a personal username and password.
| Class | Parameters | When to use |
|---|---|---|
BasicAuth | username, password, security_token, domain | Local experiments and sandbox demos |
ClientCredentialsAuth | consumer_key, consumer_secret, domain | Server-to-server integration with a Connected App |
JwtBearerAuth | username, consumer_key, private_key_path or private_key, domain | CI/CD pipelines (no password stored) |
DirectAuth | session_id, instance_url, domain | You already have a valid session |
import os
from agent_sdk import Agentforce
from agent_sdk.core.auth import JwtBearerAuth
auth = JwtBearerAuth(
username=os.environ["SF_USERNAME"],
consumer_key=os.environ["SF_CONSUMER_KEY"],
private_key_path=os.environ["SF_PRIVATE_KEY_PATH"],
domain="test", # "test" = sandbox, "login" = production
)
agentforce = Agentforce(auth=auth)
Credentials always come from environment variables or a secret store such as Azure Key Vault (see Q37), never from the code.
Short answer: You build the agent from Pydantic-based models (Agent, Topic, Action, Input, SystemMessage) and call agentforce.create(agent), which packages the metadata and deploys it to the org.
import os
from agent_sdk import Agentforce
from agent_sdk.core.auth import BasicAuth
from agent_sdk.exceptions import MetadataDeploymentError
from agent_sdk.models import Action, Agent, Input, SystemMessage, Topic
auth = BasicAuth(
username=os.environ["SF_USERNAME"],
password=os.environ["SF_PASSWORD"],
security_token=os.environ.get("SF_SECURITY_TOKEN"),
domain="test",
)
agentforce = Agentforce(auth=auth)
# 1. Action: what the agent can do (backed by a Flow or Apex in the org)
get_order_status = Action(
name="Get Order Status",
description="Returns the delivery status for a customer order number",
inputs=[
Input(name="order_number", description="The customer's order number",
data_type="String", required=True),
],
example_output={"status": "success", "order_status": "Shipped", "eta": "2 days"},
)
# 2. Topic: a job the agent handles, with its rules
order_support = Topic(
name="Order Support",
description="Answers questions about the status and delivery of existing orders",
scope="Only order status and delivery questions. Do not handle refunds or payments.",
instructions=[
"Ask for the order number if the customer has not provided it.",
"Never promise a delivery date that the action did not return.",
],
actions=[get_order_status],
)
# 3. Agent
agent = Agent(
name="Order Assistant",
description="Helps customers track their orders",
agent_type="External",
company_name="LearnFrenzy Retail",
sample_utterances=["Where is my order?", "Track order 12345"],
system_messages=[SystemMessage(message="You are a polite, concise order support assistant.",
msg_type="system")],
topics=[order_support],
)
try:
result = agentforce.create(agent) # packages the metadata and deploys it
print("Deployment result:", result)
except MetadataDeploymentError as err:
print("Deployment failed:", err)
Interviewers often follow up with: “What makes the agent pick the right action?” The answer is the quality of the descriptions. The reasoning engine reads the topic description, scope and action descriptions to decide what to call, so vague descriptions cause wrong routing (see Q41).
Short answer: Store the agent as a JSON file (or a directory of JSON files) in the repository, load it with AgentUtils, and let the pipeline deploy it to a sandbox, run tests and then deploy to production.
{
"name": "Order Assistant",
"description": "Helps customers track their orders",
"agent_type": "External",
"company_name": "LearnFrenzy Retail",
"sample_utterances": ["Where is my order?", "Track order 12345"],
"topics": [
{
"name": "Order Support",
"description": "Answers questions about the status and delivery of existing orders",
"scope": "Only order status and delivery questions",
"instructions": ["Ask for the order number if the customer has not provided it."],
"actions": [
{
"name": "Get Order Status",
"description": "Returns the delivery status for a customer order number",
"inputs": [
{"name": "order_number", "description": "The customer's order number",
"data_type": "String", "required": true}
]
}
]
}
]
}
from agent_sdk import Agentforce, AgentUtils
from agent_sdk.core.auth import JwtBearerAuth
agent = AgentUtils.create_agent_from_file("agents/order_assistant.json")
agentforce = Agentforce(auth=JwtBearerAuth(...)) # credentials from the pipeline's secret store
agentforce.create(agent)
Developer ──▶ Pull request (agent JSON + Apex + tests)
│
▼
CI: validate JSON · lint Python · run unit tests
│
▼
Deploy to sandbox ──▶ Run golden test conversations (<a href="/blogs/ai-agent-developer-interview-questions">Q19</a>)
│
▼
Manual approval ──▶ Deploy to production ──▶ Monitor
A typical pipeline: pull request → validate the JSON and lint the Python → deploy to a sandbox → run the golden test conversations (Q19) → manual approval → deploy to production. The SDK can also load nested or modular directory layouts (create_agent_from_directory_structure, create_agent_from_modular_files) when one big JSON file becomes hard to review.
Short answer: Use send_message() with the agent’s API name. The first call returns a session_id; pass it back on the next call so the agent remembers the conversation.
response = agentforce.send_message(
agent_name="Order_Assistant", # the agent's API name in the org
user_message="Hi, I want to track my order",
)
print("Agent:", response["agent_response"])
session_id = response["session_id"]
response = agentforce.send_message(
agent_name="Order_Assistant",
user_message="The order number is 12345",
session_id=session_id, # same conversation
)
print("Agent:", response["agent_response"], "| success:", response["is_success"])
This is very useful for automated regression tests: loop over your golden dataset, send each message and compare the answers. The SDK also offers list_agents(), get_agent_by_name() and export_agent_from_salesforce(), which is handy for pulling an agent built in Agent Builder into Git.
Follow-up: what if the SDK is not an option? Any language can talk to a deployed agent through the Agent API, a REST API. You authenticate with the OAuth client credentials flow of a Connected App (or External Client App), start a session, send messages and end the session:
import os
import uuid
import requests
MY_DOMAIN = os.environ["SF_MY_DOMAIN"] # e.g. https://learnfrenzy.my.salesforce.com
AGENT_ID = os.environ["SF_AGENT_ID"] # the agent's 18-character ID
API = "https://api.salesforce.com/einstein/ai-agent/v1"
# 1. OAuth client credentials flow
token = requests.post(f"{MY_DOMAIN}/services/oauth2/token", data={
"grant_type": "client_credentials",
"client_id": os.environ["SF_CLIENT_ID"],
"client_secret": os.environ["SF_CLIENT_SECRET"],
}, timeout=20).json()["access_token"]
headers = {"Authorization": f"Bearer {token}", "Content-Type": "application/json"}
# 2. Start a session
session = requests.post(f"{API}/agents/{AGENT_ID}/sessions", headers=headers, json={
"externalSessionKey": str(uuid.uuid4()),
"instanceConfig": {"endpoint": MY_DOMAIN},
"streamingCapabilities": {"chunkTypes": ["Text"]},
"bypassUser": True,
}, timeout=30).json()
session_id = session["sessionId"]
# 3. Send a message (sequenceId increases with every message in the session)
reply = requests.post(f"{API}/sessions/{session_id}/messages", headers=headers, json={
"message": {"sequenceId": 1, "type": "Text", "text": "Where is order 12345?"},
}, timeout=60).json()
for m in reply.get("messages", []):
print(m.get("type"), ":", m.get("message"))
# 4. End the session
requests.delete(f"{API}/sessions/{session_id}", headers={**headers, "x-session-end-reason": "UserRequest"}, timeout=20)
Check the latest Agent API reference before going live: field names and limits change between releases, and the Connected App needs the right OAuth scopes.
Short answer: Test routing and answers in bulk, give the agent the least privilege it needs, and watch real conversations after launch.
| Area | What to do |
|---|---|
| Conversation preview | In Agent Builder, check which topic and actions were chosen for each test message and why |
| Testing Center | Run batches of test utterances with the expected topic, action and outcome on every change |
| Agent user | Run the agent as a dedicated user with only the permission sets it needs |
| Data security | Sharing rules, field-level security, with sharing and WITH USER_MODE in Apex |
| Guardrails | Clear scope in topics, Trust Layer masking and toxicity checks, human handoff (escalation) for sensitive cases |
| After launch | Review conversation logs, escalation rate, failed actions and user feedback weekly |
| Concept | One-line answer |
|---|---|
| Agentforce | Agent → topics → instructions + actions, on the Einstein Trust Layer |
| Atlas Reasoning Engine | Classifies the topic, plans actions, observes results, answers |
| Topics | One job each; specific description and clear scope |
| Apex actions | @InvocableMethod, bulk-safe, WITH USER_MODE, clear descriptions |
| Python integration | Apex callout through a Named Credential to FastAPI on Azure |
| Grounding | CRM data + Data Cloud search indexes and retrievers |
| Trust Layer | Masking, zero data retention, toxicity scoring, audit trail |
| Python SDK | agentforce-sdk: Agentforce(auth=...), create(), send_message(); repo archived Sep 2026 |
| Agent API | REST: start session → send messages → end session |
| Testing | Testing Center batches + golden dataset in CI |
| Security | Dedicated agent user, least privilege, sharing rules and FLS apply |
Short answer: It depends on the traffic pattern. Event-driven, short tasks suit Azure Functions; a long-running API with streaming suits Azure Container Apps or App Service.
| Service | Good for | Watch out for |
|---|---|---|
| Azure Functions | Event-driven jobs: queue messages, document ingestion, scheduled re-indexing | Execution time limits and cold starts on the Consumption plan |
| Azure App Service | A classic web API with simple deployment | Less control over scaling than containers |
| Azure Container Apps | Containerised FastAPI agents, scale to zero, background workers | You manage the Docker image |
| Azure Kubernetes Service | Large platforms with many services and a platform team | Operational complexity |
Users / Salesforce (Apex callouts)
│
▼
Azure API Management (auth, rate limits, versioning)
│
▼
Azure Container Apps: FastAPI agent service ──▶ Azure OpenAI
│ │
│ └──────────▶ Azure AI Search (RAG)
▼
Azure Service Bus ──▶ Azure Functions (document ingestion)
│
▼
Blob Storage ──▶ re-index
Cross-cutting: Key Vault · Managed Identity · Application Insights
A common, sensible answer: “FastAPI in Azure Container Apps for the chat API, Azure Functions with a Service Bus trigger for document ingestion.”
Short answer: Use the official openai package with the AzureOpenAI client. The main difference from OpenAI is that you pass your Azure endpoint and API version, and model is the name of your deployment, not the model family.
import os
from openai import AzureOpenAI
client = AzureOpenAI(
azure_endpoint=os.environ["AZURE_OPENAI_ENDPOINT"], # https://<resource>.openai.azure.com/
api_key=os.environ["AZURE_OPENAI_API_KEY"],
api_version="2024-10-21",
)
response = client.chat.completions.create(
model="support-gpt4o-mini", # YOUR deployment name in Azure AI Foundry
messages=[
{"role": "system", "content": "You are a helpful support assistant."},
{"role": "user", "content": "Summarise our refund policy in two lines."},
],
temperature=0.2,
)
print(response.choices[0].message.content)
Interviewers like hearing why companies choose Azure OpenAI: data stays in the company’s Azure tenant and region, it works with private networking and Microsoft Entra ID, and it fits existing enterprise compliance.
Short answer: Store secrets in Azure Key Vault and let the app reach it with a Managed Identity, so there is no password in code, config files or pipelines. DefaultAzureCredential uses your developer login locally and the Managed Identity in Azure, with the same code.
from azure.identity import DefaultAzureCredential
from azure.keyvault.secrets import SecretClient
credential = DefaultAzureCredential()
vault = SecretClient(vault_url="https://learnfrenzy-kv.vault.azure.net/", credential=credential)
salesforce_key = vault.get_secret("sf-consumer-key").value
Even better: many Azure services, including Azure OpenAI, accept Entra ID tokens directly, so you can drop API keys altogether and use role-based access control.
Short answer: Store document chunks and their embeddings in Azure AI Search, use hybrid search (keyword plus vector) with the semantic ranker to find the best chunks, and send them to Azure OpenAI to generate the answer.
import os
from azure.core.credentials import AzureKeyCredential
from azure.search.documents import SearchClient
search = SearchClient(
endpoint=os.environ["AZURE_SEARCH_ENDPOINT"],
index_name="policies",
credential=AzureKeyCredential(os.environ["AZURE_SEARCH_KEY"]),
)
results = search.search(search_text="refund for damaged item", top=5)
chunks = [doc["content"] for doc in results]
# Next: build_prompt(question, chunks) from <a href="/blogs/ai-agent-developer-interview-questions">Q15</a> and call Azure OpenAI (Q28)
For a full answer, add how the index stays fresh: an Azure Function triggered when a file lands in Blob Storage chunks it, creates embeddings and updates the index.
Short answer: Send logs, traces and metrics to Application Insights (Azure Monitor) using OpenTelemetry. Track latency per step, token usage, error rates and cost, and set alerts on them.
import logging
from azure.monitor.opentelemetry import configure_azure_monitor
# Reads APPLICATIONINSIGHTS_CONNECTION_STRING from the environment
configure_azure_monitor()
logger = logging.getLogger("agent")
logger.info("llm_call", extra={"model": "support-gpt4o-mini", "tokens": 812, "latency_ms": 1430})
Beyond the usual HTTP metrics, an AI service needs its own dashboard: tokens per request, cost per day, tool failure rate, escalation rate and average conversation length.
| Concept | One-line answer |
|---|---|
| Hosting | Container Apps for the API, Functions for event-driven jobs |
| Azure OpenAI | AzureOpenAI client; model = your deployment name |
| Secrets | Key Vault + Managed Identity via DefaultAzureCredential |
| RAG on Azure | Azure AI Search hybrid + semantic ranker, then Azure OpenAI |
| Monitoring | Application Insights with OpenTelemetry; track tokens, cost, latency |
These questions decide most interviews at the 2–4 year level. There is rarely one correct answer: the interviewer wants to see a calm, structured way of thinking. Use this pattern: clarify → reproduce → isolate → fix → prevent.
Short answer: Routing errors are almost always a description problem. The reasoning engine picks topics and actions by reading their names, descriptions, scope and instructions, so overlapping or vague text confuses it.
Short answer: Compare the two environments systematically, because “works in sandbox” usually means something is different, not that the code is wrong.
Short answer: The agent must refuse, and the guarantee must come from code and platform security, not from the prompt. An instruction such as “never share other customers’ data” helps, but it can be bypassed; access checks cannot.
order.customer_id == current_user.id (Q18).Short answer: Pick one business problem, describe the architecture end to end, and explain the trade-offs. Here is a model answer you can adapt:
“A retail company gets 8,000 support chats a day and 60% are about order status, returns and invoices. We would build an Agentforce service agent for the Salesforce Service Cloud channel with three topics: Order Status, Returns and Invoices. Order status and returns use Apex actions on Salesforce data. Invoices live in the ERP, so an Apex action calls a FastAPI service on Azure Container Apps through a Named Credential. Return policies come from Knowledge articles indexed in Data Cloud. We keep a 150-question golden dataset in Git and run it in the Testing Center before every release. After launch we track resolution rate, escalations to human agents, cost per conversation and p95 latency in Application Insights and the Agentforce analytics.”
Then say what you would measure for success (for example: 40% of chats resolved without a human in three months) and what the biggest risk is (wrong answers about refunds), with your mitigation (human approval above a refund limit).
How to answer scenario questions: think aloud, ask one or two clarifying questions, start with measurement and logs, propose a fix, then say how you would stop it from happening again. Interviewers score the process more than the final answer.
| Topic | Remember this |
|---|---|
| async/await | Concurrency for I/O-bound LLM and API calls; never block the event loop |
| GIL | Hurts CPU-bound work; use processes for heavy parsing |
| Pydantic | Validate every LLM output before acting on it |
| FastAPI | Async, validation, auto docs, StreamingResponse for tokens |
| Tool calling | The model chooses a tool, your code runs it, loop with a step limit |
| RAG | Retrieve your data, then generate; fix retrieval first |
| Prompt injection | Least privilege and permission checks in code |
| Agentforce | Agent → topics → instructions + actions, on the Einstein Trust Layer |
| Agentforce Python SDK | agentforce-sdk: Agentforce(auth=...), create(), send_message(); repo archived Sep 2026 |
| Azure | Container Apps or Functions, Key Vault + Managed Identity, AI Search, App Insights |
If you remember only three things from this guide, make them these: validate everything an LLM produces before you act on it, enforce security in code and platform permissions rather than in prompts, and measure your agent with real test conversations. Those three habits answer half of the scenario questions you will meet.
AI agent development is still young, and that is good news for Python developers with 2–4 years of experience. Companies are not looking for people who have memorised every framework. They want engineers who write solid Python, understand how agents reason and call tools, keep company data safe and can debug a production problem without panic.
Work through these 45 AI Agent Developer interview questions with the code open next to you. Build a small agent with FastAPI and RAG, deploy it to Azure, then create the same agent in Agentforce with the Python SDK. After that, most interview questions will feel like describing something you have already done.
Have you faced an interesting AI agent question in a recent interview? Share it in the comments below, so we can add it to this list and help other developers prepare.
One short email when we publish something new — interview questions, Salesforce guides and career tips. No spam, unsubscribe in one click.
Python interview questions for 2–4 years: multithreading, multiprocessing, asyncio, FastAPI, Django, Flask and real scenarios, with code and real output.
Python developer interview questions for 2–4 years experience with real code and output: core Python, OOP, decorators and 15 coding problems.
AI Agent Developer interview questions with answers and code: Python, FastAPI, RAG, tool calling and Generative AI for 2–4 years of experience.
Questions, corrections or your own experience — they all help the next reader.