Skip to main content
Glama

reuse_prediction_agent_and_get_prediction

Obtain probability predictions for binary outcomes using a pre-configured Chronulus agent. Input data aligns with the existing model, and results include expert consensus, individual estimates, text explanations, and Beta distribution parameters for confidence intervals.

Instructions

This tool provides prediction input data to a previously created Chronulus BinaryPredictor agent and returns the consensus a prediction from a panel of experts along with their individual estimates and text explanations. The agent also returns the alpha and beta parameters for a Beta distribution that allows you to estimate the confidence interval of its consensus probability estimate.

When to use this tool:

  • Use this tool to request a prediction from a Chronulus prediction agent that you have already created and when your input data model is unchanged

  • Use this tool to request a probability estimate from an existing prediction agent in a situation when there is a binary outcome

  • This tool is specifically made to estimate the probability of an event occurring and not occurring and does not require historical data

How to use this tool:

  • First, make sure you have a session_id for the prediction use case.

  • Next, think about the features / characteristics most suitable for producing the requested prediction and then create an input_data_model that corresponds to the input_data you will provide for the thing or event being predicted.

  • Remember to pass all relevant information to Chronulus including text and images provided by the user.

  • If a user gives you files about a thing you are forecasting or predicting, you should pass these as inputs to the agent using one of the following types:

    • ImageFromFile

    • List[ImageFromFile]

    • TextFromFile

    • List[TextFromFile]

    • PdfFromFile

    • List[PdfFromFile]

  • If you have a large amount of text (over 500 words) to pass to the agent, you should use the Text or List[Text] field types

  • Finally, provide the number of experts to consult. The minimum and default number is 2, but users may request up to 30 30 opinions in situations where reproducibility and risk sensitively is of the utmost importance. In most cases, 2 to 5 experts is sufficient.

How to use this tool:

  • First, make sure you have an agent_id for the prediction agent. The agent is already attached to the correct session. So you do not need to provide a session_id.

  • Next, reference the input data model that you previously used with the agent and create new input data for the item being predicted that aligns with the previously specified input data model

  • Remember to pass all relevant information to Chronulus including text and images provided by the user.

  • If a user gives you files about a thing you are forecasting or predicting, you should pass these as inputs to the agent using one of the following types:

    • ImageFromFile

    • List[ImageFromFile]

    • TextFromFile

    • List[TextFromFile]

    • PdfFromFile

    • List[PdfFromFile]

  • If you have a large amount of text (over 500 words) to pass to the agent, you should use the Text or List[Text] field types

  • Finally, provide the number of experts to consult. The minimum and default number is 2, but users may request up to 30 30 opinions in situations where reproducibility and risk sensitively is of the utmost importance. In most cases, 2 to 5 experts is sufficient.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
agent_idYesThe agent_id for the forecasting or prediction use case and previously defined input_data_model
input_dataYesThe forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields.
num_expertsYesThe number of experts to consult when forming consensus

Implementation Reference

  • The async handler function that implements the tool logic: loads the existing BinaryPredictor agent using agent_id, validates input_data against the agent's input_type, queues a new prediction request with specified num_experts, retrieves the prediction_set, and returns agent_id, request_id, beta_params, expert_opinions, and probability. Handles errors appropriately.
    async def reuse_prediction_agent_and_get_prediction( agent_id: Annotated[str, Field(description="The agent_id for the forecasting or prediction use case and previously defined input_data_model")], input_data: Annotated[Dict[str, Union[str, dict, List[dict]]], Field( description="The forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields.")], num_experts: Annotated[int, Field(description="The number of experts to consult when forming consensus")], ) -> Union[str, Dict[str, Union[dict, str]]]: """Queues and retrieves a binary event prediction from Chronulus with a previously created agent_id This tool provides a prediction input to a previous created Chronulus BinaryPredictor agent and returns the prediction data and text explanations from each of the experts consulted by the agent. Args: agent_id (str): The agent_id for the forecasting or prediction use case and previously defined input_data_model input_data (Dict[str, Union[str, dict, List[dict]]]): The forecast inputs that you will pass to the chronulus agent to make the prediction. The keys of the dict should correspond to the InputField name you provided in input_fields. num_experts (int): The number of experts to consult when forming consensus. Returns: Union[str, Dict[str, Union[dict, str]]]: a dictionary with prediction data, a text explanation of the predictions, agent_id, and probability estimate. """ agent = BinaryPredictor.load_from_saved_estimator(estimator_id=agent_id, verbose=False) item = agent.input_type(**input_data) try: req = agent.queue(item, num_experts=num_experts, note_length=(5,10)) except Exception as e: return f"""Error at nf_agent: {str(e)}""" try: prediction_set = agent.get_request_predictions(req.request_id) return { "agent_id": agent.estimator_id, "request_id": req.request_id, "beta_params": prediction_set.beta_params, 'expert_opinions': [p.text for p in prediction_set], 'probability': prediction_set.prob_a} except Exception as e: return f"""Error on prediction: {str(e)}"""
  • Registers the 'reuse_prediction_agent_and_get_prediction' tool with the FastMCP server instance, providing a detailed description for usage.
    mcp.add_tool(reuse_prediction_agent_and_get_prediction, description=REUSE_AGENT_AND_GET_PREDICTION_DESCRIPTION)
  • Imports the handler function from predictor.py to make it available for registration in the MCP server.
    from chronulus_mcp.agent.predictor import create_prediction_agent_and_get_predictions, reuse_prediction_agent_and_get_prediction

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ChronulusAI/chronulus-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server