Blog/Learn Agentic AI Development/Project Map, Test Evidence and the Next Assignment

Chapter 12 / 14 min read

Project Map, Test Evidence and the Next Assignment

Project structure, module responsibilities, recorded test outcomes, corrections and the next coding milestone.

Appendix: project map, test evidence and next implementation milestone

A. Project structure

The initial Git commit established the following 12-file project structure:

Code
agentic-ai-lab/
├── .gitignore
├── main.py
├── models/
│   ├── enums.py
│   └── schemas.py
├── orchestration/
│   └── dependency_resolver.py
├── ollama_client.py
├── test_dep_res.py
├── test_schema.py
├── tool_definitions.py
├── tool_executor.py
├── tool_registry.py
└── tools/
    └── calculator.py

The initial commit output was:

Code
635a075 Initial commit: Agentic AI learning project
12 files changed, 517 insertions(+)

The project ignores .venv/, __pycache__/ and .pytest_cache/. Virtual environments, generated bytecode and test caches should not be committed as application source.

B. What each module owns

ModuleResponsibility
main.pyConversation loop and application entry point
models/enums.pyExecution and step status values
models/schemas.pyPydantic input contracts and TaskStep
ollama_client.pyCommunication with local Ollama
tool_definitions.pyModel-facing tool descriptions
tool_registry.pyTool name to Python function mapping
tool_executor.pyValidation and controlled tool invocation
tools/calculator.pyAddition, multiplication and division
orchestration/dependency_resolver.pyDependency checks
test_schema.pySchema validation experiments
test_dep_res.pyDependency behavior tests

As development progressed, the project added an execution planner and execution-step tests. The 12-file list above describes the initial project snapshot; it does not imply that every later module was present from the beginning.

C. Test evidence from the learning sessions

The following experiments and outputs were produced during development:

Calculator functions

  • Addition: 100 + 250 returned 350.
  • Multiplication: 10 × 20 returned 200.
  • Multiplication with a negative number: −5 × 4 returned −20.
  • Division: 100 ÷ 5 returned 20.0.
  • Division by zero returned a structured failure.
  • Negative division: −100 ÷ 5 returned −20.0.

Pydantic validation

  • Valid search query was accepted.
  • Integer input was rejected where a strict string was expected.
  • An undeclared admin field was rejected because extra="forbid" was configured.
  • JSON Schema generation produced the expected properties and required fields.

Ollama tool calling

  • A plain string in the message list caused a message-format error.
  • A role/content dictionary was accepted.
  • The response was inspected as an Ollama ChatResponse.
  • A tool-call response was preserved with model_dump(exclude_none=True).
  • The tool result was appended as a tool message.
  • The next model call generated a natural-language answer.
  • The three-operation calculator task produced 2,100.

Execution history and failure handling

  • The division-by-zero tool call was recorded as failed.
  • The model responded with a clarification rather than inventing a valid result.
  • Execution records retained tool name, arguments, status, result and error.

Dependency resolution

The recorded dependency tests returned:

Code
Test 1 - No dependencies:          True
Test 2 - Dependency completed:     True
Test 3 - Dependency pending:        False
Test 4 - Dependency failed:        False
Test 5 - Dependency blocked:       False

The planner also demonstrated that a cycle eventually produces an “Unable to resolve dependencies” error rather than returning an invalid execution order.

Passing results

Manual result passing was demonstrated:

Code
Step 1: calculate_addition(10, 20) -> 30.0
Step 2: multiply_numbers(30.0, 5)   -> 150.0

Results store: {1: 30.0, 2: 150.0}

The resolver function was implemented after this test, but it was not fully integrated into the orchestrator.

D. Important corrections and lessons

  1. Python type hints are not runtime validation. Use Pydantic at the tool execution boundary.
  2. Do not confuse JSON Schema with runtime validation. JSON Schema describes the contract to the model; Pydantic validates the actual received data.
  3. Do not confuse tool definitions with the registry. One describes tools to the LLM; the other maps names to executable functions.
  4. Preserve the assistant tool-call message. The tool result belongs in the same conversation history.
  5. Append the final assistant response. Otherwise, later turns lose the final conversational context.
  6. Use the enum values actually defined. The dependency test initially used StepStatus.SUCCESS, but the step enum used COMPLETED.
  7. A planner's simulated completed set is not actual execution state. Only the executor should mark a real step completed.
  8. Do not treat a missing dependency as satisfied. Validate the task graph before planning.
  9. Do not assume model tool calls are independent. Dependencies must be represented and enforced by the application.
  10. A result reference needs failure semantics. A downstream step must not receive a missing result from a failed prerequisite.

E. The next implementation assignment

The next coding milestone is to integrate the existing pieces into a single dependency-aware calculator executor.

  1. Validate that every step ID is unique.
  2. Validate that every dependency ID exists.
  3. Reject self-dependencies and cycles.
  4. Find currently ready steps.
  5. Resolve source_step references immediately before execution.
  6. Validate resolved arguments using the schema associated with the tool.
  7. Execute the registered function.
  8. Record the attempt and update the step status.
  9. Store successful outputs by step ID.
  10. Mark dependent steps blocked when a prerequisite fails.
  11. Repeat until all steps are terminal or a task-level limit is reached.
  12. Produce a task-level status and business outcome.

Only after this flow is implemented and tested should we call the dependency-aware agent complete.

F. Why this foundation matters for enterprise AI

These building blocks also connect to practical enterprise AI architecture concerns, including the use of Pega as a target environment:

  • Pydantic schemas → controlled contracts at integration boundaries.
  • Tool registry → explicit capability catalogue.
  • Tool executor → governed execution layer.
  • Execution records → traceability and audit.
  • Dependency planner → orchestration of multi-step business work.
  • Result store → data flow between activities.
  • Status enums → operational monitoring and recovery.

These are architectural connections, not claims that this learning project is already integrated with Pega or Pega CDH. The purpose is to understand the engineering primitives well enough to apply them in those systems later.

Closing

The project began with a few Python functions and a local model. It progressed into structured tool contracts, controlled dispatch, conversation history, execution records, dependency planning and result passing.

The most valuable outcome is not a claim that an autonomous agent is finished. It is a clear understanding of the responsibilities required to build one—and a concrete next assignment that continues from the code already written.