Skip to content

Conversation

@mvcrouse
Copy link

@mvcrouse mvcrouse commented Dec 2, 2025

Purpose:

  • We have an agentic workflow where there an agent has a set of submodules (i.e., nodes) available to complete a task
  • We would like to use a single Mellea session to encompass all of the nodes (rather than having completely separate Mellea sessions for each of the nodes)

Problems:

  • A single Mellea session has a global context, thus, if each node has separate system prompts, each system prompt would be visible to the other nodes
  • Both the input and output to aact are automatically added to the context, hence if the output of a node is to serve as the input to another node, this is challenging as it will be added twice (once as output and once as input)

Solutions:

  • Add labels to each context node that allows for control as to how much of the context is visible on a particular action
  • Allow for null actions where generation occurs from the existing context and the input (which is None), is not added to the context.

Here's an example of the Context that is used for generation in each node in a multi-node tool calling setup with the proposed solutions

Thought Node:

[
    {
        "role": "developer",
        "content": "You are a thinking agent. You will be provided with a prompt and a list of tools.\nYou must plan how you will solve the tool calling problem with tools.\nMention specific tools and arguments to those tools in your plan\n\nYou have access to the following tools.\n\n{\n    \"name\": \"calculator\",\n    \"description\": \"Perform basic math operations\",\n    \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"expression\": {\n                \"type\": \"string\"\n            }\n        },\n        \"required\": [\n            \"expression\"\n        ]\n    }\n}\n\n{\n    \"name\": \"get_current_weather\",\n    \"description\": \"Get the current weather\",\n    \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"location\": {\n                \"type\": \"string\",\n                \"description\": \"The city and state, e.g. San Francisco, CA\"\n            }\n        },\n        \"required\": [\n            \"location\"\n        ]\n    }\n}"
    },
    {
        "role": "user",
        "content": "What is (42 * 19) - 7 and whats the weather in NY?"
    }
]

Tool Calling Node:

[
    {
        "role": "developer",
        "content": "You are a tool calling agent. You will be provided with a prompt and must respond with tool calls.\n\nTo call a function, please respond with JSON for a function call. Respond in a JSON format like {\"name\": function name, \"parameters\": {\"arg1_name\": arg1_val, \"arg2_name\": arg1_va2, .. etc}. Do not use variables. If multiple function calls are needed, separate them with a ';' semicolon\n\nYou have access to the following tools.\n\n{\n    \"name\": \"calculator\",\n    \"description\": \"Perform basic math operations\",\n    \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"expression\": {\n                \"type\": \"string\"\n            }\n        },\n        \"required\": [\n            \"expression\"\n        ]\n    }\n}\n\n{\n    \"name\": \"get_current_weather\",\n    \"description\": \"Get the current weather\",\n    \"parameters\": {\n        \"type\": \"object\",\n        \"properties\": {\n            \"location\": {\n                \"type\": \"string\",\n                \"description\": \"The city and state, e.g. San Francisco, CA\"\n            }\n        },\n        \"required\": [\n            \"location\"\n        ]\n    }\n}"
    },
    {
        "role": "user",
        "content": "What is (42 * 19) - 7 and whats the weather in NY?"
    },
    {
        "role": "assistant",
        "content": "**Plan**\n\n1. **Calculate the arithmetic expression**  \n   - Use the **`calculator`** tool.  \n   - Pass the expression `\"42 * 19 - 7\"` as the `expression` argument.\n\n2. **Retrieve the current weather for New York**  \n   - Use the **`get_current_weather`** tool.  \n   - Pass the location `\"New York, NY\"` (or `\"NY\"` if the tool expects a shorter form) as the `location` argument.\n\nAfter obtaining both results, I will combine them into a single answer for you."
    }
]

=== 17:44:29-INFO ======
SUCCESS
  0%|                                                                                                                                                    | 0/3 [00:04<?, ?it/s]
mellea.Message(role="assistant", content="{"name": "calculator", "parameters": {"expression": "42 * 19 - 7"}};{"name": "get_current_weather", "parameters": {"location": "New York, NY"}}", images="[]")

@mergify
Copy link

mergify bot commented Dec 2, 2025

Merge Protections

Your pull request matches the following merge protections and will not be merged until they are valid.

🔴 Enforce conventional commit

This rule is failing.

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|docs|style|refactor|perf|test|build|ci|chore|revert|release)(?:\(.+\))?:

@avinash2692 avinash2692 self-requested a review December 3, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant