fast-agent-mcp 0.1.3__py3-none-any.whl → 0.1.4__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: fast-agent-mcp
3
- Version: 0.1.3
3
+ Version: 0.1.4
4
4
  Summary: Define, Prompt and Test MCP enabled Agents and Workflows
5
5
  Author-email: Shaun Smith <fastagent@llmindset.co.uk>, Sarmad Qadri <sarmad@lastmileai.dev>
6
6
  License: Apache License
@@ -24,7 +24,7 @@ mcp_agent/core/enhanced_prompt.py,sha256=Zh1I_PZtQmH_v70dJ-gK5lnLOc42h6_Ai8FGi3a
24
24
  mcp_agent/core/error_handling.py,sha256=D3HMW5odrbJvaKqcpCGj6eDXrbFcuqYaCZz7fyYiTu4,623
25
25
  mcp_agent/core/exceptions.py,sha256=a2-JGRwFFRoQEPuAq0JC5PhAJ5TO3xVJfdS4-VN29cw,2225
26
26
  mcp_agent/core/fastagent.py,sha256=G0GNOD1JMD37rAaZdYRNsa7gXYjvYiV6Cg39laBKRW8,59714
27
- mcp_agent/core/proxies.py,sha256=5eIqi63wcJMG9aLu_8QF78mS9w4hYas-bcdJqcWZ-fU,6638
27
+ mcp_agent/core/proxies.py,sha256=35k-j-umlQ4sTBK1Z8qNsBS3ciG5ZqAUVazL-Tlmk6s,6238
28
28
  mcp_agent/core/server_validation.py,sha256=_59cn16nNT4HGPwg19HgxMtHK4MsdWYDUw_CuL-5xek,1696
29
29
  mcp_agent/core/simulator_registry.py,sha256=rcd1cyFGx8MAnN5O0UgwElmVKU_uoIBh9s24pxP33Jc,573
30
30
  mcp_agent/core/types.py,sha256=Zhi9iW7uiOfdpSt9NC0FCtGRFtJPg4mpZPK2aYi7a7M,817
@@ -118,8 +118,8 @@ mcp_agent/workflows/swarm/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
118
118
  mcp_agent/workflows/swarm/swarm.py,sha256=-lAIeSWDqbGHGRPTvjiP9nIKWvxxy9DAojl9yQzO1Pw,11050
119
119
  mcp_agent/workflows/swarm/swarm_anthropic.py,sha256=pW8zFx5baUWGd5Vw3nIDF2oVOOGNorij4qvGJKdYPcs,1624
120
120
  mcp_agent/workflows/swarm/swarm_openai.py,sha256=wfteywvAGkT5bLmIxX_StHJq8144whYmCRnJASAjOes,1596
121
- fast_agent_mcp-0.1.3.dist-info/METADATA,sha256=Hxlhct68x9F9beQ16vrdjC_AkzP9ex6-VuAuCkNpl-0,27924
122
- fast_agent_mcp-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
123
- fast_agent_mcp-0.1.3.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
124
- fast_agent_mcp-0.1.3.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
125
- fast_agent_mcp-0.1.3.dist-info/RECORD,,
121
+ fast_agent_mcp-0.1.4.dist-info/METADATA,sha256=I8Te4FG-3ClIawLJBEYIkUkaJacG4BiKfF-cuMuUBrs,27924
122
+ fast_agent_mcp-0.1.4.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
123
+ fast_agent_mcp-0.1.4.dist-info/entry_points.txt,sha256=2IXtSmDK9XjWN__RWuRIJTgWyW17wJnJ_h-pb0pZAxo,174
124
+ fast_agent_mcp-0.1.4.dist-info/licenses/LICENSE,sha256=cN3FxDURL9XuzE5mhK9L2paZo82LTfjwCYVT7e3j0e4,10939
125
+ fast_agent_mcp-0.1.4.dist-info/RECORD,,
mcp_agent/core/proxies.py CHANGED
@@ -119,52 +119,48 @@ class ChainProxy(BaseAgentProxy):
119
119
  self._continue_with_final = True # Default behavior
120
120
  self._cumulative = False # Default to sequential chaining
121
121
 
122
- async def generate_str(self, message: str) -> str:
123
- """Chain message through a sequence of agents with optional cumulative behavior"""
124
- if not self._cumulative:
125
- # Original sequential behavior
126
- current_message = message
127
- for agent_name in self._sequence:
128
- proxy = self._agent_proxies[agent_name]
129
- current_message = await proxy.generate_str(current_message)
130
- return current_message
131
- else:
132
- # Cumulative behavior
133
- original_message = message
134
- agent_responses = {}
135
-
136
- for agent_name in self._sequence:
137
- proxy = self._agent_proxies[agent_name]
138
-
139
- if not agent_responses: # First agent
140
- response = await proxy.generate_str(original_message)
141
- else:
142
- # Construct context with previous responses
143
- context_message = "The following request was sent to the agents:\n"
144
- context_message += f"<fastagent:request>\n{original_message}\n</fastagent:request>\n\n"
122
+ async def generate_str(self, message: str, **kwargs) -> str:
123
+ """Chain message through a sequence of agents.
145
124
 
146
- context_message += "Previous agent responses:\n"
125
+ For the first agent in the chain, pass all kwargs to maintain transparency.
147
126
 
148
- for prev_name in self._sequence:
149
- if prev_name in agent_responses:
150
- prev_response = agent_responses[prev_name]
151
- context_message += f'<fastagent:response agent="{prev_name}">\n{prev_response}\n</fastagent:response>\n\n'
127
+ Two modes of operation:
128
+ 1. Sequential (default): Each agent receives only the output of the previous agent
129
+ 2. Cumulative: Each agent receives all previous agent responses concatenated
130
+ """
131
+ if not self._sequence:
132
+ return message
152
133
 
153
- context_message += f"Your task is to build upon this work to address: {original_message}"
134
+ # Process the first agent (same for both modes)
135
+ first_agent = self._sequence[0]
136
+ first_proxy = self._agent_proxies[first_agent]
137
+ first_response = await first_proxy.generate_str(message, **kwargs)
154
138
 
155
- response = await proxy.generate_str(context_message)
139
+ if len(self._sequence) == 1:
140
+ return first_response
156
141
 
157
- agent_responses[agent_name] = response
142
+ if self._cumulative:
143
+ # Cumulative mode: each agent gets all previous responses
144
+ cumulative_response = f"<{first_agent}>\n{first_response}\n</{first_agent}>"
158
145
 
159
- # Format final output with ALL responses in XML format
160
- final_output = "The following request was sent to the agents:\n"
161
- final_output += (
162
- f"<fastagent:request>\n{original_message}\n</fastagent:request>\n\n"
163
- )
146
+ # Process subsequent agents with cumulative results
147
+ for agent_name in self._sequence[1:]:
148
+ proxy = self._agent_proxies[agent_name]
149
+ # Pass all previous responses to next agent
150
+ agent_response = await proxy.generate_str(cumulative_response)
151
+ # Add this agent's response to the cumulative result
152
+ cumulative_response += (
153
+ f"\n\n<{agent_name}>\n{agent_response}\n</{agent_name}>"
154
+ )
155
+
156
+ return cumulative_response
157
+ else:
158
+ # Sequential chaining (original behavior)
159
+ current_message = first_response
164
160
 
165
- for agent_name in self._sequence:
166
- response = agent_responses[agent_name]
167
- final_output += f'<fastagent:response agent="{agent_name}">\n{response}\n</fastagent:response>\n\n'
161
+ # For subsequent agents, just pass the message from previous agent
162
+ for agent_name in self._sequence[1:]:
163
+ proxy = self._agent_proxies[agent_name]
164
+ current_message = await proxy.generate_str(current_message)
168
165
 
169
- # Return the XML-structured combination of all responses
170
- return final_output.strip()
166
+ return current_message