Skip to main content
Article
learning-pathspersonalizationupskillingcareer-developmentcompetency-mappingpythonapi-integration

Build a Skill Plan with the Learning Path Optimizer

Define your current skills and target career goal. Use the Learning Path Optimizer agent to generate the most efficient, credentialed learning path based on real-time labor market data to prioritize high-value skills.

intermediate30 min5 steps
The play
  1. Define Your Learner Profile
    Create a data structure representing your current skills and credentials. The Learning Path Optimizer uses this baseline to perform its initial skill-gap analysis. Specificity is key to a high-quality recommendation.
  2. Set Your Target Competency
    Specify your desired job role or a set of target skills. This is the destination the Learning Path Optimizer will build a path towards, cross-referencing it with its internal labor-market signals.
  3. Request an Optimized Path
    Send your profile and target to the Learning Path Optimizer's recommendation endpoint. The agent will process the skill gap and synthesize the shortest path using available credentials from its knowledge base.
  4. Review the Generated Path
    The agent returns an ordered list of learning modules. Each step includes the credential name, the skills it covers, and a link. This is your personalized curriculum, optimized for efficiency.
  5. Update Progress to Re-Optimize
    As you complete modules, report this back to the agent. The Learning Path Optimizer will continuously re-evaluate and adjust your path, ensuring it remains optimal based on your new skills and any market shifts.
Starter code
import requests
import json
import os

# This is a hypothetical API. The code demonstrates the interaction pattern.
API_BASE_URL = "https://api.coursera.org/v1/optimizer"
# In a real scenario, get your key from your Coursera developer dashboard
API_KEY = os.environ.get("COURSERA_API_KEY", "YOUR_API_KEY_HERE")

headers = {
    "Authorization": f"Bearer {API_KEY}",
    "Content-Type": "application/json"
}

def get_optimized_path(profile, target):
    """Sends profile and target to the Learning Path Optimizer and gets a plan."""
    print("\n--- Requesting Optimized Learning Path ---")
    payload = {
        "profile": profile,
        "target": target
    }
    
    # In a real application, you would make a network request.
    # We will mock the response here to make the script runnable.
    # response = requests.post(f"{API_BASE_URL}/generate-path", headers=headers, json=payload)
    # response.raise_for_status()
    # return response.json()

    print("API call mocked for demonstration.")
    mock_response = {
        "path_id": "path-xyz-123",
        "estimated_total_time_hours": 120,
        "learning_path": [
            {
                "id": "module-v2-abc",
                "order": 1,
                "credential_name": "DeepLearning.AI TensorFlow Developer Professional Certificate",
                "skills_gained": ["TensorFlow", "Convolutional Neural Networks"],
                "url": "https://www.coursera.org/professional-certificates/tensorflow-in-practice"
            },
            {
                "id": "module-v2-def",
                "order": 2,
                "credential_name": "MLOps Specialization",
                "skills_gained": ["MLOps", "Model Deployment", "TFX"],
                "url": "https://www.coursera.org/specializations/machine-learning-engineering-for-production-mlops"
            }
        ]
    }
    return mock_response

if __name__ == "__main__":
    # 1. Define your current profile
    current_profile = {
        "skills": ["Python", "Data Analysis", "SQL", "Pandas"],
        "credentials": ["Google Data Analytics Certificate"]
    }

    # 2. Define your target role
    target_role = {
        "role": "Machine Learning Engineer"
    }

    # 3. Get the optimized path
    try:
        path_data = get_optimized_path(current_profile, target_role)
        print("\n--- Recommended Learning Path ---")
        print(json.dumps(path_data, indent=2))

        # 4. Review the path
        print("\n--- Path Summary ---")
        for i, step in enumerate(path_data['learning_path']):
            print(f"Step {i+1}: {step['credential_name']}")
            print(f"  -> Skills: {', '.join(step['skills_gained'])}")
            print(f"  -> URL: {step['url']}")

    except requests.exceptions.RequestException as e:
        print(f"API call failed: {e}")
    except KeyError as e:
        print(f"Could not parse response: missing key {e}")
Build a Skill Plan with the Learning Path Optimizer — Action Pack