AI Agent Development: A Practical Guide to Knowledge Bases and Skill Orchestration
This guide explains how AI agents differ from conversational AI, and walks through building production-ready agents with retrieval-augmented knowledge bases and reusable skills. It covers chunking and hybrid retrieval strategies, citation and refusal behavior, a "thin planner, thick skills" orchestration pattern, deployment form factors, and the acceptance and operations checklists needed to keep agents reliable in real business workflows.
1. Setting the Boundaries: What an Agent Can Actually Do
1.1 How Agents Differ from Conversational AI
Conversational AI is essentially a single-turn text mapping: one input, one output. It is good at expression and summarization, but it does not naturally possess state, tools, or execution authority. Agents differ in three ways:
- Persistent task state: an agent can break a goal into a multi-step plan and retain context along the way.
- Tool-calling capability: it can read and write external systems, run computations, and retrieve private data.
- Closed-loop feedback: it decides whether to retry, switch paths, or converge based on execution results.
The difference is easier to see in pseudocode:
# Conversational AI: single-turn mappinganswer = model.predict(question)# Agent: plan - execute - observe - convergestate = init_state(goal)while not state.done and state.step < MAX_STEP:action = planner(state) # decide the next stepobservation = executor(action) # call a tool or retrieve knowledgestate = updater(state, observation)return state.result
1.2 Suitable and Unsuitable Scenarios
Suitable scenarios usually meet three conditions at once: the goal is describable, the result is verifiable, and the process leaves a trace. Examples include internal policy Q&A, log triage and alert root-cause attribution, bulk document structuring, data report generation, and code change description generation.
Unsuitable scenarios include: results that cannot be verified automatically while the cost of errors is extremely high (such as high-risk compliance conclusions); hard real-time constraints (millisecond-level control loops); final decisions that carry legal and audit responsibility; and cases where data cannot leave its domain and no on-premises deployment option exists. The engineering consensus is: let the agent produce output that has draft value, and leave the final judgment to humans.
2. Knowledge Base: From “Can Answer” to “Answer with Evidence”
The value of a knowledge base is not storage but the fact that retrieval quality determines answer quality. Four areas matter in practice.
- Chunking strategy: split by semantic structure (headings, clauses, paragraphs) rather than a fixed character count; keep the section path as metadata so sources can be traced back.
- Hybrid retrieval: vector retrieval is good at semantic similarity, keyword retrieval is good at exact matching of proper nouns and identifiers; fusing the two and then reranking significantly reduces noise from results that look relevant but are not.
- Citation and refusal: require answers to include source fragment IDs; when recall similarity falls below a threshold, refuse explicitly instead of improvising.
- Incremental updates: route document changes through incremental ingestion with version markers, so answers from old versions do not conflict with new policies.
A minimal working retrieval-augmented skeleton:
def answer(q, k=5, threshold=0.35):hits = hybrid_search(q, top_k=k) # fuse vector + keyword resultshits = [h for h in hits if h.score >= threshold]if not hits:return "No supporting evidence found in the knowledge base. Please add material or escalate to a human."context = "\n".join(f"[{h.id}] {h.text}" for h in hits)return model.predict(prompt=q, context=context, require_citation=True)
3. Skill Orchestration: Turning Capabilities into Reusable Building Blocks
A Skill is essentially a capability wrapper with a clear input/output contract. A well-designed skill has a single responsibility, validates its parameters, is retryable on failure, and keeps side effects under control. It helps to group skills into three types: read-only (retrieval, queries), compute (transformation, statistics), and write (submission, notification). Write skills must add human confirmation and an idempotency key to prevent duplicate submissions.
For orchestration, a “thin planner + thick skills” structure is recommended: the planner only handles routing and termination decisions, while complex logic is pushed down inside the skills. This keeps debugging boundaries clear and makes skills easy to test on their own.
SKILLS = {"search_kb": {"readonly": True, "fn": search_kb},"calc": {"readonly": True, "fn": calc},"create_ticket": {"readonly": False, "fn": create_ticket, "idempotent": True},}def run(goal):for step in range(6):name, args = planner(goal)spec = SKILLS[name]if not spec["readonly"] and not confirm(args):breakgoal = spec["fn"](**validate(args, spec))return summarize(goal)
4. Lightweight Runtime Form Factors and Selection Criteria
A common industry practice is to package the agent runtime as a lightweight container, which makes delivery and isolation in your own environment easier. Selection can follow the logic below:
| Dimension | Fully managed | Lightweight local |
|---|---|---|
| Onboarding cost | Low | Medium |
| Data leaving the domain | Needs assessment | Can stay in-domain |
| Customizability | Medium | High |
| Operations responsibility | Provider | User |
When model inference and compute are involved, general-purpose cloud categories can carry the workload: a container platform for runtime isolation, object storage for knowledge documents, a message queue for task decoupling, and logging plus monitoring and alerting for observability. Baidu AI Cloud offers corresponding capabilities in these general categories, and they can be combined freely according to compliance and cost requirements.
5. Acceptance and Operations Checklist
Before launch, complete at least five validations: recall hit rate and refusal accuracy, skill parameter validation coverage, idempotency and rollback for write operations, end-to-end latency distribution, and full-chain traceability (input, retrieved fragments, skill calls, output). During operations, focus on three metric groups: task success rate, average steps and timeout rate, and human takeover rate. A persistently high human takeover rate usually indicates problems with skill granularity or knowledge base quality, not insufficient model capability.
In summary, the engineering focus of agents has never been “better conversation,” but rather clear boundaries, traceable evidence, controllable actions, and observable processes. Following this path is what delivers stable returns in real business settings.
