Skip to content

job_status_agent

SensAI domain agent for job status: read-only, and it answers in words from what its tools worked out.

get_job_summary async

Python
get_job_summary(ctx: RunContext[SensAIDeps]) -> str

Returns a high-level summary of the current job's status and progress: counts, how many trials are running and waiting, timing and the estimate of what is left.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_job_summary(ctx: RunContext[SensAIDeps]) -> str:
    """Returns a high-level summary of the current job's status and progress: counts, how many trials are running and waiting, timing and the estimate of what is left."""
    logger.info("SensAI get_job_summary")
    job = ctx.deps.job_status
    return NO_JOB if job is None else job_report.describe_summary(job, job_report.now())

get_running_trials async

Python
get_running_trials(ctx: RunContext[SensAIDeps]) -> str

Returns the trials running right now, each with the step it is in, how long it has been in that step and how long it has been running in all, the longest running first.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_running_trials(ctx: RunContext[SensAIDeps]) -> str:
    """Returns the trials running right now, each with the step it is in, how long it has been in that step and how long it has been running in all, the longest running first."""
    logger.info("SensAI get_running_trials")
    job = ctx.deps.job_status
    return NO_JOB if job is None else job_report.describe_running(job, job_report.now())

get_trials_by_duration async

Python
get_trials_by_duration(
    ctx: RunContext[SensAIDeps],
    count: int = 5,
    longest: bool = True,
    outcome: Outcome = "completed",
) -> str

Ranks the finished trials by how long each took, so one call answers which trial was slowest or fastest. Use this instead of looking at trials one at a time.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
count int

How many trials to list, such as 5 (at most 20).

5
longest bool

True to list the trials that took the longest first, False for the ones that took the shortest first.

True
outcome Outcome

Which trials to rank. "completed" (the default) is the successes and the ones that missed a requirement, as the job's own average is taken over. "success", "failure" (missed a requirement) or "error" (crashed) ranks only those, such as outcome="failure" for the slowest trial that failed. "any" ranks every finished trial, errored ones too.

'completed'

Returns:

Type Description
str

The trials in order, each with its total time and how it ended, and how many finished trials were ranked.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_trials_by_duration(
    ctx: RunContext[SensAIDeps],
    count: int = 5,
    longest: bool = True,
    outcome: Outcome = "completed",
) -> str:
    """
    Ranks the finished trials by how long each took, so one call answers which trial was slowest or fastest. Use this instead of looking at trials one at a time.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        count: How many trials to list, such as 5 (at most 20).
        longest: True to list the trials that took the longest first, False for the ones that took the shortest first.
        outcome: Which trials to rank. "completed" (the default) is the successes and the ones that missed a requirement, as the job's own average is taken over. "success", "failure" (missed a requirement) or "error" (crashed) ranks only those, such as outcome="failure" for the slowest trial that failed. "any" ranks every finished trial, errored ones too.

    Returns:
        The trials in order, each with its total time and how it ended, and how many finished trials were ranked.

    """
    logger.info(
        "SensAI get_trials_by_duration: count=%s longest=%s outcome=%s",
        count,
        longest,
        outcome,
    )
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return job_report.describe_ranking(job, count, longest, outcome)

get_duration_statistics async

Python
get_duration_statistics(ctx: RunContext[SensAIDeps]) -> str

Returns how long the completed trials took as a spread (fastest, median, mean, 90th percentile, slowest), by how they ended, the time in each step (generating and solving) and how many trials finish per minute.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_duration_statistics(ctx: RunContext[SensAIDeps]) -> str:
    """Returns how long the completed trials took as a spread (fastest, median, mean, 90th percentile, slowest), by how they ended, the time in each step (generating and solving) and how many trials finish per minute."""
    logger.info("SensAI get_duration_statistics")
    job = ctx.deps.job_status
    return NO_JOB if job is None else job_report.describe_duration_statistics(job)

get_requirement_results async

Python
get_requirement_results(
    ctx: RunContext[SensAIDeps], requirement: str = ""
) -> str

Returns how each requirement did across the trials, most failures first. With a requirement named, also the trials that missed it and the reasons they gave.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
requirement str

Leave it out for every requirement. To look into one, its name or part of it, such as "touchdown_speed".

''

Returns:

Type Description
str

Pass and fail counts and rates, and for a named requirement the failing trial numbers and the messages.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_requirement_results(
    ctx: RunContext[SensAIDeps], requirement: str = ""
) -> str:
    """
    Returns how each requirement did across the trials, most failures first. With a requirement named, also the trials that missed it and the reasons they gave.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        requirement: Leave it out for every requirement. To look into one, its name or part of it, such as "touchdown_speed".

    Returns:
        Pass and fail counts and rates, and for a named requirement the failing trial numbers and the messages.

    """
    logger.info("SensAI get_requirement_results: %r", requirement)
    job = ctx.deps.job_status
    return NO_JOB if job is None else job_report.describe_requirements(job, requirement)

get_errored_trials async

Python
get_errored_trials(ctx: RunContext[SensAIDeps]) -> str

Returns the trials that errored (crashed with an exception, as opposed to missing a requirement), grouped by what each trial's log says went wrong (the exception), with the step each was in when it broke.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_errored_trials(ctx: RunContext[SensAIDeps]) -> str:
    """Returns the trials that errored (crashed with an exception, as opposed to missing a requirement), grouped by what each trial's log says went wrong (the exception), with the step each was in when it broke."""
    logger.info("SensAI get_errored_trials")
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(job_report.describe_errored, job)

get_trial_breakdown async

Python
get_trial_breakdown(ctx: RunContext[SensAIDeps]) -> str

Returns the trial numbers in each state: succeeded, failed requirements, errored, running and waiting to start.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_trial_breakdown(ctx: RunContext[SensAIDeps]) -> str:
    """Returns the trial numbers in each state: succeeded, failed requirements, errored, running and waiting to start."""
    logger.info("SensAI get_trial_breakdown")
    job = ctx.deps.job_status
    return (
        NO_JOB if job is None else job_report.describe_breakdown(job, job_report.now())
    )

get_trial_details async

Python
get_trial_details(
    ctx: RunContext[SensAIDeps], trial_num: int
) -> str

Returns one trial's details: how it ended, the time of each step, how long it has run so far if it is running, and the result of each requirement with its message.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
trial_num int

The number of the trial, such as 12.

required

Returns:

Type Description
str

The trial's steps, total time and requirement results, and for an errored one what its log says went wrong.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_trial_details(ctx: RunContext[SensAIDeps], trial_num: int) -> str:
    """
    Returns one trial's details: how it ended, the time of each step, how long it has run so far if it is running, and the result of each requirement with its message.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        trial_num: The number of the trial, such as 12.

    Returns:
        The trial's steps, total time and requirement results, and for an errored one what its log says went wrong.

    """
    logger.info("SensAI get_trial_details: trial %s", trial_num)
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(
        job_report.describe_trial, job, trial_num, job_report.now()
    )

get_job_configuration async

Python
get_job_configuration(ctx: RunContext[SensAIDeps]) -> str

Returns how the job was started: its type, who started it and when, the execution mode, the number of processes, the seed, the working folder, the generator and runtime, and the --arg and --kwarg values it ran with.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_job_configuration(ctx: RunContext[SensAIDeps]) -> str:
    """Returns how the job was started: its type, who started it and when, the execution mode, the number of processes, the seed, the working folder, the generator and runtime, and the --arg and --kwarg values it ran with."""
    logger.info("SensAI get_job_configuration")
    job = ctx.deps.job_status
    return NO_JOB if job is None else job_report.describe_configuration(job)

get_recent_trials async

Python
get_recent_trials(
    ctx: RunContext[SensAIDeps],
    count: int = 5,
    outcome: Outcome = "any",
) -> str

Lists the trials that finished most recently, newest first, each with how long ago it finished and how long it took, and for a failure the requirements it missed or for an error what its log says.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
count int

How many trials to list, such as 5 (at most 20).

5
outcome Outcome

Which trials to list. "any" (the default) is every finished trial. "success", "failure" (missed a requirement) or "error" (crashed) lists only those, such as outcome="error" for the latest errors. "completed" is the successes and the failures together.

'any'

Returns:

Type Description
str

The trials, newest first, and how many finished in all.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_recent_trials(
    ctx: RunContext[SensAIDeps], count: int = 5, outcome: Outcome = "any"
) -> str:
    """
    Lists the trials that finished most recently, newest first, each with how long ago it finished and how long it took, and for a failure the requirements it missed or for an error what its log says.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        count: How many trials to list, such as 5 (at most 20).
        outcome: Which trials to list. "any" (the default) is every finished trial. "success", "failure" (missed a requirement) or "error" (crashed) lists only those, such as outcome="error" for the latest errors. "completed" is the successes and the failures together.

    Returns:
        The trials, newest first, and how many finished in all.

    """
    logger.info("SensAI get_recent_trials: count=%s outcome=%s", count, outcome)
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(
        job_report.describe_recent, job, job_report.now(), count, outcome
    )

get_completion_timeline async

Python
get_completion_timeline(ctx: RunContext[SensAIDeps]) -> str

Returns when trials finished: the job's life so far in equal time slices, each with how many trials finished, how they ended and their mean time, so a slowdown, a stall, or the time errors began can be seen.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_completion_timeline(ctx: RunContext[SensAIDeps]) -> str:
    """Returns when trials finished: the job's life so far in equal time slices, each with how many trials finished, how they ended and their mean time, so a slowdown, a stall, or the time errors began can be seen."""
    logger.info("SensAI get_completion_timeline")
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return job_report.describe_timeline(job, job_report.now())

get_trial_log async

Python
get_trial_log(
    ctx: RunContext[SensAIDeps],
    trial_num: int,
    count: int = 20,
    level: LogLevel = "any",
) -> str

Returns the end of one trial's log: each entry's time, level and message, with a long traceback cut to its first and last lines.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
trial_num int

The number of the trial, such as 12.

required
count int

How many of the last entries to show, such as 20 (at most 30).

20
level LogLevel

Which entries to show. "any" (the default) is all of them, "warning" is warnings and worse, "error" is errors only, such as level="error" to find what went wrong.

'any'

Returns:

Type Description
str

The last entries of the trial's log, oldest first, or that the trial has no log.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_trial_log(
    ctx: RunContext[SensAIDeps],
    trial_num: int,
    count: int = 20,
    level: LogLevel = "any",
) -> str:
    """
    Returns the end of one trial's log: each entry's time, level and message, with a long traceback cut to its first and last lines.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        trial_num: The number of the trial, such as 12.
        count: How many of the last entries to show, such as 20 (at most 30).
        level: Which entries to show. "any" (the default) is all of them, "warning" is warnings and worse, "error" is errors only, such as level="error" to find what went wrong.

    Returns:
        The last entries of the trial's log, oldest first, or that the trial has no log.

    """
    logger.info(
        "SensAI get_trial_log: trial %s count=%s level=%s", trial_num, count, level
    )
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(
        job_report.describe_trial_log, job, trial_num, count, level
    )

compare_trials async

Python
compare_trials(
    ctx: RunContext[SensAIDeps], trial_nums: list[int]
) -> str

Compares trials side by side: how each ended, its time in each step, which requirements differ between them, and for an errored one what its log says.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
trial_nums list[int]

The numbers of the trials to compare, two to six, such as [3, 7].

required

Returns:

Type Description
str

The trials compared line by line, with how much longer the slowest took than the fastest.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def compare_trials(ctx: RunContext[SensAIDeps], trial_nums: list[int]) -> str:
    """
    Compares trials side by side: how each ended, its time in each step, which requirements differ between them, and for an errored one what its log says.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        trial_nums: The numbers of the trials to compare, two to six, such as [3, 7].

    Returns:
        The trials compared line by line, with how much longer the slowest took than the fastest.

    """
    logger.info("SensAI compare_trials: %s", trial_nums)
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(
        job_report.describe_comparison, job, trial_nums, job_report.now()
    )

get_input_distributions async

Python
get_input_distributions(ctx: RunContext[SensAIDeps]) -> str

Returns the input distributions the job's trials were sampled from: each one's name, type, category, unit, nominal value and parameters (which give its range or spread, such as low and high for a uniform or mu and sigma for a normal), and any display name, source and comment.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_input_distributions(ctx: RunContext[SensAIDeps]) -> str:
    """Returns the input distributions the job's trials were sampled from: each one's name, type, category, unit, nominal value and parameters (which give its range or spread, such as low and high for a uniform or mu and sigma for a normal), and any display name, source and comment."""
    logger.info("SensAI get_input_distributions")
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(dist_report.describe_distributions, job)

get_trial_inputs async

Python
get_trial_inputs(
    ctx: RunContext[SensAIDeps], trial_num: int
) -> str

Returns what one trial drew for each input, in the unit the input was declared in, with how many standard deviations from the mean the draw is and its percentile.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
trial_num int

The number of the trial, such as 12.

required

Returns:

Type Description
str

Each input with the value (or label) the trial drew, or that the trial saved nothing.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_trial_inputs(ctx: RunContext[SensAIDeps], trial_num: int) -> str:
    """
    Returns what one trial drew for each input, in the unit the input was declared in, with how many standard deviations from the mean the draw is and its percentile.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        trial_num: The number of the trial, such as 12.

    Returns:
        Each input with the value (or label) the trial drew, or that the trial saved nothing.

    """
    logger.info("SensAI get_trial_inputs: trial %s", trial_num)
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(dist_report.describe_trial_inputs, job, trial_num)

get_input_outliers async

Python
get_input_outliers(
    ctx: RunContext[SensAIDeps],
    distribution: str,
    min_sigma: float = 2.0,
    count: int = 15,
) -> str

Returns the trials that drew one input at least some number of standard deviations from its mean, most extreme first, with each draw.

Parameters:

Name Type Description Default
ctx RunContext[SensAIDeps]

The run context holding the dashboard state; it is not something you send.

required
distribution str

The input's name or part of it, such as "wind_speed". Use get_input_distributions to see the names.

required
min_sigma float

How many standard deviations from the mean a draw has to be, such as 2 (the default) or 3.

2.0
count int

How many trials to list, such as 15 (at most 30). Every trial number is given at the end whatever this is.

15

Returns:

Type Description
str

How many trials drew it that far out, the most extreme of them with their values, and all their numbers.

Source code in src/mujoco_mojo/utils/layers/dojo/sensai/job_status_agent.py
Python
@job_status_agent.tool
async def get_input_outliers(
    ctx: RunContext[SensAIDeps],
    distribution: str,
    min_sigma: float = 2.0,
    count: int = 15,
) -> str:
    """
    Returns the trials that drew one input at least some number of standard deviations from its mean, most extreme first, with each draw.

    Args:
        ctx: The run context holding the dashboard state; it is not something you send.
        distribution: The input's name or part of it, such as "wind_speed". Use get_input_distributions to see the names.
        min_sigma: How many standard deviations from the mean a draw has to be, such as 2 (the default) or 3.
        count: How many trials to list, such as 15 (at most 30). Every trial number is given at the end whatever this is.

    Returns:
        How many trials drew it that far out, the most extreme of them with their values, and all their numbers.

    """
    logger.info(
        "SensAI get_input_outliers: %r min_sigma=%s count=%s",
        distribution,
        min_sigma,
        count,
    )
    job = ctx.deps.job_status
    if job is None:
        return NO_JOB
    return await asyncio.to_thread(
        dist_report.describe_input_outliers, job, distribution, min_sigma, count
    )